missing ; before statement

levino
Giga Guru

Hi there

 

I have a catalog item which has a REST workflow,  the rest message is being sent thru successfully, just the servicenow request shows up with this error in workflow log 

'Wrapped org.mozilla.javascript.EvaluatorException: missing ; before statement (Spark Adaptive Inventory(3987e86ddbd2c914b8846c1305961901); line 1) (sys_trigger.56632d1e1b06015055f2baeccc4bcb1d; line 2'

the workflow goes into a loop, even though the REST Message is successfully sent thru

 

any idea please?

 

Thanks

Levino

 

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi

it seems that the script within the Workflow activity is faulty.

Therefore please share the script.

Kind regards
Maik

View solution in original post

2 REPLIES 2

Maik Skoddow
Tera Patron
Tera Patron

Hi

it seems that the script within the Workflow activity is faulty.

Therefore please share the script.

Kind regards
Maik

workflow.scratchpad.environment = current.variables.environment;

var profile = current.variables.profile.toString();
var str = profile.split(',');
var roleName = [];
for (var i = 0; i < str.length; i++) {
    var grRole = new GlideRecord('u_cmdb_ci_application_role');
    grRole.addQuery('sys_id', str[i]);
    grRole.query();
    if (grRole.next()) {
        roleName.push(grRole.name);
    }
}
	var list = roleName.join(',');
workflow.scratchpad.profile = list;



var requested_for = current.variables.requested_for;

var requestorForRecord = new GlideRecord('sys_user');
requestorForRecord.addQuery('sys_id', requested_for);
requestorForRecord.query();
if (requestorForRecord.next()){
	workflow.scratchpad.full_name = requestorForRecord.name;
}

var requestorForEmail = new GlideRecord('sys_user');
requestorForEmail.addQuery('sys_id', requested_for);
requestorForEmail.query();
if (requestorForEmail.next()){
	workflow.scratchpad.email = requestorForEmail.email;
}

var requestorForTnumber = new GlideRecord('sys_user');
requestorForTnumber.addQuery('sys_id', requested_for);
requestorForTnumber.query();
if (requestorForTnumber.next()){
	workflow.scratchpad.spark_tnumber = requestorForTnumber.employee_number;
}


var time = new GlideDateTime().getNumericValue();

workflow.info(time + " Profile: " + workflow.scratchpad.profile);
workflow.info(time + " Full Name: "  + workflow.scratchpad.full_name);
workflow.info(time + " Email: " + workflow.scratchpad.email);
workflow.info(time + " Tnumber: " + workflow.scratchpad.spark_tnumber);