The CreatorCon Call for Content is officially open! Get started here.

How to get the view name of the form by using script

mdsannavulla
Kilo Guru

Hi All,

For change table we are having two different views.So I want to get the view name by using script.

32 REPLIES 32

I tried this...its not going to view loop.I think view query is not right


i tried this



current.getEncodedQuery() ,-- this line gives me something like 'sys_is=XXXXXXXXXX'


so it will not fulfill the first condition even.




also i didnt get any value for view.


-Anurag

current.getEncodedQuery()   is giving output as ORDERBYDESCnumber


Business rules are general server side, while client scripts (and views) are client side. View name is meaningless to a business rule unless you deliberately capture it in a custom field so the BR can see it. Client side you can get the view name with: document.getElementById('sysparm_view').value



So I suppose you could add a custom field (and perhaps hide it), but copy the view name to it on submit.


santoshsahoonis
Kilo Guru

Hello,



Instead of using




view.startsWith("default")



use:



current.view.startsWith("default")




Hope this helps!