JavaScript Introduction:-

we have to create a JavaScript web resource. Open any custom solution and add a new web resource of type JavaScript.

 ShowMessage(executionContext)

function{
var formContext = executionContext;
var accountName = formContext.getAttribute(“name”).getValue();
alert(accountName);
}

We will read the Account name and show the account name as an JavaScript alert. So we will use below script to read Account name.

In the above script the parameter executionContext will be passed from Ribbon Workbench.

After the JavaScript web resource is created open ribbon workbench and choose the solution containing the entity now add a button named as ‘Show Message’ and add a command for the button with JavaScript Action.

JavaScript

in the Custom Javascript Action select the library javascript and supply the function name as ShowMessage as in the javascript function we have mentioned the name of function ShowMessage.
Now click on Add parameter and choose CRM parameter and choose the Value as Primary Control.

After it is published refresh an existing Account form and you will see a new button called “Show Message” and on clicking the show message the account name will be displayed.