Enable a Custom Action button depending on current user

373 views Asked by At

In essense I am trying to run a Javascript synchronized in order to make a query on a Sharepoint task list item to determine whether the current user is the same as the task asigned user. If 'true' this should enable the custom action button. But so far only being able to run the code asynchronized makes it fail, as the queries('Task Assigned To' & 'Current User') are not completed before the code returns the comparison (boolean) of the two users :-( Help anyone??

1

There are 1 answers

0
Oleg Savelyev On

If your custom action is ribbon button after computing the value for EnabledScript cache it to some variable and call RefreshCommandUI(). This will cause second call to EnabledScript and here you can return cached value. Moreover you need to write your own state machine for that computing to avoid using expired non valid value. Real hard may appear if you have 2+ of such custom actions.