Alternative to the GlideModal setPreference() method in Workspaces ... ?

Jake McC
Tera Contributor

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!

12 REPLIES 12

@Jake McC 

Isn't the same UI page getting rendered in native and workspace both?

If yes then the logic should work fine at both places

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

The UI page is yes, are you able to use GlideModal.setPreference() within the UI Page itself? If so I could just do it there (still a little bit sure about where to do it though ...), Thanks!

@Jake McC 

you want to pass the static text from workspace client script to UI page?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Give u example for it:

 

UI page code:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide">
<input type='hidden' id="case_id" value="${RP.getParameterValue('sysparm_case_sysid')}" />

    <div class="container">
        <h4>Select the attachments which you want to copy to this escalation</h4>
        <div id="attachment-list" class="list-group"></div>

        <div style="margin-top:20px; text-align:right">
            <button class="btn btn-default" onclick="cancelDialog()">Cancel</button>
            <button class="btn btn-primary" onclick="processSelection()">Confirm</button>
        </div>
    </div>

    <script>
       
        var caseSysId = gel('case_id').value;
 
UI action:
function showAttachmentDialog() {
    var url_1 = '/sn_customerservice_SelectAttachments.do?sysparm_case_sysid='+g_form.getValue('source_record');
        g_modal.showFrame({
        url: url_1,
        title: 'Select Attachments',
        size: 'lg',
        height: 500
    });
    }

Ankur Bawiskar
Tera Patron
Tera Patron

@Jake McC 

are you calling some UI page from g_modal.showFrame()?

If yes then you can include the parameter and then grab it in the UI page.

you should have multiple OOTB UI actions doing this.

AnkurBawiskar_0-1754039390706.png

AnkurBawiskar_1-1754039475480.png

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader