Posts

Showing posts from April, 2018

Calling Global Action using Web API

Following is detail sample JavaScript code to call a global Action using Web API in Dynamics CRM. /* actionName: Name of action param: param is an object that contians the parameter needed to be passed to the calling action. e.g var param = { param1: "this is string parameter", param2: false,// boolean }; */ function callGlobalAction(actionName, param) { var serverURL = Xrm.Page.context.getClientUrl(); var result = null; var req = new XMLHttpRequest(); req.open("POST", serverURL + "/api/data/v8.0/" +actionName, false); 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.onready...

Calling entity based Action using Web API

Following is detail sample JavaScript code to call an entity based Action using Web API in Dynamics CRM. /* actionName: Name of action entityPlurarName: entityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities entityId: guid of record going to update param: param is an object that contians the parameter needed to be passed to the calling action. e.g var param = { param1: "this is string parameter", param2: false,// boolean }; */ function callEntityBasedAction(actionName, entityPlurarName, entityId, param) { var serverURL = Xrm.Page.context.getClientUrl(); entityId = entityId.replace('{', '').replace('}', ''); var result = null; var req = new XMLHttpRequest(); req.open("POST", serverURL + "/api/data/v8.0/"+ entityPlurarName + "(" + entityId + ")/Microsoft.Dynamics.CRM." + actionName, false); req.setR...

Dynamics CRM 2016 Web API (OData V4.0)

Microsoft introduces Web API (OData v4) with the release of Dynamics CRM 2016 to perform CRUD operations and also some other special operations. Following are some posts for CRUD operation... Retrieve Record using Web API Retrieve Multiple using Web API Retrieve Multiple through fetch XML using Web API Create Record using Web API Update Record using Web API Delete Record using Web API Associate Record using Web API Disassociate Record using Web API Calling entity based Action using Web API Calling Global Action using Web API

Disassociate Record using Web API

Following is detail sample code to disassociate a record using Web API in Dynamics CRM. /* currentEntityPlurarName: currentEntityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities currentEntityId: guid of current entity record otherEntityPlurarName: otherEntityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities otherEntityId: guid of other entity record */ function disAssociateRequest(currentEntityPlurarName, currentEntityId, relationShipName, otherEntityPlurarName, otherEntityId) { var serverURL = Xrm.Page.context.getClientUrl(); var query = currentEntityPlurarName + "(" + currentEntityId + ")/" + relationShipName + "/$ref?$id=" + serverURL + "/api/data/v8.2/" + otherEntityPlurarName + "(" + otherEntityId + ")"; var req = new XMLHttpRequest(); req.open("DEL...

Associate Record using Web API

Following is detail sample code to Associate a record using Web API in Dynamics CRM. /* currentEntityPlurarName: currentEntityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities currentEntityId: guid of current entity record otherEntityPlurarName: otherEntityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities otherEntityId: guid of other entity record */ function associateRequest(currentEntityPlurarName, currentEntityId, relationShipName, otherEntityPlurarName, otherEntityId) { var serverURL = Xrm.Page.context.getClientUrl(); var associate = {} associate["@odata.id"] = serverURL + "/api/data/v8.2/" + otherEntityPlurarName + "(" + otherEntityId + ")" var req = new XMLHttpRequest(); req.open("POST", serverURL + "/api/data/v8.2/" + currentEntityPlurarName + ...

Delete Record using Web API

Following is detail sample code to delete a record using Web API in Dynamics CRM. /* entityPlurarName: entityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities id: guid of record going to delete */ function deleteRecord(entityPlurarName, id) { id = id.replace('{', '').replace('}', ''); var IsDeleted = false; var serverURL = Xrm.Page.context.getClientUrl(); var req = new XMLHttpRequest(); req.open("DELETE", serverURL + "/api/data/v8.2/" + entityPlurarName + "(" + id + ")", false); 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.send(); if (req...

Retrieve Record using Web API

Following is detail sample code to retrieve a record using Web API in Dynamics CRM. /* entityName: entityName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities entityId: Guid of entity record return:-Entity record */ function retrieveEntityById(entityName, entityId) { entityId = entityId.replace('{', '').replace('}', ''); var data = null; var req = new XMLHttpRequest(); req.open('GET', Xrm.Page.context.getClientUrl() + "/api/data/v8.2/" + entityName + "(" + entityId + ")", false); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Prefer", "odata.include-annotations=*"); req.send(); if (req.readyState == 4 /* com...

Update Record using Web API

Following is detail sample code to update a record using Web API in Dynamics CRM. /* entityPlurarName: entityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities id: guid of record going to update entityObject: entityObject is an object that of entity contians fields and values that needed to be create. e.g var entityObject = {}; entityObject["originatingleadid@odata.bind"] = "/leads(" + guid + ")"; // lookup contact["firstname"] = string value; // Single line of text contact["po_preferredlanguage"] = string value; //Option set contact["donotemail"] = true/false //two Option */ function updateRecord(entityPlurarName, id, entityObject) { var IsUpdated = false; var req = new XMLHttpRequest(); req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/" + entityPlurarName + "("...

Create Record using Web API

Following is detail sample code to create a record using Web API in Dynamics CRM. /* entityPlurarName: entityPlurarName is the plural entity logical name of entity e.g for account it is accounts. for opportunity it is opportunities entityObject: entityObject is an object that of entity contians fields and values that needed to be create. e.g var entityObject = {}; entityObject["originatingleadid@odata.bind"] = "/leads(" + guid + ")"; // lookup contact["firstname"] = string value; // Single line of text contact["po_preferredlanguage"] = string value; //Option set contact["donotemail"] = true/false //two Option */ function createRecord(entityPlurarName, entityObject) { var id = null; var req = new XMLHttpRequest(); req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/" + entityPlurarName, false); req.setRequestHeader("OData-MaxVersion...

Distribute Campaign Activity via “Email via Mail Merge”

Image
We can distribute our campaign activity by “Email, Email via Mail Merge, Letter, Letter via mail merge, Fax, Fax via mail merge, phone call etc.”. When our channel is “[Email, Letter, Fax] via Mail Merge” then we cannot distribute the campaign activity in dynamics CRM web client, we need to distribute it from outlook client for dynamics CRM. Create Mail Merge templates https://technet.microsoft.com/library/mt843831.aspx Installing Outlook Client https://technet.microsoft.com/en-us/library/hh699760.aspx#BKMK_Task1_Install_CRMForOutlook Overview of Distributing Campaign Activity via “Email via Mail Merge” in CRM Outlook client. Create a campaign activity with channel “Email via Mail Merge”.  If you try to distribute this campaign activity in Dynamics CRM web client then below alert will be shown. So, here we need to distribute this Campaign activity in Outlook client for CRM. Go to Marketing | Marketing | Campaigns....

Campaign Response

Image
In Microsoft Dynamics CRM, campaign responses are records of the communication you receive from potential customers in response to a specific marketing campaign. There are four ways to create campaign responses: Record campaign responses manually. You can create responses manually by first creating an activity and then converting it, or by creating a new campaign response within a campaign record Convert an existing activity to a campaign response. When a potential customer responds to an activity created for them as part of a marketing campaign, you can convert the corresponding activity, such as a phone call, e-mail, or fax etc., to a campaign response.  Import responses from a file, such as a Microsoft Office Excel workbook. By importing campaign responses, you can capture a record of the responses received as part of campaign efforts performed outside Microsoft Dynamics CRM. When you import the file, you can specify that it contains campaign responses. Au...