How do I get case number from record in ATF?

MentZ
Kilo Expert

I have created a record in an ATF, but I'm struggling to get the incident-number, I'm only able to get the sys_id. Anyone who could help me get the Incident-number from a record-object? As I have figured it out, this need to be done in a server side script-step.

 

1 ACCEPTED SOLUTION

Hi,

you need to create new and then you would find it during adding the step

1) left nav step configurations

2) create new

3) create input, output variables use script

find_real_file.png

Then you can select it during adding the step in ATF

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Hi,

you need to create new and then you would find it during adding the step

1) left nav step configurations

2) create new

3) create input, output variables use script

find_real_file.png

Then you can select it during adding the step in ATF

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ah okay, thank you. Should i write a script? What should this contain?

Hi,

you will be passing the record sys_id as input

so in script query the table and set the number in output variable

something like this

(function executeStep(inputs, outputs, stepResult, timeout) {

	var sysId = inputs.u_sysid;
	var tableName = inputs.u_tablename;

	var gr = new GlideRecord(tableName);
	gr.addQuery("sys_id", sysId);
	gr.query();
	if (gr.next()) {
		outputs.u_number = gr.getDisplayValue();
	}

}(inputs, outputs, stepResult, timeout));

Input variables

find_real_file.png

Output variable

find_real_file.png

How to pass value to this custom step

find_real_file.png

 

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader