Client script to change a value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 08:35 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 08:43 AM
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-12-2023 10:36 AM
Thank you @Harish Bainsla unfortunately the script recommendation above didn't change the short description value. I added an info message to verify the script was running and it didn't populate. Attached are all the details of the script and variable in case there is something minor to change that I am missing. Thanks so much for all your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 03:37 AM
Your requirement :- change short_description with request_name;
Solution :-
Catalog client script
Type:- onSubmit
I hope this will solve your issue. Please mark it as helpful and accept the solution.
Regards,
Sombir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 11:53 AM
Hi @sombir5 and @Harish Bainsla
Unfortunately the scripts didn't make any changes. I appreciate the feedback but I thought another way to do this would be to edit the widget.
I tried to edit the code on this widget to display the request_name
variable from the catalog item. Attached is the variable request_name, the location of where I would like request_name visible and the code I'm trying to edit. Is this possible? I would like short description removed and replaced with the request_name variable.
<!-- {{::item.short_description}}-->
<!-- {{::item.short_description}}-->
<!-- More testing to deterine where short desc is------>
Line 155 item.short description,