Current object not available in View Rule Script

Manish Vinayak1
Tera Guru

Hi Everyone,

I am trying to create a view rule using the Advanced Option.

The requirement is to set the rule if the person is member of the assignment group, or is having some particular role.

But, the 'current' object is not available in the view rule scope. There is no proper documentation / example available for view rule script.

Any suggestions, how it can be configured / any other object that can be used within view rule scope.

Thanks,

Manish

1 ACCEPTED SOLUTION

PerV
Kilo Sage

Manish, late answer, but since the tread has been alive this year, I would like to share my five cents on this.



I had the same challenge, realized that current.xx is not available for use in advanced mode (even though the fields can be chosen from the field chooser to the right of the script field ).



To get around this I used the condition builder to use a Dynamic Filter (built a new one), from that dynamic filter I called a script include that checks for groups that the user belongs to (or not, in my case), thereby directing to two different views, depending on whether the user should see certain fields or not. In my case I wanted to hide the Activity history completely, but give the user write rights to the work notes field.



//Per


View solution in original post

21 REPLIES 21

rajmasurkar
Giga Guru

Hi,



I might not have understood your question.


But to control the access of the view, you can use the conditions in 'view rules'.


On which table are you trying to write this rule?




Raj


The set of conditions which I need to specify is :


user should have role - role1


or


user should have role - role2


or


user should be a member of the current record's assignment group



So, to specify the set of above conditions, the condition field of view rule was not relevant.


That's why I was using 'Advanced' option of View Rule, which enables to write script to set the answer variable to the view's name.



(Currently on Geneva)


Capture.PNG


Attached is the screenshot.


acirovic1
Giga Expert

It's executed client side, that's why you don't have access to current object. Use client side objects and methods, like g_form and g_user instead.