Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Parse string and pass these values to Email template

(0) ShareShare
ReportReport
Posted on by 15

Hi, 

One of our entity field contains coma separated values. I want to write a workflow, which is triggered when this field contains data. 

Task is to split those values after coma, find out how many elements are there and send them as separate text in an email. 

I saw this utility,https://github.com/jlattimer/CRM-String-Workflow-Utilities. But how can I get result back once I perform substring. Is there a list variable in Workflow where I can save those values and pass to my Send Email Action who then send these. E.g.

Field1 = 123,Test,567,Summer,BlaBla

Need to know how many elements are there e.g. 5 element and send an email like this. 

You have 5 element in your field. 

Element 1: 123

Element2: Test

Element3: 567

Element4: Summer

Element5: BlaBla

Can it be achieved in Workflow & via Email Template? If yes, please guide. 

  • Suggested answer
    LuHao Profile Picture
    LuHao 40,874 on at
    RE: Parse string and pass these values to Email template

    pastedimage1603099995474v1.png

    pastedimage1603100018864v2.png

    pastedimage1603100039981v3.png

  • HoomDoom Profile Picture
    HoomDoom 15 on at
    RE: Parse string and pass these values to Email template

    @Lu Hao  Can you please re-post the 2nd image (setting up the flow). It is not readable. May be split it in multiple images. Thanks!

  • Suggested answer
    Javed Iqbal Profile Picture
    Javed Iqbal 85 on at
    RE: Parse string and pass these values to Email template

    I don't know if you can JS but this can be very easily achieved using simple script.

    function myFunc(ExecutionContext) {

     var formContext=ExecutionContext.getFormContext()

     var str = formContext.getAttribute("<fieldname>").getValue()();

     var array = str.split(",");

     var noOfElement= array.length;

     // you can even loop through each element

     //for (var i=0; i<array.length; i++){

     // alert(array.length);

     //}

    }

    simply call this function onChange event of field and you will have result in noOfElements variable.

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Parse string and pass these values to Email template

    In addition to that you can also build a custom workflow where you can split these values and concatenate into string variable and return as output from your workflow, this output variable you can use while designing your email step in workflow.

    you can refer how to use output variable.

  • Verified answer
    LuHao Profile Picture
    LuHao 40,874 on at
    RE: Parse string and pass these values to Email template

    Hi partner,

    The easiest way is to split field values through Power Automate and send emails, which is also a no-code way.

    Background: In the Contact, there is a field "test" which contains comma separated values, when it is changed, I need to send an email as your provided.

    Go to https://make.powerapps.com/, select the D365 environment and click Flow, then new a auotemated flow.

    pastedimage1602837042358v1.png

    Then set the flow as follow.

    pastedimage1602837257331v2.png

    This is the field value.

    pastedimage1602837351342v4.png

    This is the email.

    pastedimage1602837310838v3.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans