Flow Designer - adding "substring to remove last character of string"

Victor Ruiz
Tera Guru

Trying to strip the last character of this string in flow designer 1593196951393.661cda55-c732-4317>   

Can this be done in flow designer?

 

find_real_file.png

 

 

 

 

1 ACCEPTED SOLUTION

Chander Bhusha1
Tera Guru

Hi Victor,

Since its OOB action so there you have to specify the index and as per your requirement the string length is not constant so you have to go with the custom actions only as said by @sachin.namjoshi .

In the action to stripe the last character you can use the following code:

var a = '1593196951393.661cda55-c732-4317>';
var st = a.toString();
var req = a.substring(0,a.length-1);
gs.print(req); //for testing purpose remove this line 

 

Mark helpful and correct if it helps.

Thanks,

CB

View solution in original post

7 REPLIES 7

sachin_namjoshi
Kilo Patron
Kilo Patron

You need to use script action in flow designer to do this

 

https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/platform-events/r...

 

Regards,

Sachin

Chander Bhusha1
Tera Guru

Hi Victor,

Since its OOB action so there you have to specify the index and as per your requirement the string length is not constant so you have to go with the custom actions only as said by @sachin.namjoshi .

In the action to stripe the last character you can use the following code:

var a = '1593196951393.661cda55-c732-4317>';
var st = a.toString();
var req = a.substring(0,a.length-1);
gs.print(req); //for testing purpose remove this line 

 

Mark helpful and correct if it helps.

Thanks,

CB

Thanks for the help....how do I pass the value to the action for processing and back to the flow?

 

DirkRedeker
Mega Sage

Hi

Instead of creating your own Action first, which is a bit more work to do, you could just write an inline script.

You can so do, by clicking the "fx" button on the right of your field (see screenshot below):

find_real_file.png

Note: Take care, NOT to click the "FX" button again, after capturing the function. This would "deactivate" the function!!!

Here, you can place a bit more code, just to cut of the last character in a standard JavaScript way.

Let me know if that answers your question and mark my answer as correct and helpful.

BR

Dirk