cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AfonsoTanida
Regular Visitor

How to replace a Null value (no entry) with "n/a" when trying to convert SharePoint list to PDF

I am using a flow to create a PDF using data stored in a SharePoint list How to Generate Customized PDF From SharePoint List Item using Power Automate.

The only issue is that when an entry is empty in the list, the flow fails because it expects a string and not a null entry.

This is the error code

"Unable to process template language expressions in action 'Compose_13' inputs at line '0' and column '0': 'The template language function 'replace' expects three string parameters: the string to replace characters inside of as the first parameter, the string that will be replaced by the new string as the second parameter, and the new string as the third parameter. The function was invoked with '4' parameter(s). Please see https://aka.ms/logicexpressions#replace for usage details.'."

This is the formula I am using: 

replace(outputs('Compose_12'),'{serialb}',outputs('Get_item')?['body/Serial_x0023_'])
 
How can I have it to where if the entry is null, it will be replaced with "n/a"? Thank you.
1 ACCEPTED SOLUTION

Accepted Solutions
AfonsoTanida
Regular Visitor

Found the solution

replace(outputs('Compose_12'),'{serialb}',if(empty(outputs('Get_item')?['body/Serial_x0023_']),'',outputs('Get_item')?['body/Serial_x0023_']))

View solution in original post

2 REPLIES 2
AfonsoTanida
Regular Visitor

Found the solution

replace(outputs('Compose_12'),'{serialb}',if(empty(outputs('Get_item')?['body/Serial_x0023_']),'',outputs('Get_item')?['body/Serial_x0023_']))
arifhaiqal
New Member

Awesome! I've been looking for the EXACT same question! and got the answer

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,722)