cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Walter1
Level: Powered On

Update sharepoint item with custom text if approval comment is left blank

I've got an approval flow that uses 'Start and wait for an approval'.  When the approver approves or rejects the flow the relevant sharepoint list is updated, including capturing the comment they might have added.

However, when an approver leaves the 'Add a comment (optional)' field empty rather then leaving the field empty I'd like to update the relevant sharepoint item with a default text, something like 'No comment added'.

 

Thought a simple expression like an if statement would do the trick but it doesn't allow me to.  Any suggestions on how to accomplish this?

 

 Capture.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Update sharepoint item with custom text if approval comment is left blank

 

Hi @Walter1 ,

 

Please try to use the following configuration:

9.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Update sharepoint item with custom text if approval comment is left blank

if(empty(body('Start_and_wait_for_an_approval')?['responses'][0]?['comments']), "No Comment", body('Start_and_wait_for_an_approval')?['responses'][0]?['comments']))

 

Try something like this. May not be exactly correct syntax

 

Community Support Team
Community Support Team

Re: Update sharepoint item with custom text if approval comment is left blank

 

Hi @Walter1 ,

 

Please try to use the following configuration:

9.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Walter1
Level: Powered On

Re: Update sharepoint item with custom text if approval comment is left blank

Thanks - I've tried several variations on the code you suggested but it doesn't seemt to accept that.

Might be somethign to with that if you select the 'Responses Comment' field it shows as 'Items(Apply_to_each)?['comments']' rather than the 'body('Start_and_wait_for_an_approval')?['responses'][0]?['comments']' you have used.   Also, as soon as I select an expression, the option to select 'Responses Comment' disappears from the list of dynamic fields to choose from.

 

Walter1
Level: Powered On

Re: Update sharepoint item with custom text if approval comment is left blank

Hi, yes that works.  Ideally just adding an expression woud've been simpler but this works fine.  Thanks!

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,068)