How can I change EnabledScript asynchronously? I need this, because EnabledScript depended in my case on some item fields, but I can read them only in async way:
var itemId = SP.ListOperation.Selection.getSelectedItems()[0].id;
var clientContext = SP.ClientContext.get_current();
var list = clientContext.get_web().get_lists().getById(listId);
this.listItem = list.getItemById(itemId);
clientContext.load(this.listItem, 'MyPropertyForDisabling');
clientContext.executeQueryAsync(Function.createDelegate(this, onQuerySucceeded),
Function.createDelegate(this, onQueryFailed));
and what I need to do than query's extract data?
function onQuerySucceeded() {
//change EnabledScript status
}
Thanks!