Posts

Showing posts from May, 2025

JavaScript WebAPI [Xrm.webApi]

In this blog we will see usecase of Xrm.WebApi. Generally, it is used to do CRUD operation in dynamics CRM. Most of the times we will be using retrievemultiple, retrievesingle and updaterecord.All these web api's are asynchronous, that means once we execute api, it wiill not wait for response. It will execute remaining code till we get response from api. The sample code for webapis can be generated by Dataverse REST Builder tool from xrmtoobox.  We will see below use case of WebApi 1. Xrm.WebApi.retrieveRecord -       To retrieve single record      Parameters - entityname, RecordId, OdataQuery[Select] 2. Xrm.WebApi.retrieveMultipleRecords -      To retrieve the record based on condition      Parameters - entityname, odataQuery [Select, filter] 3. Xrm.WebApi.createRecord -       To create record      Parameters - entityname, data 4. Xrm.WebApi.updateRecord -      To...

JavaScript - Show-Hide/ Lock-Unlock/ Required-NotRequired

JavaScript syntax to show Hide different controls :  function showHide(executionContext) { var formContext = executionContext.getFormContext(); //showHide field formContext.getControl("new_field").setVisible(false); formContext.getControl("new_field").setVisible(true); //showHide tab formContext.ui.tabs.get("tab_tabname").setVisible(false); formContext.ui.tabs.get("tab_tabname").setVisible(true) //showHide section formContext.ui.tabs.get("tab_tabname").sections.get("sectionName").setVisible(false); formContext.ui.tabs.get("tab_tabname").sections.get("sectionName").setVisible(true); //ShowHide related entity from related section var navItem = formContext.ui.navigation.items.get("Courses"); if (navItem) { navItem.setVisible(false); } } JavaScript Syntax to lock-unlock fields - function lockUnlock(executionContext) { var fo...