MSCRM 2016 Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/category/mscrm-2016/ Microsoft Dynamics CRM . Microsoft Power Platform Fri, 24 Apr 2020 14:32:22 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/cropped-Microsoftdynamics365-blogs.png?fit=32%2C32 MSCRM 2016 Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/category/mscrm-2016/ 32 32 176351444 Entity for Views in CRM based on View Ownership – SavedQuery and UserQuery Entity http://microsoftdynamics.in/2018/01/07/entity-for-views-in-crm-based-on-view-ownership-savedquery-and-userquery-entity/ Sun, 07 Jan 2018 15:14:00 +0000 There are 2 types of View in CRM entity based on View Ownership , which are stored in two different entities. 1)  Organisation or System View – stored in the View Entity (SavedQuery)2)  Individual, personal or User/Team View – stored in the Saved View Entity (UserQuery) Below is the Fetch XML that you can use to...

The post Entity for Views in CRM based on View Ownership – SavedQuery and UserQuery Entity appeared first on Microsoft Dynamics 365 Blog.

]]>
There are 2 types of View in CRM entity based on View Ownership , which are stored in two different entities.

1)  Organisation or System View – stored in the View Entity (SavedQuery)
2)  Individual, personal or User/Team View – stored in the Saved View Entity (UserQuery)

Below is the Fetch XML that you can use to retrieve the Data of the entites

1)  Organisation or System View

<fetch top="5000" >
  <entity name="savedquery" >
    <attribute name="name" alias="ViewName" />
    <attribute name="createdbyname" alias="Owner" />
    <attribute name="description" alias="Description" />
    <attribute name="returnedtypecode" alias="returnCode" />
    <attribute name="fetchxml" alias="fetchXML" />
  </entity>
</fetch>

2)  Individual, personal or User/Team View

<fetch top="5000" >
  <entity name="userquery" >
    <all-attributes/>
    <attribute name="name" />
    <order attribute="name" descending="false" />
    <attribute name="ownerid" />
    <attribute name="modifiedon" />
    <attribute name="userqueryid" />
  </entity>
</fetch>

We can retrieve the data of these entries by C# also you can see the full code example here:
https://msdn.microsoft.com/en-us/library/gg594431.aspx

You can also use LINQ query for retrieving these view.

Happy CRMing 😊

The post Entity for Views in CRM based on View Ownership – SavedQuery and UserQuery Entity appeared first on Microsoft Dynamics 365 Blog.

]]>
2755
Validation to accept only Numeric Character in MS CRM http://microsoftdynamics.in/2018/01/07/validation-to-accept-only-numeric-character-in-ms-crm/ Sun, 07 Jan 2018 14:46:00 +0000 Below script is a generic validation which will show for error if field is having anything except numeric value function ValidateOnlyNumeric(context) {     var fieldname = context.getEventSource().getName();     var phone = Xrm.Page.getAttribute(fieldname).getValue();     if (checkFormat(phone)) {         Xrm.Page.getControl(fieldname).clearNotification();     } else {         Xrm.Page.getControl(fieldname).setNotification(“Please enter only numeric characters”);     } } function checkFormat(phone) {     var regex = /^d+$/;     if (regex.test(phone)) {         return true;     } else {         return false;     }...

The post Validation to accept only Numeric Character in MS CRM appeared first on Microsoft Dynamics 365 Blog.

]]>

Below script is a generic validation which will show for error if field is having anything except numeric value


function ValidateOnlyNumeric(context) {
    var fieldname = context.getEventSource().getName();
    var phone = Xrm.Page.getAttribute(fieldname).getValue();
    if (checkFormat(phone)) {
        Xrm.Page.getControl(fieldname).clearNotification();
    } else {
        Xrm.Page.getControl(fieldname).setNotification(“Please enter only numeric characters”);
    }
}
function checkFormat(phone) {
    var regex = /^d+$/;
    if (regex.test(phone)) {
        return true;
    } else {
        return false;
    }
}

To enable it for any field just register it on change of the required field with function name “ValidateOnlyNumeric” and check “Pass execution context as first parameter ” and save an publish it will start working

Hope it helps

Happy Coding 😊

The post Validation to accept only Numeric Character in MS CRM appeared first on Microsoft Dynamics 365 Blog.

]]>
2757
Create and Send Email Message Activity from javascript using api D365 / MS CRM 2016 http://microsoftdynamics.in/2018/01/07/create-and-send-email-message-activity-from-javascript-using-api-d365-ms-crm-2016/ Sun, 07 Jan 2018 09:06:00 +0000 For Creating email message activity from java script MS CRM , you can update and use the below code according to your requirement. Here to show I have taken up a scenario to send a email to system user when a Quote is won. Replace the User GUID for to and from user in “fromFieldIdSystemAdmin”...

The post Create and Send Email Message Activity from javascript using api D365 / MS CRM 2016 appeared first on Microsoft Dynamics 365 Blog.

]]>
For Creating email message activity from java script MS CRM , you can update and use the below code according to your requirement. Here to show I have taken up a scenario to send a email to system user when a Quote is won.

Replace the User GUID for to and from user in “fromFieldIdSystemAdmin” and  “toPartyUsersId”

