0

Trigger After Update does not get Triggered

,

Hi 

I am facing a very weird issue. I have some code written in the "Trigger After Update" event of a DCF (Dynamic Choice Field). When I physically choose "empty" from the list in DCF, the trigger gets triggered and the script gets executed, however when I programatically make the DCF as null, the "Trigger After Update" does not get triggered.

if text('Contact Person') = null then
    Phone := null;
    Mobile := null;
    'Email Address' := null
else
    if text('Contact Person') != null then
        let contactPersonRecord := record('Client Contacts',number('Contact Person'));
        Phone := contactPersonRecord.Phone;
        Mobile := contactPersonRecord.Mobile;
        'Email Address' := contactPersonRecord.Email
    end
end

8 replies

null
    • Fred
    • 3 mths ago
    • Reported - view

    Triggers after update are only activated by a manual selection. Scripts don’t trigger after update.

      • John_Halls
      • 3 mths ago
      • Reported - view

       Setting a DCF field to null, using a button, triggered OK for me.

      • Database App Developer
      • vermau81
      • 3 mths ago
      • Reported - view

       Thanks for the reply mate.

      So what is the solution in this case then? How do I:

      1. Make 'Contact Person' automatically go null as soon as the 'Business Name' is set to null

      2. Make other fields like Mobile, Phone and Email automatically go null as soon as the 'Contact Person' DCF is set to null

      • John_Halls
      • 3 mths ago
      • Reported - view

       You can include the trigger code within the code the sets ‘Contact Person’ to null. Pretty much just a copy & paste job.

      • Database App Developer
      • vermau81
      • 3 mths ago
      • Reported - view

       OH!!! I was sooo much distracted by the DCF that I did not think through clearly. Thank you John.

      However I learnt this today that the 'Trigger After Update' on DCF does not get executed based on script. I am not too sure about the RF (reference fields) though. Will check on them later when the situation demands.

      • John_Halls
      • 3 mths ago
      • Reported - view

       No, DCF fields do get executed, I tried it out. There may be something esle not quite right

      • Fred
      • 3 mths ago
      • Reported - view

      i stand corrected. I know there is a situation where they don't get triggered.

      • John_Halls
      • 3 mths ago
      • Reported - view

       They may not be triggered by a trigger as this may result in an infinite loop, with field a updating field b, which in turn updates field a, etc. I tested it with a button. 

Content aside

  • 3 mths agoLast active
  • 8Replies
  • 52Views
  • 3 Following