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 View Name on Server side UI ACtion

hima6
Mega Expert

Hello,

i want to get the view name on UI action(Server Side). is there any function for that ?

Regards,

Hima Pallela.

1 ACCEPTED SOLUTION

Abhinandan Pati
Giga Guru

Hi Hima,



Try below code snippet.



var view_name='';


if (gs.getSession().isInteractive()) {


      var map = gs.action.getGlideURI().getMap();


      if (map.get('sysparm_view') != null) {


      view_name= map.get('sysparm_view').toString();


      }


  }


gs.log('View: '+view_name);



Thanks,


Abhinandan


View solution in original post

9 REPLIES 9

Kushagra Mehrot
Kilo Guru

Also what you can try:



- create a field which is hidden on the form ( let's say 'u_view')


- use this script to populate its value



    g_form.setValue('u_view', getView());  



- in your UI Action use it as 'current.u_view'


Abhinandan Pati
Giga Guru

Hi Hima,



Try below code snippet.



var view_name='';


if (gs.getSession().isInteractive()) {


      var map = gs.action.getGlideURI().getMap();


      if (map.get('sysparm_view') != null) {


      view_name= map.get('sysparm_view').toString();


      }


  }


gs.log('View: '+view_name);



Thanks,


Abhinandan


Hi,

 

Can you please help me implementing same for a ui action condition. I want to add a specific condition, which displays ui action for specific view?

 

Thanks