Auto-Populated Field Display Values Don't Transfer to RITM

appstorm
Tera Contributor

When auto-populated one reference field with another (both from the sys_user table), the DisplayValue for the auto-populated field doesn't transfer from the Catalog Item to the RITM.  I am submitting the request as a local Admin.  So, security permissions shouldn't be an issue (I have verified there are no ACL's preventing this).

1 ACCEPTED SOLUTION

Hi @appstorm,

 

if c_num is a variable on your catalog item. Please try accessing it with:

ritm.variables.c_num

Similarly, if student_information is a variable, try:

ritm.variables.student_information

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

View solution in original post

9 REPLIES 9

appstorm
Tera Contributor

Thanks for the response!  I am attempting to transfer - via script in workflow editor.

(function() {
    var ritm = current; // The current RITM record

    // Ensure that c_num is populated (this field will be used to match u_employee_number)
    var cNum = ritm.c_num;
    if (cNum) {
        var studentRecord = new GlideRecord('sn_uni_req_larf_banner_student');
        
        // Query the sn_uni_req_larf_banner_student table to find the record where u_employee_number matches c_num
        studentRecord.addQuery('u_employee_number', cNum);
        studentRecord.query();

        // Check if a matching record is found
        if (studentRecord.next()) {
            gs.info('Found matching student record where u_employee_number = ' + cNum);

            // Populate the student_information field on the RITM with the sys_id of the matching student record
            ritm.student_information = studentRecord.sys_id;

            // Update the RITM record
            ritm.update();
            gs.info('Populated student_information on RITM with sys_id: ' + studentRecord.sys_id);
        } else {
            gs.info('No matching student record found for c_num: ' + cNum);
        }
    } else {
        gs.info('c_num is not set on RITM: ' + ritm.sys_id);
    }
})();

Hi @appstorm,

 

if c_num is a variable on your catalog item. Please try accessing it with:

ritm.variables.c_num

Similarly, if student_information is a variable, try:

ritm.variables.student_information

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

appstorm
Tera Contributor

ritm.variables.c_num solved it!  Thanks so much!

@appstorm 

if your u_employee_number holds employee number of user then update as this

    var cNum = current.variables.student_information.employee_number;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

katelyno
Tera Contributor

were you able to find th question..?