Get to know about Portal ID or URL

CA5
Tera Contributor

Is there any method by which can identify from which Service Portal [IT or HR] , record producer or catalog item form is submitted?    @Ankur Bawiskar 

 

6 REPLIES 6

@CA5 

you can access the hidden variable value inside record producer script and do the redirection

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

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.