Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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

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

PPPanchal
Mega Sage

Hello @bonsai ,

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

 

 

Please mark correct/helpful if this helps you!
Thanks,
Pratiksha
✨ServiceNow Rising Start 2025

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

PPPanchal
Mega Sage

Hello @bonsai ,

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

 

 

Please mark correct/helpful if this helps you!
Thanks,
Pratiksha
✨ServiceNow Rising Start 2025

Ankur Bawiskar
Tera Patron

@bonsai 

what's your business requirement here?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x 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.