Microsoft Dynamics CRM 2011

Microsoft Dynamics CRM 2011
Showing posts with label Dynamics 365. Show all posts
Showing posts with label Dynamics 365. Show all posts

Wednesday, December 30, 2020

How to find and debug your custom Javascript files in Dynamics CRM / 365

In this article we describe Step by step How to find and debug your custom Javascript files in Dynamics CRM / 365 in 5 minutes.
After you have coded you javascript files, you want to find them for debugging purposes. It could be a not easy task to find them between the hundreds of source files that Dynamics 365 will load to the browser:




How to find and debug your custom Javascript files in Dynamics CRM / 365

To debug quickly your javascript files, just follow this steps:

1) Open the FORM of the Entity your are working on, and go to the Properties of the Form. Open the Web Resources and find the JAVASCRIPT LIBRARY that you want to debug. Double-click it to open the editor:



2) Once opened the Editor, type into your  javascript file , the "debugger; " command:



3) Save it, save the Form, Publish it and open the Developer's Tools of the browser:


4) Then , just perform the Click or anything else that would trigger your javascript code: from here, you can add breakpoints to stop the script execution.
That's all...
In this article we've seen Step by step How to find and debug your custom Javascript files in Dynamics CRM / 365 in 5 minutes.
Enjoy Microsoft Dynamics 365 CRM!

