Add field to request summary page- Client Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 02:30 PM
Hi everyone,
Can I please get some help with a client script that will change the value of the "short description" to the request_name variable on the portal? I attached a couple screenshots to display what I 'm trying to acheive. (Order guide has the variable request_name that I want to replace the short description on the order guide summary)
I've tried to edit the widget with no luck and was hoping to do this in a client script or script. I'm open to better ideas if anyone has any suggestions.
Thanks so much for any feedback you have!
I believe this should be set as the following:
on change type
sc_cat_item table
field name: short description
script I tried with no luck
function onLoad() {
var requestName = g_form.getValue('request_nameVariable');
if (requestName && g_form.getValue('short_description') == 'Test Catalog Item short description') {
g_form.setValue('short_description', requestName);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 09:48 AM
Hi @Gemma4,
The screenshot above shows the 'sc_cat_item' table, I do not see a field there named 'request_name'. I do see that the first screenshot you posted is for a "Variable" record (item_option_new table). I believe that is a Variable you have defined for the "Test Catalog Item" 'Catalog Item'. The "Variables" (item_option_new) table has a field named 'cat_item' that links record there to a 'sc_cat_item' record, where 'short_description' exists.
Your first post states "Can I please get some help with a client script that will change the value of the "short description" to the request_name variable on the portal?"
Seems what you are trying to do is beyond my expertise. I have only used the Service Catalog feature, and I have not done any customizations except to create a few records in either table.
Hopefully, Community members who do have experience will post here on what you are trying to achieve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 07:12 AM
Hi @Gemma4,
there is no alert messages because you have that line commented-out. Try:
function onLoad() {
var requestName = g_form.getValue('request_name');
var shortDescription = g_form.getValue('short_description');
alert('requuestName = ' + requestName + ', short_description = ' + shortDescription +'.');
if (requestName && (shortDescription == 'Test Catalog Item short description')) {
g_form.setValue('short_description', requestName);
}
}