Need help on ATF Server Side script.

IamSK
Mega Guru

Hi,

We are on London and started to build and implement ATF cases. I have created ATF for one of the catalog item.

I have fill out the form and created RITM and Catalog task. But I am not sure how to fill full filler supplied variables that

need to be completed before closing of task. I have researched and get to know that Server Side script must be used to

complete this process. So, I need help on script as I am new to this ATF.  Help must be appreciated.

find_real_file.png

Thanks,

Sai

1 ACCEPTED SOLUTION

vandna
Tera Guru

Try Below script.

 

var req = new GlideRecord('sc_req_item');

req.get(<sys_id of the ritm>);

req.variables.<variable_name> = <Value>;

req.update();

View solution in original post

4 REPLIES 4

vandna
Tera Guru

Try Below script.

 

var req = new GlideRecord('sc_req_item');

req.get(<sys_id of the ritm>);

req.variables.<variable_name> = <Value>;

req.update();

SatheeshKumar
Kilo Sage

you do you need script? you can use 

1.open an existing record step

2.set field values step

it is possible to fill the task values using the above steps.

 

OR use the below steps

 var gr = new GlideRecord("sc_task");
          gr.addQuery('request_item',steps(PREVIOUS_STEP_SYS_ID).record_id);
          gr.query();
          if(gr.next())
		  {
			gr.description ="10.123.45.67";
			gr.work_notes = 'test';
		outputs.sys_id = gr.update();
		  }

 

 

replace PREVIOUS_STEP_SYS_ID with the sysid of your previous ATF step 

 find_real_file.png

 -Satheesh

Hi Satheesh,

I have tried with this script but in logs it shows as undefined as it's not finding the sys_id of previous step catalog task record

 

find_real_file.png

 

Thanks,

Sai

Soumita3
Tera Expert

Hi,

 

At the start of the script i.e. just after the function starts you need to define two variables:

var response; //for your result

var record_id; //to pass the result

 

after the GlideRecord you need to add the below step:

gr.addQuery('step','sys_id_of_the_previous_step'); 

gr.query();

 

The last two lines of the code before the function ends will be:

response= where you store the output;

outputs.record_idresponse;

 

Hope this helps.

Please mark the answer correct/helpful.

 

Regards,

Soumita.