ATF: Split task steps

jessa23
Tera Contributor

Dear All,

 

I am creating ATF steps for splitting a remediation task but I have encountered some errors. It's either that my script doesn't open the table or it can't edit the short description of the record.

The previous step of this is a Record query of the remediation task I created.

What could be the reason the script is not working?

 

(function(outputs, steps, stepResult, assertEqual) {
  var gr = new GlideRecord("sn_vul_action_split_vg");
	gr.get(steps('27a02cb7973c7590481abce3f153afd7').first_record);
	if (gr.next()){
		gr.setValue('new_vg_short_desc','test split from script');
		gr.update();
	}
})(outputs, steps, stepResult, assertEqual);

 

 

1 ACCEPTED SOLUTION

Philippe Casidy
Tera Guru

Hello,

 

Use the following code instead.

 

 

	//gr.get(steps('27a02cb7973c7590481abce3f153afd7').first_record);
	if ( gr.get(steps('27a02cb7973c7590481abce3f153afd7').first_record) ){
		gr.setValue('new_vg_short_desc','test split from script');
		gr.update();
	}

 

 

 

Looks like you can't do gr.next() because you are not making a gr.query().

Testing the returned value from gr.get() is enough.

 

Let me know how it works for you.

Philippe

View solution in original post

2 REPLIES 2

Philippe Casidy
Tera Guru

Hello,

 

Use the following code instead.

 

 

	//gr.get(steps('27a02cb7973c7590481abce3f153afd7').first_record);
	if ( gr.get(steps('27a02cb7973c7590481abce3f153afd7').first_record) ){
		gr.setValue('new_vg_short_desc','test split from script');
		gr.update();
	}

 

 

 

Looks like you can't do gr.next() because you are not making a gr.query().

Testing the returned value from gr.get() is enough.

 

Let me know how it works for you.

Philippe

Thank you very much, it worked!