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 current view in client-side script

bonsai
Mega Sage

We use "RP.getViewName()" to get a view in a server-side script, but how do we get the view name in a client-side script?

2 ACCEPTED SOLUTIONS

Harish KM
Kilo Patron
Kilo Patron

Hi @bonsai you can use the below script to check view name in client script

 var view = getView();
 alert("test"+view);
if(view == 'ess')
{
alert("inside");
}
Regards
Harish

View solution in original post

Unique45
Mega Sage
Mega Sage

Hello @bonsai ,

Using getView() method you can get view name in the client side.

 

 

Please mark correct/helpful if this helps you!

View solution in original post

8 REPLIES 8

no you can use g_form as well both methods are client side API's

Regards
Harish

Unique45
Mega Sage
Mega Sage

Hello @bonsai ,

Using getView() method you can get view name in the client side.

 

 

Please mark correct/helpful if this helps you!

Ankur Bawiskar
Tera Patron
Tera Patron

@bonsai 

what's your business requirement here?

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

As I've posted in other questions, I wanted to implement record copying with a client-side UI action.
I wanted the form screen after copying to inherit the view name before copying.
Somehow it worked.