7 Replies Latest reply on Jun 3, 2015 10:15 PM by Fred(CH)

    Disabling Allow deletion of portal record IGNORED

    Fred(CH)

      Summary

      Disabling Allow deletion of portal record IGNORED

      Version

      11 (at least) to 13

      Operating system version

      All

      Description of the issue

      When activate a portal row where the portal doesn't allow row deletion, if you perform a "Delete Record" script step AND if not any field have the focus, the step is deleting the portal row instead the entire record.

      Steps to reproduce the problem

      Create a portal where "Allow deletion of portal record" option is unchecked
      Create a script that invoke the Delete Record step
      In browse Mode, Activate a portal row but without enter in a field
      Execute your script

      Test the behaviors within the simple test file provided below.

      Expected result

      The main record must be deleted without dialog or after appropriate dialog depending if you checked the option "with dialog" in your script.

      Actual result

      The related record is deleted without dialog or a dialog ask you to confirm the deletion of related record if you checked the option "with dialog" in your script.

      Exact text of any error message(s) that appear

      N/A

      Configuration information

      N/A

      Workaround

      Invoke first of all a Commit Record Request to be sure that not any row is selected.

        • 2. Re: Disabling Allow deletion of portal record IGNORED
          TSGal

          Fred:

          Thank you for your post.

          With the "Allow deletion of portal rows" turned on, users can manually select a portal row and press the delete key.  With this turned off, the delete key has no effect and users will be unable to delete a portal row.

          The current design allows scripts to override the permissions in the Portal Setup dialog.  This allows developers to control how users delete a portal row, even with "Allow deletion of portal rows" unchecked.

          In your example, the Delete Record button will either delete the current record, or if a portal row is selected, delete the related record.  If you want to only delete the current record, then in the script, place a Commit Records/Requests step immediately prior to the Delete Record step.

          I have contacted the Documentation manager to make sure this gets better explained in future documentation.

          TSGal
          FileMaker, Inc.

          • 3. Re: Disabling Allow deletion of portal record IGNORED
            Fred(CH)
            Olà TSGal,

            OK, well… as you can imagine, i disagree devil… Here are my points :
             

            The current design allows scripts to override the permissions in the Portal Setup dialog. This allows developers to control how users delete a portal row, even with "Allow deletion of portal rows" unchecked.


            But if the developer wanted to script a deletion of a portal row, he would have chosen the appropriate step : Delete Portal Row. This kind of difference between script steps and menu Command are really confusing and maybe, very dangerous. One more time (excuse me), this design is not ideal, a poor choice, since a minimal effort from the developer can produce a reliable and secure result :

             

             

            If [Get( ActivePortalRowNumber )]

                Delete Portal Row[]

            Else

                Delete Record/Request[]

            End If

             

            Or i am missing something ???
             

             

              If you want to only delete the current record, then in the script, place a Commit Records/Requests step immediately prior to the Delete Record step.

             

            Absolutely, as i wrote in my original report on workaround sectionwink. But sometimes is it undesired. Imagine if the user is firing Delete Record for one that uncommitted ( YES, here, it is possible : DELETE an unexisting record laugh). Commit the new record first can trip a script trigger, generate validation error message etc... and generally i try to avoid do it before the Delete record step.

             

            Have a nice week-end, Fred

             

            PS for all: Sorry for the laugh allusion that only TSGal can understand...

            • 4. Re: Disabling Allow deletion of portal record IGNORED
              FileKraft

              TSGal - as you suggest to commit before deletion is contradicting the transactional model of commit . revert logic - in other words:

               

              in a transactional context you cannot commit before delete otherwise you cannot revert deletion and modification as the transactional nature implies .. 

              • 5. Re: Disabling Allow deletion of portal record IGNORED
                TSGal

                Filekraft:

                True.  If you need to revert, then instead of using Commit Records/Requests, select an object in the current record so the focus is not on the related record.

                TSGal
                FileMaker, Inc.

                • 6. Re: Disabling Allow deletion of portal record IGNORED
                  Fred(CH)

                  Summary :

                  The "allow row deletion" portal's option was created to facilitate the deletion of a portal, using the Delete Record command (since a Delete Portal Row menu command doesn't exist within FileMaker user interface) or by pressing the Backspace key (if not any field have the focus).

                  When this option is not checked, the according menu command is greyed out, and obviously, the Backspace key does not delete any portal row.

                  In this case, the developer is supposed to add a button, which perform a Delete Portal Row, if he wants to allow user the portal row deletion.

                  Nevertheless, because FileMaker design try generally to match the menu command behavior with the according script action, by extension, and notwithstanding a dedicated step exists, if a Delete Record step is invoked on a script where allow portal deletion is checked, the active portal row (if any) is the target of the command, instead of the current record. All is all right !

                  However, in a very same scenario, but where the option allow deletion is unchecked, the active portal row is still targeted by Delete Record script step instead of the current record, to let a "choice" to the developer, but only if not any field have the focus.

                  But why in the world the latter condition ? Elementary my Dear Watson, because in this case, Backspace key could only be used to delete value on a field and not an entire row, even Backspace key have nothing to do with any delete script step, and even in this case, the allow row deletion is unchecked.

                  I say GOOD LUCK yes To the Documentation Team to make it as clear as possible wink.

                  Bye, bye, Fred

                  PS:  i stronlgy recommand to read this comment at least two times.

                  • 7. Re: Disabling Allow deletion of portal record IGNORED
                    Fred(CH)

                    Well, you change it in some ways, did you ?

                    This post alerted me : Changed Behavior: Deleting Portal Record Changed

                    Strange, i am experiencing the exact contrary behavior change that stated on this post.

                    For me, it now always ask to deleting the related record and i cannot choose to delete entire record anymore. But we agree, there was a change : no choice anymore with v14.

                    On my file, it only depends on the focus : if the focus is on the portal, a field or the entire row or an inner button, means the row will be deleted; if the focus is out of portal, it will be the entire record, obviously.

                    I am wondering if this post here was heard and inspired this change. Now, when a field is active on the portal, that doesn't prevent delete record step to delete the related record, as it did before v14.

                    This change is a little bad news to me, since it mean that FMI confirmed that a scripted Delete record, even without dialog, may not delete the active record as you will generally expect, but will maybe delete a related record, and the easy workaround to systematically use a Go To Field [next] is not working anymore.

                    Next step would be the removal of the Delete Portal Row script step...

                    Thanks to clarify.