How to split string in flow designer?

nayanmule
Tera Expert

Hi All,

I want to get values from one field in change request & populate it in another field on a change task form.

for eg. if I have a Change Plan field which has following values - 

newservername = testt123
oldservername = test256
cutoverdate = 03/23/2025
plantname = US
plantid = 1356.

 

I want to populate these values in change task description .

for eg. Change task - Update the 'newservername' to 'oldservername'.

 

I have multiple change tasks created through flow designer. I would like to know how can I split the string and use the values in change tasks or anywhere I need in flow designer.

 

Thankyou!

1 ACCEPTED SOLUTION

nayanmule
Tera Expert

Thankyou everyone for your responses. 

I have achieved it by creating an action. Within an action, I have added a script using inputs and outputs.

(function execute(inputs, outputs) {
// ... code ...
var data = inputs.inputString;
var lines = data.split('\n');   // this will split the string based on lines
var values = [];

for(var i=0;i<lines.length;i++){
    var parts = lines[i].split('=');    //this will split the string one more time using =
    if(parts.length  === 2){

        values.push(parts[1].trim());   //trim the second value string to remove unwanted spaces.
     
    }
}
 
outputs.newservername = values[0];
outputs.oldservername = values[1];
outputs.cutoverdate = values[2];

View solution in original post

6 REPLIES 6

nayanmule
Tera Expert

Thankyou everyone for your responses. 

I have achieved it by creating an action. Within an action, I have added a script using inputs and outputs.

(function execute(inputs, outputs) {
// ... code ...
var data = inputs.inputString;
var lines = data.split('\n');   // this will split the string based on lines
var values = [];

for(var i=0;i<lines.length;i++){
    var parts = lines[i].split('=');    //this will split the string one more time using =
    if(parts.length  === 2){

        values.push(parts[1].trim());   //trim the second value string to remove unwanted spaces.
     
    }
}
 
outputs.newservername = values[0];
outputs.oldservername = values[1];
outputs.cutoverdate = values[2];

Great that this works, but do realize that the Change Plan field is a string field and can contain lots of things. If any one, at any points switches lines, or adds lines to it, your order isn't correct anymore. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark