Skip to content

Commit bc35dc3

Browse files
authored
Fetch requested by user for a change record using getRefRecord() (#1500)
* Create GetRecordRequestedBy_Soumyadeep.js This piece of code typically for the background script would fetch the change request record whose sys_id has been provided and then through the getRefRecord() it would fetch the requested by user and print its field values for "user_name" and "email". * Create Readme_Soumyadeep.md This script will glide for a particular record whose sys id has been provided It will fetch the record and then use getRefRecord() to fetch the requested by user details. If the user is a valid record, then it will fetch the user_name and email.
1 parent dd29cc2 commit bc35dc3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var changerecord = new GlideRecord('change_request');
2+
changerecord.get('sys_id', 'a9e9c33dc61122760072455df62663d2' );
3+
4+
var requestedBy = changerecord.requested_by.getRefRecord();
5+
6+
if (requestedBy.isValidRecord()) {
7+
8+
gs.print("User Name: " + requestedBy.user_name);
9+
gs.print("User Email: " + requestedBy.email);
10+
}
11+
else {
12+
gs.print("Caller record wasn't found");
13+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This script will glide for a particular record whose sys id has been provided
2+
It will fetch the record and then use getRefRecord() to fetch the requested by user details.
3+
If the user is a valid record, then it will fetch the user_name and email.

0 commit comments

Comments
 (0)