Server side script - Javascript compiler exception: missing name after . operator

Alice18
Kilo Contributor

Hi,

I have an ATF test which was running fine previously, and suddenly the server side script step starts to return me errors. Does anyone know what might be the cause?

This is a screenshot of the error I got:

find_real_file.png

and this is the code that is currently having the issue:

(function(outputs, steps, stepResult, assertEqual) {
// add test script here

var survey = new GlideRecord('task_survey');
survey.get(steps('7230cfd0db186f0076cfa3cc0b9619a6').first_record);

gs.info('user: ' + survey.sent_to.name);

if (survey.sent_to.hasRole('survey_reader')){
var rec = new GlideRecord('sys_user_has_role');
rec.addQuery('role.name', 'survey_reader');
rec.addQuery('user', survey.sent_to);
rec.query();

rec.delete();

var bool = survey.sent_to.hasRole('survey_reader');
gs.info('user has survey_reader role: ' + bool);

}

step.outputs.record_id = survey.sent_to;
step.outputs.table = 'sys_user';

})(outputs, steps, stepResult, assertEqual);

 

 

 

 

Thanks in advance,

Alice

1 REPLY 1

Ankush Agrawal
ServiceNow Employee
ServiceNow Employee

Hello Alice

 

I guess the issue is with the following lines

step.outputs.record_id = survey.sent_to;
step.outputs.table = 'sys_user';

You should change those lines to

outputs.record_id = survey.sent_to;
outputs.table = 'sys_user';

I believe you have written a few custom output variable (e.g.: first_record as used in the following steps)

survey.get(steps('7230cfd0db186f0076cfa3cc0b9619a6').first_record);