Microsoft Dynamics CRM 2011

Microsoft Dynamics CRM 2011

Friday, December 20, 2019

Deep Insert Request for Account Entity using AJAX on Dynamics 365


The following request body posted to the Account entity set will create a total of four new entities in the context of creating an account.
· A contact is created because it is defined as an object property of the single-valued navigation property primarycontactid.
· An opportunity is created because it is defined as an object within an array that is set to the value of a collection-valued navigation property opportunity_customer_accounts.
· A task is created because it is defined an object within an array that is set to the value of a collection-valued navigation property Opportunity_Tasks.The following is the source I used for this:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/webapi/create-entity-web-api#bkmk_CreateRelated


var fnDeepInsert = () => {

    let entityName = "accounts";
    let clientURL = parent.Xrm.Page.context.getClientUrl();
    let req = new XMLHttpRequest();

    req.open("POST", encodeURI(clientURL + "/api/data/v9.1/" + entityName, true));
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");

    req.onreadystatechange = function () {
        if (this.readyState == 4  ) {
            req.onreadystatechange = null;
            if (this.status == 204) {
                alert("No Content = Four Entities created using DEEP INSERT");
            }
            else {
                let error = JSON.parse(this.response).error;
                alert(error.message);
            }
        }
    };

    req.send(JSON.stringify(
        {
            name: "Account",
            primarycontactid:
            {
                firstname: "Bender",
                lastname: "Rodriguez"
            },
            opportunity_customer_accounts:
            [
             {
                 name: "Opportunity for Bender",
                 Opportunity_Tasks:
                 [
                  { subject: "Task related to Bender" }
                 ]
             }
            ]
        }));
}






Friday, December 13, 2019

Dynamics 365 - How to retrieve METADATA for an Entity using a OData REST GET request

In this article we describe  How to retrieve METADATA for an Entity using a OData REST GET request using Web API and Javascript  .



How to retrieve METADATA for an Entity using a OData REST GET request using Web API and Javascript 


Send to the Dynamics webservice the following HTTP request :

http://DOMAIN/ORGANIZATION/api/data/v8.2/EntityDefinitions(LogicalName='phonecall')?$select=LogicalName&$expand=Attributes($select=LogicalName)










That's all...
In this article we've seen  How to retrieve METADATA for an Entity using a OData REST GET request using Web API and Javascript .
Enjoy Microsoft Dynamics 365 CRM!

by Carmel Schvartzman

כתב: כרמל שוורצמן

Friday, December 6, 2019

How to create a Microsoft Word mail merge document with Dynamics 365 for Outlook

In this article we describe Step by step How to create a Microsoft Word mail merge document with Dynamics 365 for Outlook in 10 minutes.

Dynamics 365 for Outlook  allows to easily create mail merge documents and also templates for reuse. This way, you can use an existing template to create email messages, letters , faxes, quotes, etc, to be sent to leads, opportunities, contacts, accounts, or marketing mailing lists.







How to create a Microsoft Word mail merge document with Dynamics 365 for Outlook

To perform the mail merge in Dynamics 365 for Outlook   , follow this steps :

1) In the Dynamics 365 for Outlook tab, click on "Advanced Find", and look for the Contacts, Leads, Users, or whatever entity you want to use in the mail merge:


2) Select all the entities that you want to merge, and click on the "Mail Merge" button:





3) A Mail Merge dialog box will open, where you can select the type of document you want to use. It can be an empty document or a pre-built template. Keep in mind that Dynamics 365 for Outlook gives you the option of saving the present mail merge document as a TEMPLATE, to be reused later.


4) Then you can add data fields, up to 62  CRM fields that you can use on the mail merge document. After you selected the fields, you click on the "DOWNLOAD" button, in order to load the template or the new document that you are creating. The editable document will open:




5) Now it's time for you to edit the document according to your needs. You can click on the standard links "Address block" , "Greeting line", etc, and then you can use the fields that previously you added to the mail merge , by clicking on "More items":


6) From the "More items" link , a window is opened, to let you choose the mail merge fields :




7) After you finish your document/template, you will want to preview it:



8) Then, provided that everything is ok , just perform the mail merge. Else, go back with the navigation buttons, and edit again your document:




9) Another thing: in case that you ALSO want to save your document as a template for future use, you can find it in Dynamics 365 , in the Settings, in the "Business" tab, inside "Templates":





In this article we saw How to create a Microsoft Word mail merge document with Dynamics 365 for Outlook.
That's all...Enjoy Dynamics 365 CRM

by Carmel Schvartzman

כתב: כרמל שוורצמן