- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 04:26 PM
I have an Order Guide with a Rule Base that's forwarding 3 different variable values to a Catalog Item. I've written an onLoad Catalog Client Script in one of the Catalog Items with the intent of concatenating the value in each of those Catalog Item variables into a variable called purchase_title. However, as you can probably expect, the variable I'm attempting to write to with the Catalog Client Script doesn't get populated by the script. I've been stubbornly banging my head against this one for a few hours and its become obvious to me that I'm missing a vital piece to the puzzle. I've read a few articles in the Community that suggest I'm on the right track, but I'm out of gas. Any assistance would be appreciated.
function onLoad() {
//Type appropriate comment here, and begin script below
var firstName = g_form_getValue('ob_pn_first_name');
var lastName = g_form_getValue('ob_pn_last_name');
var startDate = g_form_getValue('ob_pn_start_date');
if (firstName != ""){
var purTitle = ('Onboarding-New Computer Purchase: ' + firstName + ' ' + lastName + '-' + startDate);
// g_form_addInfoMessage('The Purchase Short Description has been auto-filled for this Onboarding PurchaseNow Request');
g_form.setValue('purchase_title',purTitle);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 06:59 PM
Hello Paul,
You haven't missed any piece of the puzzle, but made a very silly mistake. Instead of g_form.getValue(), you have used g_form_getValue().
Correct your mistake and you are good to go.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 06:41 PM
so ob_pn_first_name, ob_pn_last_name, and ob_pn_start_date are variables on your catalog item?
are the values being stored in the vars you declared?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 07:23 PM
Nathan... Yes and yes.
~Paul
On Jan 17, 2018 6:41 PM, "nategiere" <community-no-reply@servicenow.com>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 08:03 PM
Did you try solution provided by Eash Verma? g_form.getValue is the correct format.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 06:59 PM
Hello Paul,
You haven't missed any piece of the puzzle, but made a very silly mistake. Instead of g_form.getValue(), you have used g_form_getValue().
Correct your mistake and you are good to go.
Thanks.