1 2 Previous Next 20 Replies Latest reply on May 9, 2017 6:55 AM by TSGal

    FileMaker delete acts in the wrong context

    ric_cosa

      I found a destructive bug related to DELETE RECORD script step.

      If you have a portal row selected when calling this step (directly or inside a script doesn't matter) FileMaker won't delete the record you're on, as expected, but it will delete the portal row you're on.

      Even if you have no cascading delete active and the portal has no deletion option active.

      I hope this will be fixed very quickly because the risk of losing data is very high.

       

      Temporary fix: add a Save record in the script before calling Delete record.

       

      To reproduce it, open the attach, go to record "Master 1", select a portal row and click the DELETE button.

        • 1. Re: FileMaker delete acts in the wrong context
          Fred(CH)

          Of course I cannot talk in name of FMI, but they probably think actual behavior is correct for some reasons.

           

          You will get a lot of details on the following thread i initiated months ago :

          Disabling Allow deletion of portal record IGNORED

           

          But i am with you .

          • 2. Re: FileMaker delete acts in the wrong context
            ric_cosa

            I cannot imagine how can be acceptable to make the deletion of a record in a related context being fired by a button acting on the main record.

            In this case, why having a DELETE RELATED RECORD step?

             

            Not to mention all the other side effects, since it looks like something breaking existing solutions.

            • 3. Re: FileMaker delete acts in the wrong context
              Fred(CH)

              In this case, why having a DELETE RELATED RECORD step?

              Just to clarify, we have a such step and it is called Delete Portal Row

              • 4. Re: FileMaker delete acts in the wrong context
                Fred(CH)

                Ah sorry : i realize you know it and it is a translation problem (i am not english native too)...

                 

                Hum... sounds like the reason is because, even if the step exist, it never had any associated menu command.

                 

                This was probably why was created this behavior with the "duality" of Delete Record menu command.

                 

                And because scripts step have to behave like the corresponding menu commands... you get the same duality in a script.

                 

                And finally because many script steps have less restriction than users command, they decided to ignore the "allow portal deletion" unchecked when this step was executed by a script and only in this case.

                 

                So… a long and strange path to come here...

                • 5. Re: FileMaker delete acts in the wrong context
                  TSGal

                  ric_cosa:

                   

                  Thank you for your post.

                   

                  This is the intended behavior, and it is documented in the help under "Delete Record/Request":

                  Delete Record/Request

                   

                  See the "Description" section how to delete a master record and a related record.

                   

                  TSGal

                  FileMaker, Inc.

                  • 6. Re: FileMaker delete acts in the wrong context
                    hschlossberg

                    TSGal: I haven't tested this, but if what the original poster is saying is true, then this is a bug.  The help article you refer to is in regard to regular deletions, and only when the portal has been set up to allow deletions.  If a portal does NOT allow deletions, then a script should not allow those deletions either, as deletions cannot happen through a relationship without the "unlocked" portal or through the parent record being deleted (i.e. cascading).

                     

                    Howard

                    • 7. Re: FileMaker delete acts in the wrong context
                      TSGal

                      hschlossberg:

                       

                      Thank you for your post.

                       

                      This issue has been discussed many times over several versions.  If the option "Allow deletion of portal records" is unchecked, it will not allow users to manually delete records in the portal (delete key).  However, for more control, using Delete Record or Delete Portal Row gives a developer the ability to override that setting.  For a simple test, create a portal that does not allow deletion of portal records.  Then, create a button in the portal that executes "Delete Record" and be sure to not enter a checkmark next to Perform without dialog.  Manually make a portal row active and try to manually delete the portal.  As expected, this will not work.  However, when you click the button in the portal row, you will get a dialog "Permanently delete this one related record?"  Therefore, if you don't want to delete a related record, make sure a portal row is not active when you issue "Delete Record".

                       

                      TSGal

                      FileMaker, Inc.

                      • 8. Re: FileMaker delete acts in the wrong context
                        Fred(CH)

                        TSGal a écrit:

                        […]However, for more control, using Delete Record or Delete Portal Row gives a developer the ability to override that setting.  […]

                        This historic argument is just wrong.

                         

                        Because the developer have no control nor any ability on this unexpected behavior; it is a fact. If the enduser have activated a portal row : kaboom.

                         

                        The only ability of the developer is to build strange workarounds, as demonstrated many times on the thread i referred earlier.

                        • 9. Re: FileMaker delete acts in the wrong context
                          ric_cosa

                          I'm not sure I get it.

                          Which kind of "more control" is given to the developer if the Delete record step acts differently if, e.g, I commit the current record or not.

                          I'm in master record, no portal row selected, I choose a Delete record button and the master record is deleted.

                          Same situation, portal row selected, the related record is deleted.

                           

                          Still in master record, no portal row selected, I choose New record button and a new master record is created.

                          Same situation, portal row selected, no related record is created, but a new master.

                           

                          Two CRUD operations, two different behaviours.

                          The concept of "current record" or "active context" seems to change depending on the action performed. I cannot see any advantage in that, but maybe I'm missing something. Can you explain me where such a behaviour can be useful compared to a more consistent one?

                          • 10. Re: FileMaker delete acts in the wrong context
                            TorstenBernhard

                            The actual behaviour of "Delete Record" is that: The active record is going to be deleted. If it happens to be a portal record, this one is deleted.

                            This overrides any other settings made. As TSGal noted, this gives scripts the necessary flexibility but it is a mixed blessing:

                            If the user selects a portal record and then activates a script with a Delete Record step (even when the button is placed with the main record), it acts on the ACTIVE record, which is a portal record in this case.

                            If you want to make sure  that only the main record is deleted, add a Go to Field step just before the Delete Record step. This enables programmatically control over the record to be deleted, regardless of what the user may have selected.

                             

                            I would not consider this as a bug, its rather a convention you need to be aware of.

                            • 11. Re: FileMaker delete acts in the wrong context
                              Fred(CH)

                              I would not consider this as a bug, its rather a convention you need to be aware of.

                               

                              …or a bad design which you need to be aware of.

                              • 12. Re: FileMaker delete acts in the wrong context
                                TorstenBernhard

                                Symmetrical behaviour of New Record and Delete Record would be preferable and avoid confusion from a developer's point of view.

                                There may be a technical reason for keeping them asymmetrical. The introduction of Delete Portal Row hints at that.

                                 

                                TSGal, what's the reason for keeping New Record and Delete Record asymmetrical?

                                • 13. Re: FileMaker delete acts in the wrong context
                                  TSGal

                                  TorstenBernhard:

                                   

                                  I do not know the reasoning for New Record and Delete Record inconsistency when a portal is involved.  I have asked Development and Testing for an explanation.  When I receive a reply, I will let you know.

                                   

                                  TSGal

                                  FileMaker, Inc.

                                  • 14. Re: FileMaker delete acts in the wrong context
                                    TSGal

                                    TorstenBernhard:

                                     

                                    I received two replies from Development.  To paraphrase, if users want to create new rows in a portal, then that functionality should be turned on and then use the empty template row to create new records.  Changing New Record could possibly upset as many users as we would make happy if we suddenly started creating related records just because a portal row happened to be active when New Record was issued.

                                     

                                    TSGal

                                    FileMaker, Inc.

                                    1 2 Previous Next