Affichage des articles du 2019

CRM dynamics V9 wait Async web API to contiue code


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)

 //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();



function myPartAcode()

return new Promise(resolve => { {

  Xrm.WebApi.retrieveMultipleRecords("teams", "?$select=name,teamid&$filter="+clause).then(
      function success(result)
            // perform operations on…

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


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,
  "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