cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GarryPope
Impactful Individual
Impactful Individual

Handling null values in conditional trigger

Hello Power Automate Community,

I hope you can help please.

 

I'm using the "Common Data Service (Current Environment)" connector. I want the Flow to run when:

An "Opportunity" is marked as "Close Won"

And

The "Opportunity" field "Originating Lead" is populated.

 

I'm doing this using  a"Conditional Trigger" and it's working great, so long as a value is populated in the "Opportunity" field "Originating Lead". See below:

Trigger condition.png

 

 

But if that's not populated I get a failed message.

 

The next step in the Flow after the trigger is to get the Originating Lead GUID. So I used the "Get Record" action. But I receive the below error because the Opportunity didn't have a value in it's Originating Lead field.

 

Error on Lead action.png

I read somewhere that I should use the "coalesce", and I read information about that at this URL https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-isblank-isempty but I just can't write the expression needed to substitute the below expression using coalesce. 

@not(equals(triggerBody()?['originatingleadid_value'],'null'))

 

Any ideas on how to do that please? I believe the problem is the 'null' value, as that's a string and it's looking for an integer.

 

Thanks in advance to anyone that can help, I've wasted many hours trying to solve this. 

 

Garry

1 ACCEPTED SOLUTION

Accepted Solutions
burgett94
Resolver II
Resolver II

Hello @GarryPope 

 

You could do it as a filter array then use the below within advanced:

 

@or(equals(triggerBody()?['statecode'],1),not(empty(triggerBody()?['originateleadid_value']))

 

Hope this helps.

 

Thanks


Bradley

Best regards,

Bradley
If this post helps, then please consider Accept it as the solution to help the other members find it more

View solution in original post

4 REPLIES 4
burgett94
Resolver II
Resolver II

Hello @GarryPope 

 

You could do it as a filter array then use the below within advanced:

 

@or(equals(triggerBody()?['statecode'],1),not(empty(triggerBody()?['originateleadid_value']))

 

Hope this helps.

 

Thanks


Bradley

Best regards,

Bradley
If this post helps, then please consider Accept it as the solution to help the other members find it more

View solution in original post

GarryPope
Impactful Individual
Impactful Individual

Hello @burgett94,

Thanks so much for the feedback, I really appreciate it. 

Just so I'm clear, the expression you gave me is for the Trigger Condition right?

If so, I removed the two expressions I had in there and used your expression. Unfortunately I'm getting an error, sorry. See below:

Flow error.png

 

I actually think my original request is not possible. In Dynamics when I create an Opportunity and don't add a value in the Originating Lead field, when I look at the Trigger output that field is not in there, which, I believe, is to be expected. To solve this, after the trigger I'm just going to add a "Condition" to then check if a value is in the "Originating Lead" field or not.

 

I did this before, but was trying to be clever and reduce my flow from running when not needed.

 

Thanks anyway for your help,

 

Garry

Hello @GarryPope 

 

Apologies, I misread you initial issue - I was suggesting that you used a filter array with my expression.


This would have allowed you to narrow down the output to only the required values.

 

Thanks

 

Bradley

Best regards,

Bradley
If this post helps, then please consider Accept it as the solution to help the other members find it more
GarryPope
Impactful Individual
Impactful Individual

Hello @burgett94,

No problem at all. It was probably the way I wrote it! I appreciate your help. The Condition I added after the trigger is working a treat. 

Thanks very much,

Garry

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (92,876)