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.

Open RITM in portal from native view

RunsumS
Tera Contributor

Hi

 

I have a requirement to open RITM on portal if i client on Open In Portal button.

 

Please help.

1 ACCEPTED SOLUTION

Runjay Patel
Giga Sage

Hi @RunsumS ,

 

You can create UI action "sc_req_item" table like below.

RunjayPatel_0-1731047518926.png

RunjayPatel_1-1731047547513.png

 

Code:

 

function openPortal() {
    var ga = new GlideAjax('getBaseURL');
    ga.addParam('sysparm_name', 'BaseURL');
    ga.getXML(ServiceNowBaseURL);

    function ServiceNowBaseURL(response) {
        var baseUrl = response.responseXML.documentElement.getAttribute("answer");
    }
	
    var url = baseUrl + 'sp?id=ticket&table=sc_req_item&sys_id=' + g_form.getUniqueValue();
    g_navigation.open(url, '_blank');
}

 

 

In Script include write code like below

 

var getBaseURL= Class.create();
UserUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    BaseURL: function() {
        
        return gs.getProperty('glide.servlet.uri');
    },
    type: 'getBaseURL'
});

 

 

Refer GlideAjax in details here: https://servicenowwithrunjay.com/glideajax-in-servicenow/ 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

5 REPLIES 5

Hi @Runjay Patel ,

 

It worked, Thank you.