- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 01:43 PM
// Using a single test OHF with little data and a closed RITM
var OHF = new GlideRecord('u_ob_openhirefulfillment');
var lm = "OH_test_rig_3";
OHF.get("cbe0a2be2b7c664091d580a119da1511"); // hard coding for testing only
gs.log("First name: " + OHF.u_first_name, lm); // verify we got the test record
// get RITM
var ritm = OHF.u_fksc_req_item_request.getRefRecord();
gs.log("get returned RITM: " + ritm.getDisplayValue());
gs.log('OHF request field: ' + OHF.u_fksc_req_item_request, "openHire");
gs.log('ritm value: ' + ritm.sys_id, "openHire");
try {
var myOHF = new GlideRecord('u_ob_openhirefulfillment');
var RITMSID = ritm.sys_id;
myOHF.addQuery('u_fksc_req_item_request', 'RITMSID');
myOHF.query();
if (myOHF.next) {
gs.log("last error msg; " + myOHF.getLastErrorMessage());
gs.log('OHF in email scripting is ' + myOHF.getDisplayValue(), "openHire");
gs.log("First name: " + myOHF.u_first_name, lm); // verify we got the test record
} else {gs.log('query returned nothing for ' + ritm.getDisplayName()); }
} catch (err) {gs.log('query returned nothing for ' + ritm.getDisplayName()); }
The logs show that the ritm is successfully read and gs.log output shows the value of the RITMSID field is the sys_id stored on the u_ob_openhirefulfillment's u_fksc_req_item_request field.
The problem is that no errors are thrown and the myOHF.u_first_name displays a blank, even though the field is valued based on the first log message.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 04:18 PM
There are few syntax errors. Try this
var OHF = new GlideRecord('u_ob_openhirefulfillment');
var lm = "OH_test_rig_3";
OHF.get("cbe0a2be2b7c664091d580a119da1511"); // hard coding for testing only
gs.log("First name: " + OHF.u_first_name); // verify we got the test record
// get RITM
var ritm = OHF.u_fksc_req_item_request.getRefRecord();
gs.log("get returned RITM: " + ritm.number);
gs.log('OHF request field: ' + OHF.u_fksc_req_item_request, "openHire");
gs.log('ritm value: ' + ritm.sys_id, "openHire");
try {
var myOHF = new GlideRecord('u_ob_openhirefulfillment');
var RITMSID = ritm.sys_id;
myOHF.addQuery('u_fksc_req_item_request', RITMSID);
myOHF.query();
if (myOHF.next()) {
gs.log("last error msg; " + myOHF.getLastErrorMessage());
gs.log('OHF in email scripting is ' + myOHF.getDisplayValue(), "openHire");
gs.log("First name: " + myOHF.u_first_name); // verify we got the test record
} else {gs.log('query returned nothing for ' + ritm.getDisplayName()); }
} catch (err) {gs.log('query returned nothing for ' + ritm.getDisplayName()); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 01:45 PM
You don't need to pull the reference record again. You can simply dot.walk to the values, for example, OHF.u_fksc_req_item_request.getDisplayValue() or if its a specific field then OHF.u_fksc_req_item_request.field_1;
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 01:48 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 04:18 PM
There are few syntax errors. Try this
var OHF = new GlideRecord('u_ob_openhirefulfillment');
var lm = "OH_test_rig_3";
OHF.get("cbe0a2be2b7c664091d580a119da1511"); // hard coding for testing only
gs.log("First name: " + OHF.u_first_name); // verify we got the test record
// get RITM
var ritm = OHF.u_fksc_req_item_request.getRefRecord();
gs.log("get returned RITM: " + ritm.number);
gs.log('OHF request field: ' + OHF.u_fksc_req_item_request, "openHire");
gs.log('ritm value: ' + ritm.sys_id, "openHire");
try {
var myOHF = new GlideRecord('u_ob_openhirefulfillment');
var RITMSID = ritm.sys_id;
myOHF.addQuery('u_fksc_req_item_request', RITMSID);
myOHF.query();
if (myOHF.next()) {
gs.log("last error msg; " + myOHF.getLastErrorMessage());
gs.log('OHF in email scripting is ' + myOHF.getDisplayValue(), "openHire");
gs.log("First name: " + myOHF.u_first_name); // verify we got the test record
} else {gs.log('query returned nothing for ' + ritm.getDisplayName()); }
} catch (err) {gs.log('query returned nothing for ' + ritm.getDisplayName()); }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2016 01:48 PM
What are you trying to achieve here? What is your use case