Need a help in Ui builder for service Operation workspace

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Goal: Configure "On Hold" UI Action in Service Operations Workspace
✅ Trigger Condition
- User Role: Fulfiller
- Workspace: Service Operations Workspace
- Incident State: In Progress
- UI Element: Show a button labeled "On Hold"
✅ Action on Button Click
- Update the Incident State to On Hold
- Open a modal dialog box
🧾 Modal Dialog Requirements
1. Mandatory Field
- On Hold Reason (Dropdown)
- Values:
- Awaiting Customer
- Awaiting Change
- Awaiting Problem
- Awaiting Vendor
- This field must be mandatory (show * asterisk)
- Values:
2. Conditional Mandatory Fields Based on Selection
On Hold Reason Mandatory Field to Show in Modal
Awaiting Customer | Additional Comments |
Awaiting Change | Change Request |
Awaiting Problem | Problem |
Awaiting Vendor | Work Notes |
Each of these fields should:
- Be visible only when the corresponding reason is selected
- Be mandatory (show *) when visible
I have added a form button as on hold and added a modal popup and have created one dropdown as on hold reason with values like awaitng change,problem etc how i should make it as mandatory and depending on its selection i should show other fields how actually i should achieve it?
@Ankur Bawiskar any help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
are you using g_modal API?
share what script you have created so far?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Ankur,
This is the same functionality we need as something simillar like out of box is service operation workspace for problem we have a Asses(Declarative action) also for incident records we have one Resolve(declarative action simillar) but i am not able to find the things to do something simillar i need to know how to do that.
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
Try this code..
function onClick(g_form) {
var reasonFields = [{
type: 'choice',
name: 'on_hold_reason',
label: 'On Hold Reason',
choices: [{
displayValue: 'Awaiting Customer',
value: '1'
},
{
displayValue: 'Awaiting Change',
value: '5'
},
{
displayValue: 'Awaiting Problem',
value: '3'
},
{
displayValue: 'Awaiting Vendor',
value: '4'
}
],
mandatory: true
}];
g_modal.showFields({
title: "Put Incident On Hold",
fields: reasonFields,
size: 'lg'
}).then(function(reasonValues) {
var selectedReason = reasonValues.updatedFields[0].value;
var conditionalFields = [];
if (selectedReason === '1') {
conditionalFields.push({
type: 'string',
name: 'additional_comments',
label: 'Additional Comments',
mandatory: true,
size: 'lg'
});
} else if (selectedReason === '5') {
conditionalFields.push({
type: 'reference',
name: 'rfc',
label: 'Change Request',
mandatory: true,
reference: 'change_request',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue(),
value: g_form.getValue('rfc'),
displayValue: g_form.getDisplayValue('rfc'),
size: 'lg'
});
} else if (selectedReason === '3') {
conditionalFields.push({
type: 'reference',
name: 'problem_id',
label: 'Problem',
mandatory: true,
reference: 'problem',
referringTable: 'incident',
referringRecordId: g_form.getUniqueValue(),
value: g_form.getValue('problem_id'),
displayValue: g_form.getDisplayValue('problem_id'),
size: 'lg'
});
} else if (selectedReason === '4') {
conditionalFields.push({
type: 'string',
name: 'work_notes',
label: 'Work Notes',
mandatory: true,
size: 'lg'
});
}
g_modal.showFields({
title: "Provide Details",
fields: conditionalFields,
size: 'lg'
}).then(function(detailValues) {
g_form.setValue('state', '3');
g_form.setValue('hold_reason', selectedReason);
if (selectedReason === '1') {
g_form.setValue('comments', detailValues.updatedFields[0].value);
} else if (selectedReason === '5') {
g_form.setValue('rfc', detailValues.updatedFields[0].value);
} else if (selectedReason === '3') {
g_form.setValue('problem_id', detailValues.updatedFields[0].value);
} else if (selectedReason === '4') {
g_form.setValue('work_notes', detailValues.updatedFields[0].value);
}
g_form.save();
});
});
}