RE: How to get Client API execution context into Angular web resource
Hi Leah,
Thank you for your response.
I am already using
<script type="text/javascript" src ="../ClientGlobalContext.js.aspx"></script>
npm install --save @types/xrm
I need to get Attribute value.
function displayName()
{
var firstName = Xrm.Page.getAttribute("firstname").getValue();
var lastName = Xrm.Page.getAttribute("lastname").getValue();
console.log(firstName + " " + lastName);
}
Xrm.Page object is deprecated and I need to use formContext
function displayName(executionContext)
{
var formContext = executionContext.getFormContext(); // get formContext
// use formContext instead of Xrm.Page
var firstName = formContext.getAttribute("firstname").getValue();
var lastName = formContext.getAttribute("lastname").getValue();
console.log(firstName + " " + lastName);
}
If I use simple javascript I can easily pass formcontext on load event. But for angular, I don't know how to do that.
Regards
Mohammad