Jump to content
  • 0

Triggered action for updating the status based on the status change in another table


Aleksandra

Question

Hello,

I am using 2 tables for this trigger: Users and Registrants. I want to create a trigger action which will change a user's status from active to inactive when a registrant's status changes to canceled.  This is the trigger I've already created, but it is not working. Can anyone tell me where I made a mistake?

Thank you all in advance.

Trigger 1.png

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Hello @Aleksandra,

If I understand correctly, the Trigger on your screenshot is built on the Users table. However, the update occurs in the Registrant table. 

If this is correct, the Trigger should be built on the Registrant table. Please note, that when you use an inner join, you may skip comparison of the same fields in the WHERE clause (the Email file in your example).

otk0lkB.png

Link to comment
Share on other sites

  • 0

Thank you @CoopperBackpack, it works now. I just started creating the trigger in the wrong table. By the way, this is not related to this request, but do you know how to prevent email triggers to send email to user once it is already sent? I want to be able to automatically send email to user when they purchase something. To prevent sending email multiple times, I've created a checkbox field Email sent which should automatically be checked once the email is being sent. The issue with this approach is that I see field Email sent checked when I update the status to purchased, but the email is not actually sent. Is there any "trick" that would make the Caspio system to send email first and to change Email sent field after the email is actually sent?

Below is the screenshot of the trigger I've created. Thank you in advance.

 

Email Trigger.png

Link to comment
Share on other sites

  • 0

Hi @Aleksandra how were you able to verify that the email was in fact not sent? I also have a similar workflow but it works as intended.. Some of the things you can consider are:

- did the record meet the criteria after you updated it?

- did you check the spam/junk folder?

- have you checked in email logs (if available to your plan) if it was sent?

Additionally, you can add more conditions to the update block with the same condition you have on your email block to make sure it only updates the checkbox if all conditions are met.

 

I hope this helps! :wub:

Link to comment
Share on other sites

  • 0



That setup seems correct.  The trigger blocks run on rockfall pattern thus those that placed at the top will be ran first.  I notice that you have multiple conditions for your Select block for the email block. Make sure that your #inserted fits to all of that criteria. If one of those other criteria's failed, the email will not be sent but the checkbox will still be marked as check.

I would also advise that you put the same criteria's you have on the email block on the update block so the checkbox will only be marked as check on the very same condition as the email will be sent.

Link to comment
Share on other sites

  • 0

Thank you both for your help @NiceDuckand @ParkLoey. I checked email logs and email seems to be sent. I tested the feature one more time with my email and it seems to be working now. The issue with previous testing was that the field Email sent was checked, so that's the reason why it didn't work. I have more question about Triggered actions. In the same table, Transactions, I've created another triggered action. It should update the lender's name, email address, etc. in another table I have (Assigned Lenders) each time I update the lender in Transactions table. This trigger works fine, but I cannot enable it and trigger I've created above (this email trigger) at the same time. Any idea why it is happening? 

Link to comment
Share on other sites

  • 0

Hi @Aleksandra I think there's a limitation of one trigger action per event (runs on update, insert, or delete) can be active at a time. In this case, you can add the update block on your current trigger, specifically under the block that's updating the email_sent checkbox :) 

image.thumb.png.487e0fe5f36347c9901c813add44c0cf.png

https://howto.caspio.com/tables-and-views/triggered-actions/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...