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

Dr Atul G- LNG
Tera Patron
Tera Patron

Where this button your adding? 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Gangadhar Ravi
Giga Sage
Giga Sage

@RunsumS You can try UI action with below script.

 

var ritmSysId = current.sys_id;
var portalUrl = '/sp?id=sc_request_item&sys_id=' + ritmSysId;
action.setRedirectURL(portalUrl);

Please mark my answer correct and helpful if this works for you.

Hi @Gangadhar Ravi ,

 

It didnt work.

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

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