Formatting issue with checkbox variables in HR Case description using createCaseFromProducer()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Saturday - last edited Sunday
I’m working on an HR Application Access Request Record Producer that uses sn_hr_core.hr_ServicesUtil(current, gs).createCaseFromProducer() to create HR cases. Earlier, the environments (Implementation, QA, Production, Sandbox) were handled through a single select box, so the description appeared neatly like “Which environment do you need access to?: QA.” To make it more user-friendly, I switched to multiple checkboxes, but the HR Utils now adds them as “Implementation = true” or “Sandbox = false” in the case description.
Since ServiceNow doesn’t support multi-choice fields in Service catalog/Record producer, and label-type variables (used to display the question) aren’t processed by the
HR Utils, I’m unable to format this cleanly. Overriding the description after the Utils call doesn’t help as it gets overwritten during case creation. I’d like to avoid creating a custom table just for this — has anyone found a supported way to customize or reformat the HR case description for checkbox variables while still using createCaseFromProducer()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
the only way is let the OOTB script include and function set the description.
you can use before insert BR to perform string manipulation on that description field.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I would hate a post processing script for this and client is not ready to accept either.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi,
Assuming I've understood your requirement you'd like the following to occur
Record Producer form
Resulting HR case
If so, you can use the provided extension point to create a processing script that can conditionally apply to your HR services.
- ServiceNow provide an extension point 'sn_hr_core.HRPopulateCaseFields' OOTB which is called at the end of processing
- You can implement your own script include that implements both 'handles' and 'setFields' functions which determine whether to apply logic, and what updates to make
- Manually change the description within your own script include
Note, the following is working-pseudo code and isn't intended to be copy and pasted
var HRUtilMutliItem = Class.create();
HRUtilMutliItem.prototype = {
initialize: function() {},
handles: function(serviceGR) {
//serviceGR points to a sn_hr_core_service record
if (serviceGR.getUniqueValue() === '945bd3c88334be105e43c4a6feaad38c') {
return true;
}
return false;
},
setFields: function(serviceGR, caseGR) {
cleansedQuestions = []
//Get the questions
var rpQuestions = new sn_sc.CatItem(serviceGR.getValue('producer')).getVariables(false);
//Loop over the questions, refer to hr_ServicesUtil on how to do this properly
//the following code is pseudo code for testing
rpQuestions.forEach(function(question) {
if (!question.hasOwnProperty('containerType'))
cleansedQuestions.push({
name: question.name,
label: question.label,
type: question.type,
displayValue: producer.getDisplayValue(question.name),
level: "1"
});
//If we find a checkbox container, handle it differently
if (question.hasOwnProperty('containerType') && question.hasOwnProperty('children')) {
var items = question.children.map(function(el){
if(producer.getValue(el.name) == 'true'){
return el.label;
}
})
cleansedQuestions.push({
name: question.name,
label: question.label,
type: question.type,
displayValue: items.join(", ")
});
}
});
var filledValue = '';
cleansedQuestions.forEach(function(question){
filledValue += question.label + ': ' + question.displayValue + '\n\n';
})
caseGR.setValue('description', filledValue);
},
type: 'HRUtilMutliItem'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
We are coming to the same point that we would need a post processing scripting . ServiceNow pushing in actually multiple choice selection would solve the problem forever rather pushing developers to use reference to custom table everytime and in this case a custom table for just 4 options doesn't makes sense at all.