1. Lock or unlock field value
- formContext.getControl("abc_quantity").setDisabled(true);
- formContext.getControl("abc_quantity").setDisabled(false);
2. Get Value in string format
- var name=formcontext.getAttribute("abc_name").getValue();
3. To set notification
- formcontext.getControl("abc_CGST").setNotification("cgst is mandatory","cgstnotifiocation");
4. To clear notification
- formcontext.getControl("abc_cgst").clearNotification("cgstnotifiocation");
5. To get time
- var ordervaliditydate=formcontext.getAttribute("abc_ordervalidity").getValue().getTime();
6. To get the difference, we have to use this
- var Days=timediffernce/(1000*60*60*24);
7. get selected option set value name
- Var OptionsetSelectedName=formcontext.getAttribute("abc_deliveryrequiredfrom").getText();
8. to set value on the field
- formcontext("abc_name").setValue(pavan);
9. To show alert for the user
- alert(enter valid number);
- Xrm.Navigation.openAlertDialog(error.message)
10. Get active stage name of BPF
- formContext.data.process.getActiveStage().getName();
11. Get entity name
- formContext.data.entity.getEntityName();
12. Active BPF ID
- formContext.data.process.getActiveProcess().getId();
13. Get form type
- var formType=formContext.ui.getFormType();
14. To add Custom View
- formContext.getControl("abc_warehouse").addCustomView("{00000000-0000-0000-0000-000000000001}","msdyn_warehouse","CustomView",fetchXML,layoutXml,true)
15. Get Lookup
- var LookUpValue=formcontext.getAttribute("abc_product").getValue();// get Lookup name
- var LookupGUID=LookUpValue[0].id; // get GUID of the record
- var newLookupGUID=LookupGUID.replace("{","").replace("}",""); //replace braces on GUID
- var LookupName=LookupValue[0].name;
16. Set Lookup
- var lookupValue = new Array();
- lookupValue[0] = new Object();
- lookupValue[0].id = "{727504ed-64c5-4bc8-ac22-0a3071c427e}"; // GUID of the lookup id
- lookupValue[0].name = "Contoso"; // Name of the lookup
- lookupValue[0].entityType = "contact"; //Entity Type of the lookup entity
- formContext.getAttribute("FieldName").setValue(lookupValue); // Replace the lookup field
17. To set visible
- formcontext.getControl("abc_gst").setVisible(true); // to show
18. To set hide
- formcontext.getControl("abc_gst").setVisible(false); // to hide
19. Terminating the js execution
- return;
20. To get Form Context
- var formcontext=executionContext.getFormContext();
21. Get subgrid ID
- var gridControl = document.getElementById(subgridName);
22. Prompt
- var userText = prompt("Please enter your Remarks below", "Write here...");
23. Show Progress Indicator
- Xrm.Utility.showProgressIndicator("Please wait while the request is being processed.");
24. Close Progress Indicator
- Xrm.Utility.closeProgressIndicator();
25. Show Tabs
- formContext.ui.tabs.get("ReportingTab").setVisible(true);
26. set option set value
- formContext.getAttribute('abc_visittype').setValue(799240001);
27. set Required Level
- formContext.getAttribute("abc_latitude").setRequiredLevel("required");
28. get User Roles
- formContext._globalContext.getUserRoles();
29. get Current Item (selected form)
- formContext.ui.formSelector.getCurrentItem().getLabel();
30. Get Total Records Count in Sub-Grid
- var gridContext = formContext.getControl("Gift_Distribution"); //Sub-Grid Name
- let TotalCount = gridContext.getGrid().getTotalRecordCount(); // Collect Total Row Count
No comments:
Post a Comment