Skip to main content

Posts

Showing posts from 2021

Disable Section Fields Javascript Model Drive App | Dynamics 365 CRM | Power App

This is JS to disable the section attributes function disableSec(executionContext) { disableAllControlsInSection("invoice information", executionContext); } function disableAllControlsInSection(sectionLabel, executionContext) { var formContext = executionContext.getFormContext(); var tabs = formContext.ui.tabs; for (var i = 0; i < tabs.getLength(); i++) { var tab = tabs.get(i); var sections = tab.sections; for (var j = 0; j < sections.getLength(); j++) { var section = sections.get(j); if (section.getLabel().toLowerCase() === sectionLabel.toLowerCase()) { //debugger; if (formContext.getAttribute("statuscode").getValue() == 4) { DisableForm(formContext); } } } } } function DisableForm(formContext) { formContext.ui.controls.forEach( function(control, index) { if (control.g

Delete duplicate records from the table SQL

 WITH cte AS (        SELECT [ITEMID]       ,[PURCHPRICE]       ,[RETAILAMDISCOUNTTYPE]       ,[CURRENCYCODE]       ,[PURCHDISCPERCENT]       ,[SALESPRICE]       ,[VENDACCOUNT]       ,[FROMDATE]       ,[TODATE]       ,[RETAILPRICECHANGESTATUS]       ,[GROUPID] ,        row_number() OVER(PARTITION BY [ITEMID]       ,[PURCHPRICE]       ,[RETAILAMDISCOUNTTYPE]       ,[CURRENCYCODE]       ,[PURCHDISCPERCENT]       ,[SALESPRICE]       ,[VENDACCOUNT]       ,[FROMDATE]       ,[TODATE]       ,[RETAILPRICECHANGESTATUS]       ,[GROUPID]  order by [ITEMID] ) AS [rn]        FROM [ RETAILPRICECHANGETABLE ]     )     DELETE cte WHERE [rn] > 1  

Some use full Javascript Dynamics 365 CRM, Power Platform Model Driven App

Open Main View from the JavaScript  var pageInput = {     pageType: "entitylist",     entityName: "dag_wfacompositeentity" }; Xrm.Navigation.navigateTo(pageInput).then(     function success() {         // Run code on success     },     function error() {         // Handle errors     } ); Refresh the page after 10 second Dynamics 365 CRM JavaScript   setTimeout(function refreshPage() {     Xrm.Utility.openEntityForm(formContext.data.entity.getEntityName(), formContext.data.entity.getId()); }, 10000); Call Power Automate from the button click JavaScript Dynamics 365 CRM, Power App , Model Driven App var flowUrl = "https://prod-85.westeurope.logic.azure.com:443/workflows/7174dc80ca8745e9a52a459129642f7c/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=PRK-k8dNT-w_wtt22xnm-6RB6w7AJUsHRls6iZq-xUU"; var input = JSON.stringify({     "TrackingId": _TrackingId,     "Comment": _comment,