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

Hi there

i managed to update the script with the below but the job still fails, only if i add 2 backslashes on the UI then only it succeeds

 

 

if (current.variables.new_folder_path){

var str = current.variables.new_folder_path.toString();
var res = str.replace(/\//gi, "\\\\");
workflow.scratchpad.NewFolderPath = res;

} else {
workflow.scratchpad.NewFolderPath = '';

Log a message to see what value is coming in the scratchpad variable. And, go to System logs --> All and search for source contains  "Log msg for scratchpad".

if (current.variables.new_folder_path){

var str = current.variables.new_folder_path.toString();
var res = str.replace(/\//gi, "\\\\");
workflow.scratchpad.NewFolderPath = res;

workflow.info('Scratchpad variable:'+workflow.scratchpad.NewFolderPath);
gs.log(workflow.scratchpad.NewFolderPath,'Log msg for scratchpad');


}

 

i have added your code to generate a log

 

but cannot seem to find anyting under System log- ALL

 

 

levino
Giga Guru

G:\ak\Shared01

levino
Giga Guru

Hi there

i have tried looking under as suggested, cannot find the log, is there anything else i should do?

 System log --> All and search for source contains  "Log msg for scratchpad".