question

MaheshMadhusanka-3900 avatar image
0 Votes"
MaheshMadhusanka-3900 asked MayankBargali-MSFT commented

How to pick specific text componect using Logic App

Hi Team,

Currently we have specific email body including Paragraph, According to we want to capture specific text part from the paragraph. how we can do it via Azure Logic app? According to below example require to capture S18035343355, appreciate your immediate support on this..?

ex:-

Number call Job Number S18035343355

azure-logic-apps
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

No example provided? I assume you have tried using the built-in expressions. Maybe export the message body to a file or workspace where it can be more easily queried.

0 Votes 0 ·

Hi Andrew,

Thank you for your response, yes I need a expression to capture specific txt section. my example is below text field, according to require to capture ex - 'S18035343355' text component.

ex:-

Number call Job Number S18035343355

Thanks
Mahesh

0 Votes 0 ·

1 Answer

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT commented

@MaheshMadhusanka-3900 Thanks for reaching out. Logic app does have expression function and you can refer to this document for more details on the support expression.
Unfortunately, as per your use case there are no expression functions that can help you. So, you need to either leverage the inline code to write your own code (JavaScript) for your requirement as below or you can offload this functionality to azure function. In cases where you don't want to use inline code, or the inline code cannot help then you can always use azure function and call azure function within logic app.

For your requirement I have defined the variable and passed the text as per your sample text and used inline JavaScript code (match) to get the desired result.

Note: The below is only for reference and the inline code will be changed as per what action input/output you will be using for your inline code. Your logic app should be using Integration account as documented here.

Designer View:

191644-image.png

JavaScript Code:

 let myText =workflowContext.actions["Initialize_variable"].inputs.variables[0].value
 return myText.match(/S[0-9]*/g);

Output:
191580-image.png

Feel free to get back to me if you need any assistance.

Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


image.png (25.3 KiB)
image.png (36.9 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MayankBargali-MSFT Thank you very much for your support its working.

0 Votes 0 ·
MayankBargali-MSFT avatar image MayankBargali-MSFT MaheshMadhusanka-3900 ·

@MaheshMadhusanka-3900 Thanks for your response. Glad to know that it helped. Feel free to reach out to us in Microsoft Q&A if you need any assistance in future.

0 Votes 0 ·