Hi-
I am having to create a flow using power automate that requires the following:
User inputs a tracking number in a SharePoint column, I need to figure out how using power automate
to capture the last 4 digits or characters of the input tracking number value and display it into another column
in another Sharepoint list but for now just need the function of how to achieve this.
Any help is appreciated,
y2kardell
Solved! Go to Solution.
Doing it with hidden SharePoint column would have been easier. Please mark the original solution as accepted.
Pat
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
You can use an expression like this. Replace 'abcdefg' with your Dynamic Content in both places.
substring('abcdefg', sub(length('abcdefg'),4),4)
Pat
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
Hey Pat-
Thanks for the feedback I really appreciate it, I just have another question, exactly where would I use the substring function that you mentioned? Currently I have 2 lists with a column called "Tracking#" on both lists and the idea is that I want to take for example "123344455" and extract the last 4 digits (in this case 4455) and use a create and update to dump the value into another column called "Tracking Last 4).
Any further help is always appreciated.
Thanks,
y2kardell
You can use that expression wherever you would use that value. For example, in the Create/Update SharePoint item action for the last 4 characters field. Instead of adding dynamic content, click on Expression instead and enter the substring, using the dynamic content field in place of 'abcdefg'.
Also, I noticed that you posted this question again. FYI that you can @ mention someone in your response to make sure they get notified.
Pat
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
@mahoneypat I think I am still having issues, here is what I am seeing:
in the Create and Update item action fields I have a column called 'Tracking (Last 4).
In the expressions box here is what I entered '@{substring('Tracking #', sub(length('Tracking #'),4),4)}'.
When I did so, the output I received back was: 'ng #'.
Any ideas what I ama doing wrong? The value that I entered in the column box called 'Tracking #' was '12345678'.
Thanks again for your help,
y2kardell
When you add just the Tracking # field directly and hover over it, you will see an expression like item()['Tracking #']. Use that expression in place of 'Tracking #' in your expression.
Pat
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
@mahoneypat I'm not sure that I quite follow where you are saying that should be applied. I am attaching a partial screenshot of my flow for you to point out where exactly and for further clarification.
Thanks again for the help,
y2kardell
Without seeing the actual expression, your pic looks correct. Is it working?
Pat
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
@mahoneypat it's not....I don't think that I have the expression correct. When I run the flow...it's giving me 4 characters being.......'ng #' instead of the last four digits of the tracking number like it's supposed to. My question is that you mentioned using [] but I'm not sure of the exact syntax in the expression.
@mahoneypat this is the expression I used:
You are passing static text of 'Tracking #', when you need to pass a dynamic expression. In your pic, hover your mouse over the green Tracking # field you added and note the expression shown. Use that in place of 'Tracking #' in both places in your expression.
Pat
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
@mahoneypat this was what showed up in the 'Tracking #' field when I hovered:
triggerOutputs()?['body/Tracking_x0023_']
I tried this:
You need to use the whole thing. This should be your final expression.
substring(triggerOutputs()?['body/Tracking_x0023_'], sub(length(triggerOutputs()?['body/Tracking_x0023_']),4),4)
Pat
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
@mahoneypat ok so this seems to give me a 'flow run failed' message after adding the substring function you mentioned when I save the initial sharepoint list, but then when I modify it, it gives the expected results. Here is the error message I am gettting.
You have to check if triggerOutputs()?['body/Tracking_x0023_'] is null.
The value is 0 until the approver goes back in to edit the form to input the tracking number in the tracking # column. Initially when the shipper submits the shipping request.....it is 0 because it's obvious the shipper won't know the tracking number at that point.
@VictorIvanidze @mahoneypat I guess my main question is....how do i check a field is NULL or not?
Hi @y2kardell,, just use empty() function.
@VictorIvanidze @mahoneypat when I use:
@empty(triggerbody()?['body/Tracking_x0023_']) in the condition statement, I get 'The expression is invalid'.
Any ideas?
I even took out the single quotes and typed them in again with the same issue.
Thanks again for the help,
y2kardell
You need to add the ? in to protect against the case when it does not exist. Here is an example
To learn more about the Power Platform, follow me on Twitter or subscribe on YouTube.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
45 | |
17 | |
16 | |
13 | |
13 |
User | Count |
---|---|
79 | |
41 | |
27 | |
22 | |
18 |