- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2023 11:02 PM - edited 03-02-2023 11:40 PM
Hi All,
In my ATF test case, I have used below steps to create a record in a custom table
Step 1 : Creating a user
Step 2 : Creating a user
Step 3 : Record Update
Step 4 : Run Server Side Script
In step 4, I need to get the sys_id of the user which got created in step 1. So i have used the below lines
(function(outputs, steps, params, stepResult, assertEqual) {
var step1sysid = '6989f601376023008020036973990ebc';
var getUserSysId = steps(step1sysid).record_id;
gs.info('User id is ' + getUserSysId);
}
In my logs getUserSysId value is getting undefined.
Can someone help me on the same.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 12:19 AM
you should use this
user instead of record_id
(function(outputs, steps, params, stepResult, assertEqual) {
// add test script here
var step1sysid = '6989f601376023008020036973990ebc';
var getUserSysId = steps(step1sysid).user; // I changed here
})(outputs, steps, params, stepResult, assertEqual);
Output variable is user for Create a User OOB Step
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 12:19 AM
you should use this
user instead of record_id
(function(outputs, steps, params, stepResult, assertEqual) {
// add test script here
var step1sysid = '6989f601376023008020036973990ebc';
var getUserSysId = steps(step1sysid).user; // I changed here
})(outputs, steps, params, stepResult, assertEqual);
Output variable is user for Create a User OOB Step
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 12:37 AM
Thank You Ankur. Marked as correct 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 12:27 AM - edited 03-03-2023 03:04 AM
Hi @Ankur ,
Step 1 : Creating a user (Subordinate)
Step 2 : Creating a user (Manager)
Step 3 : Record Update (I am updating step2 user as a manager to the step1 user)
So i didn't open any existing form. Directly gave Record Update.
Table : sys_user
Record : Step 1 User record
Field Values : Manager = Step 2 User record.
Now in Run Server Side script i need to pass the sys_id of the subordinate user. For that only i am getting undefined.
Regards,
Sri