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

Replace Dynamic content with message when writing to SharePoint list using expressions?

Hi all,

 

Does anyone know how I can replace content being written to a SP list based on the value of the dynamic content. Ideally something with the same logic as shown below. 

 

IF value = 1234

Change to Test text 

Else use dynamic content.

 

Cheers,

Adam

7 REPLIES 7
Super User
Super User

Re: Replace Dynamic content with message when writing to SharePoint list using expressions?

How about this:

 

if(equals(triggerBody()?['ColumnA'],'1234'), 'test text', triggerBody()?['ColumnA'])
 
In my example, if Column A = 1234, then return "test text" otherwise use the value in ColumnA
 
Please post here and let me know if this solves your issue.
 
Scott
 
TestText1.jpg
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Community Support Team
Community Support Team

Re: Replace Dynamic content with message when writing to SharePoint list using expressions?

Hi @AFisher1,

 

Could you please share a bit more about your scenario?

Further, could you please share more details about your SharePoint list?

 

I agree with @ScottShearer's thought almost, I think the if() function could achieve your needs. I have made a test on my side and please take a try with the following workaround:10.JPG

The Column B field set to following formula:

if(equals(triggerBody()?['Column_x0020_A'],'1234'),'Test',triggerBody()?['Column_x0020_A'])

Note: The Column A and Column B are both Single line of text type column in my SharePoint list. In order to include the Dynamic content within your if expression, you should firstly select the if expression, then select the Dynamic content tab and simply click the field you want to use.

 

The flow works successfully as below:

If the Column A is equal to 1234:11.JPG

If the Column A value is not equal to 1234:12.JPG

 

 

More details about using expression in flow actions, please check the following article:

Use expression in flow actions

 

More details about the if() function, please check the following article:

https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#logical-fu...

 

 

Best regards,

Kris

 

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AFisher1
Level: Powered On

Re: Replace Dynamic content with message when writing to SharePoint list using expressions?

Hi, 

 

Thanks for your help.

When I used this code and added my dynamic content as you mentioned it wasn't giving me any errors and running was successfully. 

But the name in the sharepoint list did not change at all.

Any ideas on how to fix this problem? 

 

heres my code below:

if(equals(triggerBody()?['requester_id'],'12345678'), 'requester name here',triggerBody()?['requester_id'])
 
My goal is to be able to take the freshdesk requester ID and change it to the name of the requester for ease of use.
 
Thanks, 
Adam
AFisher1
Level: Powered On

Re: Replace Dynamic content with message when writing to SharePoint list using expressions?

Hi, 

 

Thanks for your help.

When I used the code Scott provided and added my dynamic content as mentioned it wasn't giving me any errors and running was successfully. 

But the name in the sharepoint list did not change at all.

Any ideas on how to fix this problem? 

 

heres my code below:

if(equals(triggerBody()?['requester_id'],'12345678')'requester name here',triggerBody()?['requester_id'])
 
My goal is to be able to take the freshdesk requester ID and change it to the name of the requester for ease of use.
 
Thanks, 
Adam
Super User
Super User

Re: Replace Dynamic content with message when writing to SharePoint list using expressions?

Can you post a screenshot of your Flow?  This will make it easier to assist.

 

What type of column is requester_ID?  Person or Group?  Text Column?

 

Also, does the run history provide any clues to why the column is not being updated?

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
AFisher1
Level: Powered On

Re: Replace Dynamic content with message when writing to SharePoint list using expressions?

Capture.PNG Request ID goes into the customer field in the SP list which is a single line of text.

Super User
Super User

Re: Replace Dynamic content with message when writing to SharePoint list using expressions?

I am wondering if there is an issue with the requester_id column. 

Can you take a look at the run history and see if you are getting anything back?

 

Try inserting just the requester_id into the customer column (remove the expression) and see if it works (as a test).

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

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!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (3,297)