How to Populate the select box label name which is selected in the service request using workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 06:51 AM
So in the short description of the RITM i am trying to populate the values which have been selected but unable to populate as shown in attached screenshot.
Used the below script to populate the value but was not bale to populate the Short Description.
// Ensure that current and current.cat_item are defined before proceeding
if (current && current.cat_item) {
var add = current.u_add;
var modify = current.u_mod;
var remove = current.u_rem;
var dele = current.u_del;
var selectedVariable = [];
if (add === true) {
selectedVariable.push('u_add');
}
if (modify === true) {
selectedVariable.push('u_mod');
}
if (remove === true) {
selectedVariable.push('u_rem');
}
if (dele === true) {
selectedVariable.push('u_del');
}
// Concatenate the selected variables and update short_description
current.short_description = current.cat_item.name + " + update: " + selectedVariable.join(', ');
} else {
// Handle the case when current or current.cat_item is undefined
current.short_description = "Error: cat_item or current is undefined.";
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 07:52 AM
And one more thing that i have used checkbox as a variable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 07:53 AM
Are u_add, u_mod, etc variables? If so, you have to access them via current.variables.u_add, current.variables.u_mod, etc.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 08:41 AM
// Ensure that current and current.cat_item are defined before proceeding
if (current && current.cat_item) {
var add = current.variables.u_add;
var modify = current.variables.u_mod;
var remove = current.variables.u_rem;
var dele = current.variables.u_del;
var selectedVariable = [];
if (add === true) {
selectedVariable.push('u_add');
}
if (modify === true) {
selectedVariable.push('u_mod');
}
if (remove === true) {
selectedVariable.push('u_rem');
}
if (dele === true) {
selectedVariable.push('u_del');
}
// Concatenate the selected variables and update short_description
current.short_description = current.cat_item.name + " + update: " + selectedVariable.join(', ');
} else {
// Handle the case when current or current.cat_item is undefined
current.short_description = "Error: cat_item or current is undefined.";
}
I replicated the same as instructed but still same issue is occurring.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 08:44 AM
Can you attempt to add some log statements and verify those variables are pulling back values?
Also try this:
// Ensure that current and current.cat_item are defined before proceeding
if (current && current.cat_item) {
var add = current.variables.u_add;
var modify = current.variables.u_mod;
var remove = current.variables.u_rem;
var dele = current.variables.u_del;
var selectedVariable = [];
if (add == true) {
selectedVariable.push('u_add');
}
if (modify == true) {
selectedVariable.push('u_mod');
}
if (remove == true) {
selectedVariable.push('u_rem');
}
if (dele === true) {
selectedVariable.push('u_del');
}
// Concatenate the selected variables and update short_description
current.short_description = current.cat_item.name + " + update: " + selectedVariable.join(', ');
} else {
// Handle the case when current or current.cat_item is undefined
current.short_description = "Error: cat_item or current is undefined.";
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 08:50 AM
// Ensure that current and current.cat_item are defined before proceeding
if (current && current.cat_item) {
var add = current.variables.u_add;
var modify = current.variables.u_mod;
var remove = current.variables.u_rem;
var dele = current.variables.u_del;
var selectedVariable = [];
if (add == true) {
selectedVariable.push('u_add');
}
if (modify == true) {
selectedVariable.push('u_mod');
}
if (remove == true) {
selectedVariable.push('u_rem');
}
if (dele == true) {
selectedVariable.push('u_del');
}
// Concatenate the selected variables and update short_description
current.short_description = current.cat_item.name + " + update: " + selectedVariable.join(', ');
} else {
// Handle the case when current or current.cat_item is undefined
current.short_description = "Error: cat_item or current is undefined.";
}
Now in the output only "Cat Item Name + update: " this much is visible and the value which is selected is not populating