Power Automate Opportunity Flows failing because Value is NULL
I've had 3 flows that bring in Opportunities that have failed in the last few weeks. It's pulling in the Expected Amount and Expected Date which are Null or not filled in.
Unable to process template language expressions in action 'Append_to_array_variable' inputs at line '0' and column '0': 'The template language function 'formatNumber' expects its first parameter to be an integer or a decimal number. The provided value is of type 'Null'.
Annoying when you have to put in a “if not empty then format”… for an expression.
Also it's disappointing when you have to switch back to Classic Mode designer when you click Edit now in Power Automate. It automatically loads the Co-Pilot, forcing the AI.
Happy coding!
Carol
Comments
-
@Carol Grant
yea.. the copilot is getting annoying…….as for expression and null, well, you already got answer, you just have to condition. it would be nice if the expression handles “null” more gracefully.
@{if(empty(dynamic_content), ‘’, formatNumber(xxxx, ‘xxx’))}
Worst is the “box” to type expression is so short.. so i always have to do it in notepad
2 -
@Alex Wong
Thanks Alex, I always have to do the expressions in notepad also. Thanks for posting what you use, there are many different ways to say if not equal to null or empty.0 -
@Carol Grant
yup, there's a few ways to do it, and since power automate treats null string and empty string the same, that's why I use empty(), as I only need to pass in 1 parameter. Generally I try to be lazy as long as doesn't affect the logic =D2 -
@Alex Wong
I think the copilot doesn't work on “switch” action in a flow, a few of my flow that uses “switch” is not loading in copliot mode. @Heather McLean @Erik Leaver Maybe a comment you can provide back to MS.I think I will give copliot a chance and use it, at least if this is the direction that MS is going, I want to get ahead and provide feedback that tailor to user needs.
I will say.. ONE thing I like so far is the dynamic content box and expression box is better, have more room to type
1 -
@Alex Wong - Yes, I’ve been wrestling with the new edit mode myself. Let us start a new post to gather feedback that we can take into the next Power Platform Community Call with Microsoft. CC: @Erik Leaver
Sounds like a good topic for user group.
1 -
@Carol Grant
I‘ve been creating some new flows not for Opportunities but for Fundraisers using the null() expression and they have so far been working. May want to try going into the new editor and seeing if saving from there fixes things? That would be very telling!0 -
@Carol Grant
My personal favorite way to handle situations like these is the coalesce() function. As parameters, it takes any number of variables, outputs or values, and it basically just returns the first one that isn't null.So if you have a situation where you need to check if your MyNumber variable is null and you want to return a 0 if it is, all you have to do is:
coalesce(variables('MyNumber'),0)
If MyNumber has a number in it, the expression returns that number. If not, it returns 0.
0 -
I'm loving this discussion because I tried using empty but empty didn't like that my expected amount value as a float. I was debating if I should convert it to a string but I decided instead to use greater instead of empty
if(greater(body('Get_an_opportunity')?['expected_amount']?['value'],0),
formatNumber(body('Get_an_opportunity')?['expected_amount']?['value'],'C2','en-US'),0)
I'm wondering how using coalesce with the if would work here??
if(coalesce(body('Get_an_opportunity')?['expected_amount']?['value']),
formatNumber(body('Get_an_opportunity')?['expected_amount']?['value'],'C2','en-US'),0)are you doing an expression with Null or a control? Would love to see an example that may help others too.
0 -
@Carol Grant
I've had better luck with coalesce rather than empty as it appears that empty doesn't necessarily mean null. Null means “does not exist”. Empty means “I'm here, but have nothing”.0 -
@Glen Hutson
I use coalesce a lot in SQL, particularly useful when handling multiple parameters and get the first that doesn't have null. Definitely a good option0 -
I'm loving this discussion because I tried using empty but empty didn't like that my expected amount value as a float. I was debating if I should convert it to a string but I decided instead to use greater instead of empty
if(greater(body('Get_an_opportunity')?['expected_amount']?['value'],0),
formatNumber(body('Get_an_opportunity')?['expected_amount']?['value'],'C2','en-US'),0)
I'm wondering how using coalesce with the if would work here??
if(coalesce(body('Get_an_opportunity')?['expected_amount']?['value']),
formatNumber(body('Get_an_opportunity')?['expected_amount']?['value'],'C2','en-US'),0)are you doing an expression with Null or a control? Would love to see an example that may help others too.
empty() expression only works on collection or string only. empty(string) will be true if null or empty string.
0 -
I'm wondering how using coalesce with the if would work here??
if(coalesce(body('Get_an_opportunity')?['expected_amount']?['value']),
formatNumber(body('Get_an_opportunity')?['expected_amount']?['value'],'C2','en-US'),0)If you use coalesce, you don't need the if(). Here's how I'd do it, with indentation for readability.
formatNumber(
coalesce(
body('Get_an_opportunity')?['expected_amount']?['value'],
0),
'C2','en-US')
Or altogether:
formatNumber(coalesce(body('Get_an_opportunity')?['expected_amount']?['value'],0),'C2','en-US')
0 -
@Ben Regier
I think the issue is if showing 0 when there's no expected amount is appropreiateso instead, maybe:
coalesce(formatNumber(dynamic_content_amount, ‘C2’,'en-US'), ‘’)
0 -
@Alex Wong
coalesce(formatNumber(dynamic_content_amount, ‘C2’,'en-US'), ‘’)This will still fail if the dynamic content is null. But you have a point - @Carol Grant, what should the expression return if the expected amount is null? Should it return $0.00, or something else?
0 -
@Ben Regier
Yup your right…formatNumber will fail first not return nullYou will have to use if in there
0 -
@Ben Regier- Hi Ben- I would like it to return null or empty. Not just zero. Thanks!
@Alex Wong Thanks to Alex also for your suggestions.
0 -
@Carol Grant
I would just do this:if(equals(outputs('Get_an_opportunity')?['body/ask_amount/value'],null), '', formatNumber(outputs('Get_an_opportunity')?['body/ask_amount/value'], 'C2', 'en-US'))
1 -
I love this topic of when to use Null v. Empty v. Coalesce. Seems like a great topic for User Group @Erik Leaver
1
Categories
- All Categories
- 6 Blackbaud Community Help
- High Education Program Advisory Group (HE PAG)
- BBCRM PAG Discussions
- Luminate CRM DC Users Group
- DC Luminate CRM Users Group
- Luminate PAG
- 186 bbcon®
- 1.4K Blackbaud Altru®
- 389 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 14 donorCentrics®
- 355 Blackbaud eTapestry®
- 2.4K Blackbaud Financial Edge NXT®
- 616 Blackbaud Grantmaking™
- 542 Blackbaud Education Management Solutions for Higher Education
- 33 Blackbaud Impact Edge™
- 3.1K Blackbaud Education Management Solutions for K-12 Schools
- 909 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 207 JustGiving® from Blackbaud®
- 6.2K Blackbaud Raiser's Edge NXT®
- 3.5K SKY Developer
- 236 ResearchPoint™
- 116 Blackbaud Tuition Management™
- 375 YourCause® from Blackbaud®
- 160 Organizational Best Practices
- 232 The Tap (Just for Fun)
- 31 Blackbaud Community Challenges
- Blackbaud Consultant’s Community
- 19 PowerUp Challenges
- 3 Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 Raiser's Edge NXT PowerUp Challenge: Events
- 3 Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 Raiser's Edge NXT PowerUp Challenge #1 (Query)
- 71 Blackbaud Community All-Stars Discussions
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 743 Community News
- 2.8K Jobs Board
- Community Help Blogs
- 52 Blackbaud SKY® Reporting Announcements
- Blackbaud Consultant’s Community
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
- Blackbaud Francophone Group
- Blackbaud Community™ Discussions
- Blackbaud Francophone Group