# Only add new entity when user triggered rule

**URL:** <https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467>\
**Category:** Get Help\
**Created:** [November 29, 2023, 9:39am UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467 "2023-11-29T09:39:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [November 29, 2023, 9:39am UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/1 "2023-11-29T09:39:38Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![antoniokov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/antoniokov/32/201_2.png) [@antoniokov](https://community.fibery.io/u/antoniokov)\
**Post date:** [November 29, 2023, 3:52pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/2 "2023-11-29T15:52:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [November 29, 2023, 6:35pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/3 "2023-11-29T18:35:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 30, 2023, 1:26pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/4 "2023-11-30T13:26:31Z")

</div>

Out of curiosity, you wrote…

> [@YvetteLans](#):
>
> When a system updates the leadstatus of a contact, then do nothing

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

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [November 30, 2023, 2:26pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/5 "2023-11-30T14:26:45Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/5/58fa3dc5729256e70fe321064276af4f6d4ca39e.png)

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 😂

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

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 30, 2023, 2:34pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/6 "2023-11-30T14:34:18Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [November 30, 2023, 2:57pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/7 "2023-11-30T14:57:28Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/e/eadee6a28199da6e5120d91c8c975faff7372c5a.png)

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’

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [November 30, 2023, 3:05pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/8 "2023-11-30T15:05:59Z")

</div>

> [@YvetteLans](#):
>
> But maybe you have a better solution?

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 🙂

---

<div class="post-metadata">

**Author:** ![YvetteLans](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yvettelans/32/6101_2.png) [@YvetteLans](https://community.fibery.io/u/YvetteLans)\
**Post date:** [November 30, 2023, 6:14pm UTC](https://community.fibery.io/t/only-add-new-entity-when-user-triggered-rule/5467/9 "2023-11-30T18:14:17Z")

</div>

Thanks for that 😄
