Action framework - Configure action group - Visibility script

ChrisPy
Tera Expert

Hi all,

 

I'm trying to figure out what code can be used in the Visibility script for Action groups:

Configure Action Groups 

 

The docs only mentions a small piece of code :

answer = context.state.toString() === 'requested';

I've never come across the 'context' object and unfortunately cannot find any documentation on this.

What are my options here?

I can use the above code to show/hide the UI action button on the My Tasks form for certain states.
But I obviously also want to check if the current user is the logged in user.
So should I check g_user against context.opened_by or is context.user a thing?

 

Please note the also as Action visibility can be set to Visible to self which excludes the state check.

1 ACCEPTED SOLUTION

ChrisPy
Tera Expert

So after some testing it seems GlideSystem can be accessed and the context-object is similar to the content of a gliderecord containing each field on the sourcetable as an object.
So getting the field like context.opened_by.toString() works fine and comparing it to gs.getUserID() fulfills my need here.

Hope someone else will find this post useful! 🙂

View solution in original post

1 REPLY 1

ChrisPy
Tera Expert

So after some testing it seems GlideSystem can be accessed and the context-object is similar to the content of a gliderecord containing each field on the sourcetable as an object.
So getting the field like context.opened_by.toString() works fine and comparing it to gs.getUserID() fulfills my need here.

Hope someone else will find this post useful! 🙂