Articles

Affichage des articles du 2019

check if a service is running and if yes then run batch code

SC queryex easy | FIND "STATE" | FIND /v "RUNNING" > NUL && ( ECHO easy is NOT running ) || ( ECHO easy is running dos code here )

CRM 2016: Selected stage and highlighted stage is not same when stageid is set via plugin

this is just a copy past of the website https://meghshyam.wordpress.com/2017/09/27/crm-2016-selected-stage-and-highlighted-stage-is-not-same-when-stageid-is-set-via-plugin/ Faced the weird error in Business process flow in CRM 2016 version. Scenario is when we move the business process stage programmatically via plugin by setting thestageid field, you will find a weird behaviour where BPF is still showing the existing stage as highlighted however the active stage is set to correct stage i.e. next stage. After googling some blogs (link)proposed some javascript methods like Xrm.Page.data.process.addOnStageSelected(stageSelected) but that don’t really help as this is specific to client side scripting. Then the next hope was to dig into the entity fields and find out if there is any hidden field which is storing the selected stage value for that respective record and here I got the reference. In CRM 2016 (not sure about CRM 2015), there is field called “TraversedPath” which store

Decode/render HTML from a field in crm dynamics

In email entity the Hmtl is well decode. but if you want to decode it in other entity, it will not work you will just see the tag everywhere then I propose you to create a webressource and to apply this code. as you can see the field to to decode is hard coded but you can also give it as a webressource parameter. in a old post I explain how to pass value here is the html + javascript <html><head><meta></head> <body onload="onLoad()" onfocusout="parent.setEmailRange();" style="overflow-wrap: break-word;"> <script > function onLoad() { debugger; var para = document.createElement("decodedDescription"); var descriptionHtml = window.parent.Xrm.Page.getAttribute("description").getValue(); para.innerHTML = descriptionHtml; document.getElementById("decodedDescription").appendChild(para); }   </script > <div id="decodedDescription"> </div> </body></ht

make code wait for async 8.2

The async function to wait function getSetting (settingName) { var req = new XMLHttpRequest(); return new Promise(function (resolve, reject) {     // Setup our listener to process compeleted requests     req.onreadystatechange = function () {         // Only run if the request is complete         if (req.readyState !== 4) return;         // Process the response         if (req.status >= 200 && req.status < 300) {             // If successful             resolve             ( req      );         } else {             // If failed             reject(                 alert ("multiple setting with the name :" + settingName)             );         }     }; req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/query, false); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "appli

Add clickable button in the form

I do it via webressource <html><head>     <style>       * {                     margin: 0;                     padding: 0;                 }                                 .button{                     background-color: #00B3D9;                     color: #FFFFFF;                     font-family: Segoe UI, Tahoma, Arial;                     font-size: 14px;                     padding: 5px 10px 5px 10px;                     margin: 0px 4px 3px 1px;                     width: 100px;                     text-overflow: ellipsis;                     display: inline-block;                     text-align: center;                     overflow: hidden;                     white-space: nowrap;                     border-radius: 16px;                     border :none;                     float : left;                     border-bottom : none;                 }     </style>     <meta><meta><meta></head>         <bod

CRM dynamics V9 wait Async web API to contiue code

hello here is how to do an async call from v9 here is the structur of a call function azerty () {   Xrm.WebApi.retrieveMultipleRecords("teams", "?$select=name,teamid&$filter="+clause).then(       function success(result)         {     / /Your COde here part A                 },         function (error)         {             Xrm.Navigation.openAlertDialog(error.message);         }     );  //other code here; part b //Yuou want this code to be executed after part A because the webapi call is assync the part B would be executed before part A } then if you want to execute part B after part A here is how to do In green what is change to make it work async function azerty () { //Some code await myPartAcode(); partBcode; } function myPartAcode() { return new Promise(resolve => { { resolve(   Xrm.WebApi.retrieveMultipleRecords("teams", "?$select=name,teamid&$filter="+clause).then(       func

Remap crm user to ActiveDirectory User

I imported an organization and I mapped only system user CRM : 2016 V8.2 OnPremise Then at the end only mapped User can connect To CRM while normal user are still visible in CRM systemUser. To see if they are mapped you can use select * from MSCRM_CONFIG.[dbo].[SystemUserOrganizations] org join SystemUserBase users on (users.SystemUserId = org.CrmUserId) then to remapp normal user I did 1/ disable user + save 2/ change the logon user (I added a s after) + Save 3/ change back the logon by the correct logon user (remove the S) 4 enable the user re do the query, select * from MSCRM_CONFIG.[dbo].[SystemUserOrganizations] org join SystemUserBase users on (users.SystemUserId = org.CrmUserId) you will see the user is mapped

retrieve queue item filtered by object

I had to look for that because when reactivating a case i Hade an error that say that multiple queueitem exist. if you want to retrieve the queue item by case/email/... knowing the guid of the case/email/... here is the query {{webapiurl}} /queueitems?$top=3&$filter=_objectid_value eq BA774537-B561-E911-80E7-005056B22A06 after i retrieve the queue item id and i delete it {{webapiurl}} /queueitems(c7774537-b561-e911-80e7-005056b22a06)

Update Email with web API

when you receive an email and it s wrong resolve because of human or computer you need to correct it. For that i set the email activity in draft with dynamics power pane (chrome extention) and after I apply this in PATCH mode with postMan { "statuscode":4,   "statecode":1,   "email_activity_parties" :  [         {             "partyid_lead@odata.bind" : "/leads(87701058-3C67-E911-80E7-005056B22A06)",             "participationtypemask" : 1         },         {             "partyid_queue@odata.bind" : "/queues(7A5AC7BE-BE0C-E411-8890-AC162DAC65CC)",             "participationtypemask" : 2         }         ] }