0

I created a button in an account form entity by ribbon workbench and then I tried to create a javascript code. When executed the code is just fetching the account id and showing that id in the alert and then I registered that file to that button by ribbon workbench action command. I wrote the below code, please let me know what is wrong with that.

I am expecting an alert box with that id, but nothing is happening

The code is below:

fetch = {

    fetchingacountid: function(executionContext){

        var formContext = Xrm.Page.context.getFormContext();
        var accountId = formContext.data.entity.getId();
        alert("The ID of the current account is: " + accountId);
    }

}

1 Answer 1

1

Possibly you might have missed to add the PrimaryControl CRM parameter in ribbon command. Then you don’t need Xrm.Page, instead you will get the context directly in the first parameter executionContext. Read more

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.