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 know about Portal ID or URL when Record Producer is submitted

CA5
Tera Contributor

Is there any method by which can identify from which Service Portal [IT or HR], record producer is submitted? 

 

 

5 REPLIES 5

Peter Bodelier
Giga Sage

Hi @CA5,

 

What exactly is your use case behind this?


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

 

 

Use Case - If RP is submitted from IT Service Portal then redirects to IT SP or if RP is submitted from ESC or Mobile app Portal then redirects to ESC or Mobile Aapp Portal

Hi @CA5@Nivedita Paliwa,

 

Maybe not the prettiest solution, but should work:

Create a (hidden) variable 'portal_id'.

Create a catalog client script: onLoad:

function onLoad() {
	g_form.setValue('portal_id', getPortalID());

  function getPortalID() {  
    var regexS = "[/][A-z]*[?]";  
    var regex = new RegExp(regexS);  
    var results = regex.exec(top.location);  
    if (results == null) {  
        return "";  
    } else {  
		var answer = results.toString();
        return  answer.substring(1,answer.length-1);
    }  
}
}

 

You could then do the redirection based on the variable.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.