Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Seeking suggestions for solving string related operations in a workflow

Posted on by Microsoft Employee

I have two fields A & B - one is a lookup field and another one is a string. I'm wanting to use values of these fields to populate two other fields P & Q- one is a string and other is an integer.

Field A ( lookup field )- Pineapple 2kg

Filed B ( string )- $20 kg

I want to extract just 'Pineapple' for field A and '20' from field B and populate field P with 'Pineapple' and field Q with 20.

Field P ( string ) - Pineapple

Field Q ( integer ) - 20

How can I achieve this behavior using a workflow? I have to run this process on historical data and new incoming data. Any other suggestion is also welcome. 

Things I'm trying to achieve is string parsing and conversion of string to int. 

Thanks.  

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Seeking suggestions for solving string related operations in a workflow

    Hi Rabbel,

    If you dont use your old fields then I would suggest try to replicate all the old values to new fields  using console application. This will remove dependency permanently.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Seeking suggestions for solving string related operations in a workflow

    @Goutam,  Actually my entity always had Field A and B but due to some new requirement, I have addes Field P and Q. I need to populate field P and Q for the old historical data in the table. Suggest what can I use to fill those old records?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Seeking suggestions for solving string related operations in a workflow

    @hey Adrian, thanks for replying to my question. I understand, javascript is a great solution. I know it will work well for the new data but I have old data where these fields have to be populated. So please suggest me how can I use javacsript to populate historical data?

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Seeking suggestions for solving string related operations in a workflow

    Hi Rabbal,

    As the base  field you mentioned lookup and string ,so you don't know what exactly value will put by user , it could be any value.Using workflow you can not concatenate the lookup  text or string , so OOB workflow it's not achievable.

    This kind of scenario  you can either use custom workflow or plugin (in case server side or backend update) or JavaScript ( if you want to do client side only).

    For better idea is to Have two field one is Fruit (lookup only fruit name ) three one integer (only kg or quantity )and cost ( calculated field multiply by unit cost and quantity). In that case you don't need additional customization.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Seeking suggestions for solving string related operations.

    Hi Rabbal,

    You will not be able to achieve this with an out of the box workflow so consider using JavaScript to complete this task instead. Your JavaScript will need to split the text values of Field A and Field B to get the first word in each field and remove the first character of Field B to get rid of the $ symbol. Once you have these values you will be able to set Field P and Field Q with the correct values.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans