0

Trigger after change

I have a Products table.
I would like to add a trigger after the change that:
if TOTAL = 0 then AVAIBILTY: = "NO"
But this code doesn't work!
The AVAIBILITY field becomes NO only if I, after the TOTAL field has passed from 1 to 0, also change another field.

It is as if the system does not perceive the change after the TOTAL field has changed from 1 to 0!

Can anyone help me?

18 replies

null
    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Bobo

    It works if you put it in the trigger after update on the form

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    Hi Mel ...thanks for your reply.

    I have already putted it into "Trigger after update"...but doesn't work!
    Only if I change again another field of record the trigger start!

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    The solution could be the use of a formula field as no triggers after updated are needed:

    if TOTAL > 0 then
    styled(text(TOTAL) + " Items on hand", "green")
    else
    styled("No items on hand", "red")
    end

    Steven

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    You are right ... but I had simplified the code required to make the problem understood ... but in reality I need that after the update of a record if the total = 0 I have to start an Integromat scenario and therefore I need to have active this code in the "trigger after update" section.
    Do you have any other ideas?

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Bobo what are you on cloud or mac etc?

    I'm on cloud and I recreated what you have and it works no problem for me?

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Maybe if you close the record and then open it again? (I'm just helping to think. If it works, you can fire your integromat scenario) like:

    let me := this;
    closeRecord();
    openRecord(me);
    if TOTAL = 0 then AVAILBILTY := "NO" else AVAILBILTY := "YES" end

    If I recreate this, I have no time lag and it works like intended. I'm using Cloud version on Google chrome windows 10.(In my experience, Actualy Chrome is the best option to use the cloud)
    It also works on the native app om the Macbook in that team.
    Just tested it and it also works without the close-open Record on both versions. Not sure where the problem could be on your side...???

    Steven

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    @Mel
    I don't have cloud
    No Mac...classic Win 10

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    @Mel
    I don't have cloud
    No Mac...classic Win 10

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    @Rosoft
    No ... nothing ... it doesn't work even if I close the record.
    Instead, as soon as I sample any other field, the triggers start!
    He's making me crazy.
    I don't have the cloud, I use win10 and Chrome

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Bobo,

    Maybe it's somewhere in your code (just trying to help here), can you post the complete code? Just mask your API keys if there are.
    If you're running On Chrome on Windows, you do have a cloud subscription I'm guessing...

    Steven

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi Bobo

     

    If the total is a formula field calculated from the sum of child records then it won't trigger if your Trigger after update: is on the parent. It has to be on the child, referencing the parent, such as

    if parent.TOTAL = 0 then parent.AVAIBILTY: = "NO" end

     

    Regards John

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    This is my real code in the Trigger after update ...but it doesn't work :-(

    if 'Orders available today' = 0 and 'AmazStars Main' = true then
    let response := http("POST", "https://hook.integromat.com/ykxtoywfuufqtfdnog0r6ti*******", {
    'Content-Type': "application/json"
    }, {
    RecordId: number(ID)
    });
    'AmazStars Main' := false
    end;
    if 'Orders available today' = 0 and AmazStars = true then
    let response := http("POST", "https://hook.integromat.com/hq21vvrlvflh5vjhfcxi81v*******", {
    'Content-Type': "application/json"
    }, {
    RecordId: number(ID)
    });
    AmazStars := false
    end

    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi Bobo

     

    Are either of 'Orders available today'  or AmazStars formula fields, calculated from fields in another table?

     

    Thanks John

    • TESTXFREE
    • Bobo
    • 2 yrs ago
    • Reported - view

    'AmazStars' is a field of the PRODUCTS table
    'Orders available today' is a fiel of the PRODUCTS table but is a formula field wit a sum of ORDERS table

    • John_Halls
    • 2 yrs ago
    • Reported - view

    As I thought Bobo, a change in the valuse of a formula field will not, on its own, act as a trigger. See my first reply. 

     

    You will probably need a Trigger after update: in both the PRODUCTS table and the ORDERS table.. It will be exactly the same but the one in the ORDERS table will have to reference and update its parent, ie the PRODUCTS table such as

     

    if PRODUCTS.'Orders available today' = 0 and PRODUCTS.'AmazStars Main' = true then

     

    Regards John

    • David_Yax
    • 2 yrs ago
    • Reported - view

    i won the lottery and then people kept on asking me how did i do it, well yea there is a little secrete you all never knew about, i was able to win the 80.000.000 lottery with the help of Dr Dominion lottery winning spell, he gave me number to play and instructed me when to play the lottery and i did as he instructed, my dear friends getting rich is never by luck it's something we all have to work for, people have been playing same lottery for years now and have never won, we need to be on the right track to get what we want i am saying this here because i want the best for everyone, you can't win the lottery just like that you need to know exactly what to do, what to play and when to play this is a truth that no one will never tell you, if you want to win big my dear i advice you to talk to Dr Dominion let him guide you on what to do and how to do it with his lottery spell. you can try him

    Email: dominionlottospelltemple@gmail.com
    website: https://drdominiontemple.com
    WhatsApp: +16574277820

    • Ruth_Breen
    • 2 yrs ago
    • Reported - view

    It still feels incredible that my life has changed and I thank Lord Zakuza everyday for his help. It is the best feeling in the world knowing that I am financially secure. Lord Zakuza prayed and prepared a lottery spell for me and he gave me some numbers to play on the Euromillions game. I played the game and I was sent an email after 3 days regarding that I was the winner of ONE MILLION POUNDS. So I rang them up and they confirmed that I was the very lucky one to have won on the EuroMillions Raffle draw. I was shocked, surprised and couldn't believe what my eyes saw and what my ears were earing for I was for happy. I stopped working as a midwife and ever since then, I have been winning in every game I played whenever I decide to. My life and that of my family has changed ever since that day and I want to say a very big thank you to Lord Zakuza. WhatsApp him for help via +1 (740) 573-9483 or email: ( lordzakuza7@gmail.com ) or go to his website on: lordzakuzaspells.com

    • Lottery
    • Larry_Baier
    • 2 yrs ago
    • Reported - view

    Hello viewers I am Larry Baier, i can never stop thanking Dr Graceondu for transforming my life, i have been playing lottery games for a very long time and i have never one day win any game, i met a friend whom i complained to about my inability to win and he introduced me to Dr Graceondu whom helped him by praying for him and giving him a game that he played and he won $150,000
    so i contacted him through his email and he assured me that i will win big. he asked me to give him two day so he can make some prayers on my behalf so that the winning numbers will be revealed to him, so i waited for two days the second day he sent me the number to play, so i play the game i never had it in my mind that i was going to win such amount of money, so on that faithful day i went to check the game on April 16, 2021 and behold i got the biggest shock of my life i won $2,000,000 and from that moment my life changed.
    all thanks to Dr Graceondu, i want to also advice everyone out there to also contact him if you have been playing lottery and you have never won.
    You can reach him via his email, drgraceondu12@gmail.com or WhatsApp him +15204677763, you can also visit his Website. https://drgraceonduadodo.com

Content aside

  • 1 yr agoLast active
  • 18Replies
  • 1069Views
  • 3 Following