How to use a trigger to check field changes. Checking a field in a trigger is necessary if you need an event to be executed only if a certain condition is met. For example, the content of certain digits in a phone number. false W3sidGl0bGUiOiJBdXRvbWF0aW9uIiwidXJsIjoiL2RldmVsb3BlcnMvYXV0b21hdGlvbi8ifSx7InRpdGxlIjoiUGlwZUxhbmciLCJ1cmwiOiIvZGV2ZWxvcGVycy9hdXRvbWF0aW9uL3BpcGUtbGFuZy8ifSx7InRpdGxlIjoiUHJlcGFyYXRpb24gcnVsZXMiLCJ1cmwiOiIvZGV2ZWxvcGVycy9hdXRvbWF0aW9uL3BpcGUtbGFuZy9wcmVwYXJhdGlvbi1ydWxlcy8ifV0= Automation /developers/automation/ ["developers","Automation"] ["developers","Automation","PipeLang"] developers

How to use a trigger to check field changes.

Checking a field in a trigger is necessary if you need an event to be executed only if a certain condition is met. For example, the content of certain digits in a phone number.

If you want to exclude the execution of a trigger action for certain phone numbers by an exact match, you must add the code corresponding to the trigger event to the trigger condition\filter.

  • “Change of order” and “After trigger for order”
  • “Change of the customer information”, “The customer visited the site”, “The customer did not visit the site”, “The customer left the site” and “After trigger for customer”.
  • “New call” and “Missed call”.

Note

The “Customer visited the site”, “Customer did not visit the site” and “Customer left the site” events will become available for selection after connecting the Daemon Collector.

For the “Change of order” and “After trigger for order” events:

order.phone != '+74951111111'

The trigger will not be executed in case of the exact match of the phone number +74951111111 in the order.

order.phone not matches '7495'

The trigger will not be executed if the phone number contains 7495

For the “Change of the custimer information”, “Customer visited the site”, “Customer did not visit the site”, “Customer left the site” and “After trigger for customer” events:

customer.phones | every(phone =>phone != '+74951111111')

The trigger will not be executed if there is no phone number in the customer’s phone number list +74951111111

customer.phones | every(phone =>phone not matches '7495')

The trigger will not be executed if there is no phone number in the customer’s phone number list that contains 7495

For the “New call” and “Missed call” events:

call.phone != '+74951111111'

The trigger will not be executed if the customer’s phone number is +74951111111

call.phone not matches '7495'

The trigger will not be executed if the customer’s phone number does not contain 7495

Thank you for your feedback.
Was this article helpful?
No
  • The recommendations did not help
  • There is no answer to my question
  • The text is difficult to understand
  • I do not like the described functionality
Yes
Next article
Actions that can be performed in triggers with fields
When certain conditions are met, a trigger can perform mathematical and logical actions using operators, as well as being able to work with PipeLanguage functions and filters.