Skip to content

Commit 7171cff

Browse files
authored
Merge branch 'ServiceNowDevProgram:main' into OutboundRESTDynamicEndpoint
2 parents d335de5 + fb62c37 commit 7171cff

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(function executeStep(inputs, outputs, stepResult, timeout) {
2+
3+
var recordSysId = inputs.u_sys_id; // It takes the sys_id of the incident
4+
5+
var finance = new GlideRecord("incident");
6+
finance.addQuery("sys_id", recordSysId);
7+
finance.query();
8+
if (finance.next()) {
9+
outputs.u_number = finance.getDisplayValue("number");
10+
outputs.u_short_description= finance.getDisplayValue("short_description");
11+
stepResult.setOutputMessage('Found the record');
12+
stepResult.setSuccess(); // Setting the output message as successfull.
13+
} else {
14+
stepResult.setOutputMessage('Record not found');
15+
stepResult.setFailed(); // Setting the output message as unsuccessfull.
16+
}
17+
18+
}(inputs, outputs, stepResult, timeout));

Custom Test Step/Readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Above custom test step configuration script will help to get the "Number" & "Short Description" based on the sys_id of the incident. Let's say while performing any server dependent steps on incident table this custom step configuration script can be very usefullt to retrieve the details, not only about incident or number, short_description. Anybody can utilize this script to create custom step configuration script on different usecases or scenario.
2+
3+
Note: You need to define the inputs & outputs for this, in my case I have defined the 'sys_id' as an input and "Number" & "Short Description" as an output to store the values and use it anywhere. Also to make sure you define the "stepResult.setOutputMessage("Successfull")" and "stepResult.setOutputMessage("Unsuccessfull")".

0 commit comments

Comments
 (0)