We have to populate short description based upon the Check box variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 10:04 PM
Hi Experts,
We have to populate short description based upon the Check box variables. For eg. we have a catalog item for choosing assets which has options as check box latop, macbook, pc. if the select pc in the task short description it should appear as Asset- laptop if the user selects macbook the task short description should have Asset-macbook. How to acheive this ?
Regards,
Sofi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2023 10:14 PM
Hello @Sofiya Perumal
You can write below script in create catalog task activity:
var short_desc = "Asset";
if(current.variables.laptop == "true"){
short_desc += " - Laptop";
}
else if(current.variables.macbook== "true"){
short_desc += " - Macbook";
}
else if(current.variables.pc== "true"){
short_desc += " - PC";
}
task.short_description = short_desc;
Note: replace variables names as per your configuration in bolded place.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2023 02:27 AM
HI @Sofiya Perumal ,
I trust you are doing great.
you can follow these steps:
- Create a new catalog item or open the existing one for choosing assets.
- Add checkbox variables for laptop, macbook, and pc options to the catalog item form.
- Edit the associated catalog task form to include the short description field.
- Write a script to update the short description based on the selected checkbox variables.
Here's an example script that you can use in the "Client Script" section of the catalog task form:
function onChangeCheckbox() {
var shortDesc = 'Asset-';
// Get the values of the checkbox variables
var laptopChecked = g_form.getValue('laptop');
var macbookChecked = g_form.getValue('macbook');
var pcChecked = g_form.getValue('pc');
// Check which checkboxes are selected and append their names to the short description
if (laptopChecked)
shortDesc += 'laptop';
else if (macbookChecked)
shortDesc += 'macbook';
else if (pcChecked)
shortDesc += 'pc';
// Update the short description field on the catalog task form
g_form.setValue('short_description', shortDesc);
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi