Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Lookup Utilities Functionality

Katelyn1
Kilo Expert

I've been trying to create a topic to update the street address of a user from my HR Profile User table. I manually added a user (Abraham Lincoln) because the table (sn_hr_core_profile) was empty to start. Now with the topic, I am trying to figure out how to use Lookup Utility to change their street address in the record, but I have been without luck since there is very little documentation on this functionality and the Using GlideRecords documentation seems to not be working for me. This is what I have:

find_real_file.png 

And this is the code I have for the Lookup Utility script:

(function execute(table) {
    var profile = new GlideRecord(table);
    profile.query();
    profile.addQuery('first_name', 'Abraham');
    while(profile.next()){
        profile.address = vaInputs.new_street.getValue();
        profile.update();
    }
    return profile;
})(table)
1 ACCEPTED SOLUTION
10 REPLIES 10

Mike Patel
Tera Sage

you need below; query comes after addQuery

var profile = new GlideRecord(table);

profile.addQuery('first_name', 'Abraham');

profile.query();

Thanks! It unfortunately still brings up an error after I enter a street address. 

Can you share the documentation you are referring to setup this?