Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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 REPLY 1

kaushal_snow
Giga Sage

@vidhya_mouli ,

 

You can’t reliably call a portal page/widget from the backend UI because portal widgets run in a different engine (Angular/ServicePortal).......the platform UI dialog APIs (like GlideDialogWindow / GlideModal ) won’t reliably embed a portal widget so that it can interact with the form.......

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/