Only add new entity when user triggered rule

Hi guys,

I have the following use case:

  • When a system updates the leadstatus of a contact, then do nothing
  • If a user updates the leadstatus of a contact, then create an entity

There is currently no possibility to use the ‘user who triggered rule’ as trigger. So I’ve created a ‘worker database’ that decides if it was a user yes/no and then create the entity or ignore the request.

It’s a bit ugly. So I was wondering: is there a possibility to do this via script instead?

Thanks!

Yep, you can use args.currentUser to check who has triggered the Rule in a script.
Meanwhile, noted your +1 to filtering a trigger by the user who triggered the Rule.

2 Likes

Thanks! Not (yet) a script queen but will try :grin:

Out of curiosity, you wrote…

What is the root cause of the system updating the leadstatus? Is it ultimately caused by an action a user took?

Hi Chris,

We have several automations/integrations in the CRM module.

For each integration user can fill in if they want to auto update the leadstatus based on a system action yes or no.

Examples:

  • If a salescall is booked via Calendly, then update the leadstatus to ‘call booked’ (when event type = sales call)
  • If a new order is placed, then update the leadstatus to ‘new order’
  • If a user clicks on a URL in an emailmarketing campaign and that URL is marked as ‘probably interested’, then update the leadstatus accordingly

But we also have manual ‘customer journey activities’, triggered by a user. Examples:

  • DM contact via LinkedIn
  • Send proposal
  • Wait for approval of proposal

etc.

Each contact has a ‘customer journey’ overview where everything comes together.

When a system updates the leadstatus, it’s not needed to create a ‘customer journey entity’ since the order or call itself is already an entity in that overview.

For actions that a user triggered (by changing the leadstatus manually) we do want to keep track of all leadstatus changes. Those are the last 4 orange entities in this screenshot.

Yesterday I found out that by trying to do this via script instead of worker database, the risk of throwing my laptop outside the windows is actually higher then an actual working script that’s doing what I want :joy:

So I’ll keep the worker database. It has an auto cleanup function so it can’t do much harm.

Are you aware of the ‘User who triggered Rule’ capability in automation formulas?
It might be worth checking if that is useful for you. It sounds like it might be.

(it will be empty if a user is not directly responsible for triggering the rule)

Yes, I’m aware of that. Via that rule I’ve set a checkbox ‘system action’ (if user who triggered rule was empty) in the worker database.

So in that worker database

  • If user action = checked, then create ‘customer journey activity’ with the applicable ‘leadstatus’
  • Else, delete the worker item and do nothing

But maybe you have a better solution? The end goal is ‘only add a customer journey item with the correct leadstatus if it was a user that changed the leadstatus in the contact’

Well, I wasn’t sure of all the details, so you’ve probably done the best possible.
Just wanted to be sure you knew of the options :slight_smile:

1 Like

Thanks for that :smile: