can anyone help me with the problem:
I have a list external items from my system and i add a custom button on a ribbon. My item has a state and depending on the state my button should be available or not. For ribbon custom actions(my button) availability is set by EnabledScript:
<CommandUIHandler Command="Sample.ButtonCommand.Command" CommandAction="javascript:HelloRibbon('{SiteUrl}')" EnabledScript="javascript:IsFirstEnabled('{SiteUrl}')" />
The problem is in EnabledScript I must have access to selected item fields. I can do that so:
var context = SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle(listName);
var task = list.getItemById(_spGetQueryParam('id'));
clientContext.load(....);
clientContext.executeQueryAsync(...);
But that is ASYNC item retrieving but EnabledScript is synchronous call. How i can access item fields for setting button availability in EnabledScript without async calling?