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 get the URL and view in View rule

RudhraKAM
Tera Guru

Hello there 

 

I have a requirement when a ritm is opened in portal it should show a view and if it is opened in native view it should show other view , 

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

workaround would be , identify the difference between your portal url and native UI url then you can use indexOf() here to execute if else block

 

eg:

 

if(url.toString().indexOf('<identify for url parameter which does not exist on portal>') == -1){

//do your activity for portal
}

else{

// do something for non portal 
}

View solution in original post

4 REPLIES 4

Ruhi Jibhyenka1
Mega Guru

Hi,

Check out below link-

https://community.servicenow.com/community?id=community_question&sys_id=67240729dbd8dbc01dcaf3231f961942

Mark correct if my answer has solved your issue and or/helpful if my response is worthy.

Thanks,

Ruhi.

Thanks Ruhi 

can we use 

var loc = this.location.href; in view rules?

 

No, it only works in client side. 

Harsh Vardhan
Giga Patron

workaround would be , identify the difference between your portal url and native UI url then you can use indexOf() here to execute if else block

 

eg:

 

if(url.toString().indexOf('<identify for url parameter which does not exist on portal>') == -1){

//do your activity for portal
}

else{

// do something for non portal 
}