- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 06:36 AM
Hi Team,
We have a requirement wherein if we select subcategory in case form, there is a a choice field called "Customer Requested", which should autopopulate if there is a single value based on the Sub category and should not be maually selected.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 06:49 AM
Hi @Community Alums ,
You need to create a onChange client script
onChange variable - subcategory
Client script: please double check the backend name of the variable and change accordingly
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var custReq = g_form.getElement('u_customer_requested');
if (custReq.options.length == 1) {
g_form.setValue('u_customer_requested', custReq.options[0].value);
}
}
If my answer has helped with your question, please mark it as correct and helpful
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 06:49 AM
Hi @Community Alums ,
You need to create a onChange client script
onChange variable - subcategory
Client script: please double check the backend name of the variable and change accordingly
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var custReq = g_form.getElement('u_customer_requested');
if (custReq.options.length == 1) {
g_form.setValue('u_customer_requested', custReq.options[0].value);
}
}
If my answer has helped with your question, please mark it as correct and helpful
Thanks!