function CreateEmail() {
    var fromFieldIdSystemAdmin = "53536B3D-4D71-4FC2-857C-0477750A92BE"; //todo Email from User GUID
    var toPartyUsersId = ["53536B3D-4D71-4FC2-857C-0477750A92BE"]; //todo Email To user array
    var quoteId = Xrm.Page.data.entity.getId();
    quoteId = quoteId.replace(/[{}]/g, "");
  var customerLookUp = Xrm.Page.getAttribute("customerid");
    var accountName = null;
    if (customerLookUp != null)
        accountName = customerLookUp.getValue()[0].name;
    var webapiPath = Xrm.Page.context.getClientUrl() + "/api/data/v8.0/emails";
    var email = {};
    //Lookup
    email["regardingobjectid_quote@odata.bind"] = "/quotes(" + quoteId + ")"; //Regarding is quote
    email["subject"] = "Quote Sent ";
    email["description"] = "See attachment for the Quote that was set as Won";
    var parties = [];
    //ActivityParty (From)
    var sender = {};
    sender["partyid_systemuser@odata.bind"] = "/systemusers(" + fromFieldIdSystemAdmin + ")";
    sender["participationtypemask"] = 1; //From
    parties.push(sender);
    for (i = 0; i < toPartyUsersId.length; i++) {
        var receiver = {};
        receiver["partyid_systemuser@odata.bind"] = "/systemusers(" + toPartyUsersId[i] + ")";
        receiver["participationtypemask"] = 2; //To
        parties.push(receiver);
    }
    email["email_activity_parties"] = parties;
    var service = new XMLHttpRequest();
    service.open("POST", webapiPath, false);
    service.setRequestHeader("Accept", "application/json");
    service.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    service.setRequestHeader("OData-MaxVersion", "4.0");
    service.setRequestHeader("OData-Version", "4.0");
    service.send(JSON.stringify(email));
    if (service.readyState == 4) {
        if (service.status == 204) {
            var uri = service.getResponseHeader("OData-EntityId");
            var regExp = /(([^)]+))/;
            var matches = regExp.exec(uri);
            var emailGblId = matches[1];
            SendEmail(emailGblId);
        } else {

            Xrm.Utility.alertDialog(this.statusText);
        }
    }
}

function SendEmail(emailGblId) {
    var parameters = {};
    parameters.IssueSend = true;
    var req = new XMLHttpRequest();
    req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.1/emails(" + emailGblId + ")/Microsoft.Dynamics.CRM.SendEmail", true);
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
        if (this.readyState === 4) {
            req.onreadystatechange = null;
            if (this.status === 200) {
                var results = JSON.parse(this.response);
            } else {
                Xrm.Utility.alertDialog(this.statusText);
            }
        }
    };
    req.send(JSON.stringify(parameters));
}

function successCallback() {
}
function errorCallback() {
}

Happy Coding 😊

SOURCE : mscrm.com

The post Create and Send Email Message Activity from javascript using api D365 / MS CRM 2016 appeared first on Microsoft Dynamics 365 Blog.

]]>
2759
CRM Rest Builder for Dynamics CRM D365 / MSCRM 2013, 2015, 2016 http://microsoftdynamics.in/2018/01/02/crm-rest-builder-for-dynamics-crm-d365-mscrm-2013-2015-2016/ Tue, 02 Jan 2018 07:34:00 +0000 http://microsoftdynamics.in/2018/01/02/crm-rest-builder-for-dynamics-crm-d365-mscrm-2013-2015-2016/ Navigate to the below URL and Download the latest version of the solution of CRM Rest Builder For 2015 & 2016 & D365 use the v2.5.0.0 releaseFor 2011 & 2013 use the v1.5.0.0 release 1) CRM Rest Builder GIT Hub URL2) CRM Rest Builder Drive  v2.5.0.0 , v1.5.0.0 And follow the below steps Step 1 – Navigate to...

The post CRM Rest Builder for Dynamics CRM D365 / MSCRM 2013, 2015, 2016 appeared first on Microsoft Dynamics 365 Blog.

]]>
Navigate to the below URL and Download the latest version of the solution of CRM Rest Builder

For 2015 & 2016 & D365 use the v2.5.0.0 release
For 2011 & 2013 use the v1.5.0.0 release

1) CRM Rest Builder GIT Hub URL
2) CRM Rest Builder Drive  v2.5.0.0 , v1.5.0.0

And follow the below steps

Step 1 – Navigate to your Organisation Settings -> Solutions and click on Import Button

Step 2 – Click on to Browse Button

Step 3 – Navigate to the solution file previously downloaded and click on open and then click on Next



Step 4 – Click on to Import Button

Step 5 – After some time you will see the below success message

Step 6 – Now you will be able to see the CRM Rest Builder Button on the ribbon bar on solutions Click on it

And You are good to go with CRM Rest Builder

Happy CRMing 😊


SOURCE : mscrm.com

The post CRM Rest Builder for Dynamics CRM D365 / MSCRM 2013, 2015, 2016 appeared first on Microsoft Dynamics 365 Blog.

]]>
2762