How to call a portal page in the backend

vidhya_mouli
Tera Sage

I have a UI button with the following code in the client_script_v2

function onClick(g_form) {
    g_modal.showFrame({
        title: 'Select users to send the survey',
        url: '/nothemeportal?id=bulk_send_onboarding_survey&workspace=true&sys_id=' + g_form.getValue('request_item'),
        size: 'xl',
        height: 500,
        hasLoadingMessage: true,
        autoCloseOn: 'URL_CHANGED'
    });
}

 

Right now in the script i am calling a UI page which does exactly the same things the widget does in the portal page

function sendSurvey() {


    var dialog = new GlideDialogWindow('customer_onboarding_send_survey'); //Ui Page

    dialog.setTitle('Select Options');
    dialog.setWidth(400);
    dialog.setPreference('sysparm_reqItemSysID', g_form.getValue('request_item'));
    dialog.render();

}

 

I want to avoid the duplication and call the portal page in the backend too (not in the workspace but directly in the table - form). How can I do this?

 

1 ACCEPTED SOLUTION

Nawal Singh
Tera Guru

Hi @vidhya_mouli ,

I have did similar requirement in my pdi , please review below points-

 

1.  Created UI action Button- (In incident form)-  Checklist- for example and i'm calling Ui page using Glide Model here is the screenshot and code- 

NawalSingh_0-1765207984015.png

Example Code- 

function openShow(){
    var id= g_form.getUniqueValue();
	var dialog = new GlideModal("nksmwidgetcalling");
	dialog.setTitle('Audit test');
	dialog.setPreference("sysparam_id", id);
	dialog.setPreference("sysparam_page" ,"testpage");
	dialog.setBackdropStatic(true);
	dialog.render();

}

 

2. Ui Page screenshot and code-

 

NawalSingh_1-1765208085037.png

Code- 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j:set var="jvar_pref" value="${sysparam_id}" />
<j:set var="jvar_page" value="${sysparam_page}" />

 <div>
 <iframe id="test" src="ithub?id=testpage" width="550" height="550"></iframe>
 </div>
</j:jelly>

Here i'm calling portal page to show in my model when user clicked on the ui action button

 

3 Output screenshot- 

NawalSingh_2-1765208215925.png

 

In this way you can call portal pages and it;s widget in backend as per your requirement

 

Hope this will help you !!

 

If you found my response helpful, please mark it as helpful and accept it as the solution.

Thank you
Nawal Singh

 

 

 

View solution in original post

6 REPLIES 6

@vidhya_mouli 

in server side you can grab the URL and then extract the url parameter value

  var ritmSysId = $sp.getParameter('ritm_sys_id');

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Hi @vidhya_mouli ,

you are very close, here is the few points that you need to change-

1. pass the dynamic value from ui action(from i'm calling)

NawalSingh_0-1765266422601.png

Code example -

 

  var id= g_form.getUniqueValue(); // current value
    var dialog = new GlideModal("nksmwidgetcalling");
    dialog.setTitle('Audit test');
    dialog.setPreference("sysparm_id", id); // passing for widget URL load
    dialog.setPreference("sysparm_page" ,"testpage"); /// passing for widget URL load
    dialog.setBackdropStatic(true);
    dialog.render();
 
and In UI page get that Value using- sysparm_id and sysparm_page like below screenshot-
 
NawalSingh_1-1765266616544.png

 

<j:set var="jvar_page" value="${sysparm_page}" /> // Catch the value
<iframe id="test" src="ithub?id=${jvar_page}" width="550" height="550"></iframe>
 
using that jvar_page into SRC - ${jvar_page}
 
If you found my response helpful, please mark it as helpful and accept it as the solution.

Thank you
Nawal Singh