Alternative to the GlideModal setPreference() method in Workspaces ... ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 01:51 AM
Hello all,
Bit of an issue here - I'm trying to modify a copied version of the OOTB Incident UI Action "Propose Major Incident".
The ask is for one of the string field which pop up in the GlideModal, "Business Impact", to prepopulate with a series of text prompts for the end user. In Core UI this is fine; just edit the g_form.setPreference() to include the new string, fine.
In Workspaces I'm having more trouble however ... As far as I'm aware you can't use GlideModal in Workspaces, and instead I'm having to use g_modal ... The problem being that in the documentation, in g_modal.openFrame() I can't see anything resembling the setPreference() method ... Does anyone have any ideas as to how I could resolve this?
Many thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 01:53 AM
you can set parameters in URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 02:04 AM
Thanks a lot Jackie, so if I want to prepopulate the business_impact field in this OOTB example with for example "hello world", how would i do this please?
function onClick(g_form) {
function proposeMIC(data) {
var workNotes = data.msg + "\n" + data.workNotes;
var notes = g_form.getValue('work_notes') + ' ' + workNotes;
var bi = g_form.getValue('business_impact') + ' ' + data.businessImpact;
g_form.setValue('work_notes', notes.trim());
g_form.setValue('business_impact', bi.trim());
g_form.submit('sysverb_mim_propose');
}
function openPopup() {
var missingMandatoryFields = getMissingFields();
if (missingMandatoryFields.length > 0) {
g_form.save();
} else {
if (!g_form.getControl('work_notes')) {
getMessage('Cannot propose major incident as "Worknotes" is not visible', function(msg) {
g_form.addErrorMessage(msg);
});
return false;
}
var url = "/sn_major_inc_mgmt_mim_propose.do?sysparm_stack=no&sysparm_workspace=" + true;
getMessage('Propose Major Incident', function(msg) {
g_modal.showFrame({
title: msg,
url: url,
size: 'lg',
autoCloseOn: 'URL_CHANGED',
callback: function(ret, data) {
if (ret)
proposeMIC(data);
}
});
});
}
}
function filterForMissingMandatoryFields(field) {
if (g_form.isMandatory(field)) {
return !g_form.getValue(field);
}
}
function getMissingFields() {
var fieldList = g_form.getFieldNames();
//return only mandatory fields that have no value
return fieldList.filter(filterForMissingMandatoryFields);
}
openPopup();
}
Many thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 02:39 AM
I didn't get your actual requirement.
would be nice if you share screenshots, value to be passed from where and to where?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2025 03:18 AM - edited 08-01-2025 03:26 AM
Hi Ankur,
So this OOTB UI Action brings up a modal window with a string field "Business Impact", the ask is for some text to be prepopulated e.g.
"Did XYZ affect the impact? : "
"Did ABC affect the impact? : "
In Core UI this is easy, you can just use glidemodal.setpreference(), but in Workspace I'm having more difficulty, thanks!
Workspace - can't get it to work
Core UI - working fine
If you have access to an instance, this is the OOTB UI Page (it may be easier to link it this way rather than copy the OOTB code).
sys_ui_page.do?sys_id=3c02c808873013000e3dd61e36cb0b71&sysparm_record_target=sys_ui_page&sysparm_record_row=1&sysparm_record_rows=688&sysparm_record_list=ORDERBYDESCsys_updated_on