REST OUTBOUND MESSAGE JSON FORMAT - ESCAPE CHARACTER BACKSLASH

levino
Giga Guru

Hi There

REST OUTBOUND MESSAGE JSON FORMAT to mid server to runbook

 

i am trying to pass a 

value parameter FolderPath = G:\ak\shared18

it works if the user type in

G:\\ak\\shared18

i still want the user to  type in G:\ak\shared18, is there a way around this

 

do i modify the outbound message to pass thru a escape character

 

Thanks

Levino

1 ACCEPTED SOLUTION

levino
Giga Guru

all sorted , i have used a onload script

View solution in original post

30 REPLIES 30

Yes, that is correct. As mentioned by @David Dubuis , regular expression is used to manipulate the string.

Simple example:

https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_replace3

levino
Giga Guru

Hi there

i have added this to the onsubmit client script

 

 

the change does not seem to reflect in the description field of the requested item

e.g.

New Folder Path: g:\ad\gpam

 

am i missing something?

 

Thanks

levino

Actually, it should work. Create a run script activity in workflow and apply the string manipulation.

var str = current.variables.new_folder_path;

var res = str.replace(/\//gi, "\\\\");

current.variables.new_folder_path = res;

 

levino
Giga Guru

function onSubmit() {
//Type appropriate comment here, and begin script below
var str = g_form.getValue('new_folder_path');

var res = str.replace(/\//gi, "\\\\");
g_form.setValue('new_folder_path',res);
}

 

 

 

How will you decode the fields inside the description tag?

{ 
         short_description: <text>,
    description: 
        {
	  status:<status>, 
          priority:<priority>,
          source:<source>
	 }
	}