- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 08:01 AM
Need some help please…
I have a Service Catalog Item for a Company Name Change
1 variable is a Reference field to the Old Company Name [core_company] named: old_name
1 variable is a Single Line Text field named: old_name_hist
I need to Copy the value of the Reference field ‘old_name’ to a String to put it in the Single Line Text field ‘old_name_hist’
This is so when the old company name is renamed in ServiceNow, the Single Line Text field variable for the associated SCTASKs retain the historical data of the old Company Name, so multiple teams can process the request and know the old Company Name.
I have a Service Catalog Client Script for this purpose but it is not working:
function onChange(control, oldValue, newValue, isLoading)
{
if (isLoading)
{
return;
}
var oldName = g_form.getDisplayBox('old_name').value;
g_form.setValue('old_name_hist', oldName);
}
Help would be greatly appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 08:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 08:25 AM
Hi @Su522 ,
Once try this.
var oldName = g_form.getDisplayValue('old_name');
g_form.setValue('old_name_hist', oldName);
Shakeel Shaik 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 08:18 AM
Try getDisplayValue instead to getDisplayBox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2022 08:25 AM
Hi @Su522 ,
Once try this.
var oldName = g_form.getDisplayValue('old_name');
g_form.setValue('old_name_hist', oldName);
Shakeel Shaik 🙂