Skip to content

Commit 493cbe5

Browse files
authored
Add Custom Test Step Configuration Script to Fetch Number & Short Description (#1688)
* Create Get Number & Short Description.js * Readme.md
1 parent ef584aa commit 493cbe5

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;
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();
13+
} else {
14+
stepResult.setOutputMessage('Record not found');
15+
stepResult.setFailed();
16+
}
17+
18+
}(inputs, outputs, stepResult, timeout));
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 o 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)