# Workflow to send email after an account Creation

**URL:** <https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120>\
**Category:** SHF Discussion and Questions\
**Tags:** workflows, identity-security-cloud\
**Created:** [September 6, 2023, 11:58am UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120 "2023-09-06T11:58:57Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandre\_mazars](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/alexandre_mazars/32/2860_2.png) [@alexandre\_mazars](https://developer.sailpoint.com/discuss/u/alexandre_mazars)\
**Post date:** [September 6, 2023, 11:58am UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/1 "2023-09-06T11:58:57Z")

</div>

Hello,

We are trying to create Workflows to send an email to the user when a new account is created by IdentityNow for him in a source, so that we can send him the details to access the system.

I have created for this a workflow with Provisioning Completed trigger and the following filter :  
‘$[?($.accountRequests[0].source.name == “Source Name” && $.accountRequests[0].accountOperation == “Create” && $.accountRequests[0].provisioningResult == “SUCCESS” )]’

But we are never entering the workflow, I cannot understand why.  
Any idea ?

Regards

---

<div class="post-metadata">

**Author:** ![sharvari](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@sharvari](https://developer.sailpoint.com/discuss/u/sharvari)\
**Post date:** [September 6, 2023, 12:42pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/2 "2023-09-06T12:42:00Z")

</div>

Have you checked your JSON input from the Workflow? It’s possible that the trigger returns more than one account requests and maybe the [0]th one isn’t the Create operation on the source that you are comparing to.

If you remove this filter, are you able to execute the workflow?

---

<div class="post-metadata">

**Author:** ![sharvari](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@sharvari](https://developer.sailpoint.com/discuss/u/sharvari)\
**Post date:** [September 6, 2023, 12:51pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/3 "2023-09-06T12:51:58Z")

</div>

Try this filter:

$.accountRequests[?(@.source.name == “Source Name” && @.accountOperation == “Create” && @.provisioningResult == “SUCCESS”)]

---

<div class="post-metadata">

**Author:** ![alexandre\_mazars](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/alexandre_mazars/32/2860_2.png) [@alexandre\_mazars](https://developer.sailpoint.com/discuss/u/alexandre_mazars)\
**Post date:** [September 6, 2023, 1:12pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/4 "2023-09-06T13:12:06Z")

</div>

> [@sharvari](#):
>
> $.accountRequests[?(@.source.name == “Source Name” && @.accountOperation == “Create” && @.provisioningResult == “SUCCESS”)]

Yes i’ve check using documentation and also tried to run the workflow without filter. You were right there is multiple element in accountRequest.

> $.accountRequests[?(@.source.name == “Source Name” && @.accountOperation == “Create” && @.provisioningResult == “SUCCESS”)]

This filter is not accepted in the trigger block.Maybe i should use the loop block to go through the accountRequests attribute ?

Regards

---

<div class="post-metadata">

**Author:** ![iamnithesh](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/iamnithesh/32/42445_2.png) [@iamnithesh](https://developer.sailpoint.com/discuss/u/iamnithesh)\
**Post date:** [September 6, 2023, 1:22pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/5 "2023-09-06T13:22:01Z")

</div>

> [@alexandre\_mazars](#):
>
> This filter is not accepted in the trigger block

What is the error you are getting?

---

<div class="post-metadata">

**Author:** ![sharvari](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@sharvari](https://developer.sailpoint.com/discuss/u/sharvari)\
**Post date:** [September 6, 2023, 1:29pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/6 "2023-09-06T13:29:31Z")

</div>

> [@alexandre\_mazars](#):
>
> $.accountRequests[?(@.source.name == “Source Name” && @.accountOperation == “Create” && @.provisioningResult == “SUCCESS”)]

This filter works for me.

Make sure when you copy paste it, replace the quotes/white spaces.

---

<div class="post-metadata">

**Author:** ![alexandre\_mazars](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/alexandre_mazars/32/2860_2.png) [@alexandre\_mazars](https://developer.sailpoint.com/discuss/u/alexandre_mazars)\
**Post date:** [September 6, 2023, 1:53pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/7 "2023-09-06T13:53:04Z")

</div>

> [@sharvari](#):
>
> $.accountRequests[?(@.source.name == “Source Name” && @.accountOperation == “Create” && @.provisioningResult == “SUCCESS”)]

Wow, it was tricky to view that the quotes were not the same.  
But as of now, the workflow is not started when doing a create account.

---

<div class="post-metadata">

**Author:** ![Dw2456](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@Dw2456](https://developer.sailpoint.com/discuss/u/Dw2456)\
**Post date:** [September 6, 2023, 2:31pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/8 "2023-09-06T14:31:55Z")

</div>

I am creating a similar workflow, and it is not trigger for me either when the account is being created. I also changed fixed the formatting it still isn’t working.

Do you have a JSON file that we can use?

---

<div class="post-metadata">

**Author:** ![sharvari](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@sharvari](https://developer.sailpoint.com/discuss/u/sharvari)\
**Post date:** [September 7, 2023, 10:03am UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/9 "2023-09-07T10:03:57Z")

</div>

> [@Dw2456](#):
>
> Do you have a JSON file that we can use?

No, I don’t have one for this trigger.

Try using the [documentation](https://developer.sailpoint.com/idn/docs/event-triggers/filtering-events/#constructing-a-filter) here to test your filter.

---

<div class="post-metadata">

**Author:** ![Dw2456](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@Dw2456](https://developer.sailpoint.com/discuss/u/Dw2456)\
**Post date:** [September 7, 2023, 12:01pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/10 "2023-09-07T12:01:56Z")

</div>

Is there a reason the filter wouldn’t work for us, but only for you?

---

<div class="post-metadata">

**Author:** ![sharvari](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@sharvari](https://developer.sailpoint.com/discuss/u/sharvari)\
**Post date:** [September 7, 2023, 12:03pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/11 "2023-09-07T12:03:10Z")

</div>

I didn’t execute it, i just verified the JSON expression didn’t have any error.

---

<div class="post-metadata">

**Author:** ![Dw2456](https://avatars.discourse-cdn.com/v4/letter/d/b487fb/32.png) [@Dw2456](https://developer.sailpoint.com/discuss/u/Dw2456)\
**Post date:** [September 7, 2023, 12:11pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/12 "2023-09-07T12:11:27Z")

</div>

Oh I see so you recommend finding one that works!

---

<div class="post-metadata">

**Author:** ![tdlm](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@tdlm](https://developer.sailpoint.com/discuss/u/tdlm)\
**Post date:** [September 7, 2023, 1:14pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/13 "2023-09-07T13:14:53Z")

</div>

Hi Alexandre,

We did a similar workflow using the following trigger (code comes from the JSON directly) :

```auto
"trigger": {
		"type": "EVENT",
		"attributes": {
			"filter.$": "$.accountRequests[?(@.accountOperation == \"Create\" && @.provisioningResult ==\"committed\" && (@.provisioningTarget ==\"NAME OF YOUR SOURCE A\" || @.provisioningTarget ==\"NAME OF YOUR SOURCE B\" ))]",
			"id": "idn:post-provisioning"
		}
	}

```

---

<div class="post-metadata">

**Author:** ![alexandre\_mazars](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/alexandre_mazars/32/2860_2.png) [@alexandre\_mazars](https://developer.sailpoint.com/discuss/u/alexandre_mazars)\
**Post date:** [September 7, 2023, 2:28pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/14 "2023-09-07T14:28:10Z")

</div>

Hello Thibault,

Thanks for your answer ! I have done a test and it works !  
Huge thanks to all of you for your help.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [November 6, 2023, 2:28pm UTC](https://developer.sailpoint.com/discuss/t/workflow-to-send-email-after-an-account-creation/17120/15 "2023-11-06T14:28:58Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
