PL 400: create JavaScript or TypeScript code that targets the Client API object model (Apply business logic using client scripting)
JavaScript is the major client script language which makes it user friendly and responsive to any static html/web pages. It is also abbreviated as JS. It is a lightweight and interpreted programming language designed for network centric applications. It is one of the major technologies of the World Wide Web, along with HTML and CSS.
JavaScript is immortal.
TypeScript is a strongly typed programming language that builds on JavaScript, in other words, it is a strict syntactic superset of JavaScript and is designed to transcompile the language applications to JavaScript.
Typically, in Dynamics 365 CE/Model driven apps, JavaScript is used to perform actions such as forms, ribbon commands, and web resources. Client scripting allows us to use JavaScript in a Power App Model Driven App to implement custom business logic. It should be used as an alternative when declarative business rules do not meet the requirement.
Following are the most common events for which we can register as event handlers:
- Form Load
- Data in a column changed
- Form is saved
Client scripting provides an object model with methods for interacting with various form components. This ensures that our business logic is untouched by any changes in layout or specific HTML used in form rendering.
To programmatically manipulate data and user interface elements in a model-driven app, Use the getFormContext method of the passed in execution context object to return reference to the appropriate form or an item on the form.
JavaScript Syntax :
function getFullName(executionContext){var formContext = executionContext.getFormContext(); // get formContext
// use formContext instead of Xrm.Pagevar firstName = formContext.getAttribute("firstname").getValue();var lastName = formContext.getAttribute("lastname").getValue();console.log(firstName + " " + lastName);
}
Comments
Post a Comment