by Carmel Schvartzman

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










    Saturday, March 21, 2020

    SOLVED ERROR "There is a problem communicating with the Microsoft CRM Server" when configuring Microsoft Dynamics CRM for Outlook

    In this article we describe Step by step How to solve the ERROR "There is a problem communicating with the Microsoft CRM Server"  when configuring Microsoft Dynamics CRM for Outlook.
    This error can occur during/after the installation the Microsoft Dynamics CRM client addon for Microsoft Office Outlook.After getting this message, you might this other one, while clicking the OK button:
    "An error occurred loading Microsoft CRM functionality. Try restarting Microsoft Outlook. Contact your system administrator if error persists."



     How to solve the ERROR "There is a problem communicating with the Microsoft CRM Server"  when configuring Microsoft Dynamics CRM for Outlook



    To resolve this problem, follow this steps:

    1) Open the IE Options,and click the Security tab. Click Local intranet >> Sites, and then Advanced.
    Then type the IP of the Microsoft CRM server, and click OK three times. Restart Microsoft Outlook.


    2) Open regedit, and locate the following subkey: HKEY_CURRENT_USER\ Software\Microsoft\MSCRMClient. There, check for the correct URL of your Microsoft CRM server.

    If these steps were NOT enought , continue with the following:

    3) Inside Dynamics CRM, open Settings >> Business Unit Settings >>  Users, and locate the user who is experiencing this error. Click the information side tab, and there clear the Restricted Access Mode check box.

    4) Open CONTROL from the Start of your PC, and open User Accounts >>> Advanced tab.
    Click Manage Passwords, and proceed to delete all CRM passwords and usernames there.


    That's all...
    In this article we've seen Step by step  How to solve the ERROR "There is a problem communicating with the Microsoft CRM Server"  when configuring Microsoft Dynamics CRM for Outlook.
    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

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










        Tuesday, April 16, 2019

        Dynamics 365 - How to Create a MANY-TO-ONE related Entity record using Web API and Javascript in 5 minutes

        In this article we describe Step by step How to Create a MANY-TO-ONE related Entity record using Web API and Javascript in 5 minutes.
        This Web Resource uses Bootstrap and JQuery , to issue HTTP POST and HTTP PATCH requests to a Dynamics 365 Organization, using the Web Api, in order to Create a new Contact record, related to a current Phonecall. 

        The UI looks like this :










        How to Create a MANY-TO-ONE related Entity record using Web API and Javascript in 5 minutes  



        There will be 2 functions, one for creating a new Contact record with HTTP POST , like this :





        And the second function, in order to UPDATE the current Phonecall record, setting its Contact reference regardingobjectid_contact to the guid of the newly created Contact :






        The following is the whole Web Resource, to be copied as a building block to your Dynamics Organization :


        <html>
        <head>
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
            <script>

                // Create a MANY-TO-ONE relationship :  Créer une relation plusieurs-à-un phonecalls-contact :
                var fnPATCHRelatedEntity = (newEntityId) => {
                    //debugger;
                    var entity = {};
                    entity["regardingobjectid_contact@odata.bind"] = "/contacts(" + newEntityId + ")";
                    let id = parent.Xrm.Page.data.entity.getId().replace('{', '').replace('}', '');
                    // In case you want to modify another attribute :  Au cas ou tu veux modifier un autre attribut :
                    // entity.phonenumber = "0546589251";

                    parent.$.ajax({     //  We can use HTTP PUT whenever we need to modify only ONE attribute
                        type: "PATCH",  //  on peut utiliser le verbe HTTP PUT , dans le cas de modification de 1 seul attribut
                        contentType: "application/json; charset=utf-8",
                        datatype: "json",
                        url: parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/phonecalls(" + id + ")",
                        data: JSON.stringify(entity),
                        beforeSend: function (XMLHttpRequest) {
                            XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
                            XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
                            XMLHttpRequest.setRequestHeader("Accept", "application/json");
                        },
                        async: true,
                        success: function (data, textStatus, xhr) {
                            parent.Xrm.Utility.alertDialog('Phonecall Updated with MANY-TO-ONE relationship!!');
                        },
                        error: function (xhr, textStatus, errorThrown) {
                            parent.Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
                        }
                    });

                }

                var fnCreateContact = () => {
                    //debugger;
                    var entity = {};
                    entity.address1_telephone1 = document.getElementById("Phone").value;
                    entity.emailaddress1 = document.getElementById("Email").value;
                    entity.firstname = document.getElementById("FirstName").value;
                    entity.lastname = document.getElementById("LastName").value;

                    parent.$.ajax({
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        datatype: "json",
                        url: parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/contacts",
                        data: JSON.stringify(entity),
                        beforeSend: function (XMLHttpRequest) {
                            XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
                            XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
                            XMLHttpRequest.setRequestHeader("Accept", "application/json");
                        },
                        async: true,
                        success: function (data, textStatus, xhr) {
                            let uri = xhr.getResponseHeader("OData-EntityId");
                            let regExp = /\(([^)]+)\)/;
                            let matches = regExp.exec(uri);
                            let newEntityId = matches[1];
                            if (newEntityId != null) {
                                // Créer une relation plusieurs-à-un phonecalls-contact :
                                fnPATCHRelatedEntity(newEntityId);
                            }


                            document.getElementById('btnCreateContact').classList.add('disabled');
                        },
                        error: function (xhr, textStatus, errorThrown) {
                            parent.Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
                        }
                    });
                }


            </script>

        </head>
        <body style="direction: rtl; overflow-wrap: break-word;">

            <div class="container">
                <div class="jumbotron">
                    <h3>Create Contact</h3>
                    <p></p><h5>This function creates a new Contact related to the current Phonecall through a One-To-Many relationship</h5><p></p>
                    <table style="font:12px;border-spacing:3px;margin:5px;">
                        <tbody>
                            <tr>
                                <td>First Name: </td>
                                <td><input type="text" id="FirstName" value="Bender"></td>
                            </tr>
                            <tr>
                                <td>Last Name: </td>
                                <td><input type="text" id="LastName" name="LastName" value="Rodriguez"></td>
                            </tr>
                            <tr><td>Email: </td><td><input type="text" id="Email" value="www.bender.com"></td></tr>
                            <tr>
                                <td>Phone: </td>
                                <td><input type="text" id="Phone" name="Phone" value="123456789"></td>
                            </tr>
                        </tbody>
                    </table>

                    <button id="btnCreateContact" onclick="fnCreateContact()" type="button" class="btn btn-primary">Create Contact</button>

                </div>
            </div>
        </body>
        </html>










        That's all...
        In this article we've seen Step by step How to Create a MANY-TO-ONE related Entity record using Web API and Javascript in 5 minutes.
        Enjoy Microsoft Dynamics 365 CRM!

        by Carmel Schvartzman

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

        Dynamics 365 - How to Create a new Entity record using Web API and Javascript in 5 minutes

        In this article we describe Step by step  How to Create a new Entity record  using Web API and Javascript in 5 minutes. We'll use the JQuery already loaded by Dynamics 365 on the form.

        For this example, we'll create a Contact record, when clicking a button, using a Web Resource locally inside the Form.


        How to Create a new Entity record  using Web API and Javascript in 5 minutes



        This is the function to Create a Record , using an HTTP POST request: 


        var entity = {};
        entity.address1_telephone1 = "";
        entity.emailaddress1 = "";
        entity.lastname = "";

        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            datatype: "json",
            url: Xrm.Page.context.getClientUrl() + "/api/data/v8.2/contacts",
            data: JSON.stringify(entity),
            beforeSend: function(XMLHttpRequest) {
                XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
                XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
                XMLHttpRequest.setRequestHeader("Accept", "application/json");
            },
            async: true,
            success: function(data, textStatus, xhr) {
                var uri = xhr.getResponseHeader("OData-EntityId");
                var regExp = /\(([^)]+)\)/;
                var matches = regExp.exec(uri);
                var newEntityId = matches[1];
            },
            error: function(xhr, textStatus, errorThrown) {
                Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
            }
        });



        And this is the Web Resource EMBEDDED in the Form (that's why we wrote "parent" before calls to JQuery ) :
        1) Open the Form
        2) Add > Section > Web Resource
        3) Paste inside it the following HTML - JS code:



        <html><head>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
        <script>

        var fnCreateContact = () => {
        var entity = {};
        entity.address1_telephone1 = "123123123";
        entity.emailaddress1 = "www.bender.com";
        entity.lastname = "Contact Name";

        parent.$.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            datatype: "json",
            url: parent.Xrm.Page.context.getClientUrl() + "/api/data/v8.2/contacts",
            data: JSON.stringify(entity),
            beforeSend: function(XMLHttpRequest) {
                XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");
                XMLHttpRequest.setRequestHeader("OData-Version", "4.0");
                XMLHttpRequest.setRequestHeader("Accept", "application/json");
            },
            async: true,
            success: function(data, textStatus, xhr) {
                var uri = xhr.getResponseHeader("OData-EntityId");
                var regExp = /\(([^)]+)\)/;
                var matches = regExp.exec(uri);
                var newEntityId = matches[1];

        document.getElementById('btnCreateContact').classList.add('disabled');
            },
            error: function(xhr, textStatus, errorThrown) {
                parent.Xrm.Utility.alertDialog(textStatus + " " + errorThrown);
            }
        });
        }
        </script>
        <meta></head><body style="direction: rtl; overflow-wrap: break-word;">

        <div class="container">
          <div class="jumbotron">
            <h3>Create Contact</h3>   
            <p>This function creates a new Contact</p>
             <button id="btnCreateContact" onclick="fnCreateContact()" type="button" class="btn btn-primary">Create Contact</button>
          </div>
        </div>

        </body></html>






        That's all...
        In this article we've seen Step by step  How to Create a new Entity record  using Web API and Javascript in 5 minutes.
        Enjoy Microsoft Dynamics 365 CRM!

        by Carmel Schvartzman

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

        Step by step How to Install the CRM REST Builder in your Dynamics CRM 365 in 5 minutes

        In this article we describe Step by step How to Install the CRM REST Builder in your Dynamics CRM 365 in 5 minutes.
        The CRM REST Builder is an open source creation by  Jason Lattimer. It will give you the chance of getting the REST OData code that you need, both using JQuery or XMLHttpRequest, automatically and avoiding to fall on errors. The Builder enables you to perform WEB API OData REST request to create One to Many , Many to One and Many to Many relationships, asynchronously:



        How to Install the CRM REST Builder in your Dynamics CRM 365 in 5 minutes

        1) Download the REST BUILDER:
        Browse to the Jason Lattimer's Github , and download the Builder , according to your Dynamics CRM version: https://github.com/jlattimer/CRMRESTBuilder/releases



        2) Import the Managed Solution to your Dynamics 365:
        Open your solutions screen, and import the REST Builder solution:



        3) Open the REST BUILDER:
        After refreshing the Solutions form, you will see a button on the top of the form. Open it to see the Builder:





        4) Create your REST request:

        Create your request, and copy it to the web resource that will be called from your entity form:








        That's all...
        In this article we've seen Step by step How to Install the CRM REST Builder in your Dynamics CRM 365 in 5 minutes.
        Enjoy Microsoft Dynamics 365 CRM!

        by Carmel Schvartzman

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










          Sunday, February 10, 2019

          How to re-enable the Dynamics 365 for Outlook Client in Outlook

          In this article we describe Step by step How to re-enable the Dynamics 365 for Outlook Client in Outlook.

          How to re-enable the Dynamics 365 for Outlook Client in Outlook


          In case that your Outlook crashed because of some  Dynamics 365 for Outlook Client , while reloading Outlook, you will be prompted to disable the add-in that caused the problem.

          Usually, the Dynamics 365 for Outlook Client addon will be disabled.
          The problem is, how to re-enable it?

          The solution is, by opening the Dynamics 365 for Outlook Client Diagnostics window.

          To do so, go to the Start , Programs, and locate the Diagnostics:



          On the opened window, go to the second tab "Advanced" :





          In the "Advanced" tab, click on "Enable" :



           Reopen Outlook , and the Dynamics 365 for Outlook Client will be there.



          That's all...Enjoy Dynamics CRM

          by Carmel Schvartzman

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










            Sunday, October 21, 2018

            SOLVED ERROR "File already exists" when configuring Microsoft Dynamics CRM for Outlook

            In this article we describe Step by step How to solve the error "File already exists"  when configuring Microsoft Dynamics CRM for Outlook.


            This error can appear as follows:
            "There is a problem communicating with the Microsoft Dynamics CRM server. The server might be unavailable. Try again later. If the problem persists, contact your system administrator.
            File already exists. Try using a different database name."





            How to solve the error "File already exists"  when configuring Microsoft Dynamics CRM for Outlook

            The cause of this error, is related to succesive installations of Microsoft Dynamics CRM for Outlook.
            Having a previous installation of Dynamics CRM for Outlook, can result in an existing previous configuration of the database file for the current Dynamics instance.
            In order to solve this problem, follow this steps:
            1) Close Outlook
            2) In Explorer, go to the folder  :\Users\<Your User>\AppData :








            3) In Windows, this folder is hidden by default. If that's your case, open the "Folder and search options" :







            4) In the window "Folder Options", check on "Show hidden files, folders and drives":




            5) Now, you could see the \AppData directory. Open it and browse to \AppData\Local\Microsoft\MSCRM\Client :




            6) Delete the file that is included in the error message.

            7) Finally, rerun the Configuration Wizard  .


            That's all...
            In this article we've seen Step by step How to solve the error "File already exists"  when configuring Microsoft Dynamics CRM for Outlook.
            Enjoy Microsoft Dynamics 365 CRM!

            by Carmel Schvartzman

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