Category: Howto

Blog, Development, Howto

HowTo: Log all inputs of your custom worflow activities in generic way

For couple of months I work on my Ultimate Workflow Toolkit. For those who doesn’t know what is it (especially for power users and consultants who doesn’t write code but like build and use workflows) – it is a toolkit that contains steps for workflows to extend list of basic operations. To make troubleshooting of …

Development, Howto

How to get Object Type Code of entity using WebApi

If you need to get Object Type Code of entity based on Logical Name of entity you can use following code: var entityLogicalName = “account”; var requestUrl = “/api/data/v8.2/EntityDefinitions?$filter=LogicalName eq ‘” + entityLogicalName + “‘&$select=ObjectTypeCode”; var context; if (typeof GetGlobalContext === “function”) { context = GetGlobalContext(); } else { context = Xrm.Page.context; } var req …

Development, Howto

How to call Rollup of Activities using WebApi

Following code can be used to retrieve collection of ‘rolled up’ activities for couple of standard entities (account, contact and opportunity). You can find detailed description here. var target = { “@odata.id”: “accounts(F591DEE6-5B2F-E711-8110-C4346BAC5238)” }; var query = { “@odata.type”: “Microsoft.Dynamics.CRM.QueryExpression”, “EntityName”: “activitypointer”, “ColumnSet”: {“AllColumns”:”true”} }; var requestUrl = “/api/data/v8.2/Rollup(Target=@p1,RollupType=@p2,Query=@p3)”; requestUrl += “?@p1=” + JSON.stringify(target); requestUrl …

Development, Howto

How to close Quote as Won using WebApi

Following code can be used to close Quote as Won using JavaScript and WebApi: var quoteclose = { “quoteid@odata.bind”: “/quotes(D6ED8C34-EA0F-E711-810E-1458D041F8E8)”,//replace with id of active quote “subject”: “Quote Won Subject”, “actualend”: new Date(), “description”: “Your description here” }; var parameters = { “QuoteClose”: quoteclose, “Status”: -1 }; var context; if (typeof GetGlobalContext === “function”) { context …

Development, Howto

How to close Opportunity as Won using WebApi

Following code can be used to close Opportunity as Won using JavaScript and WebApi: var opportunityclose = { “opportunityid@odata.bind”: “/opportunities(628CF01A-AED1-E411-80EF-C4346BAC7BE8)”,//replace with id of opportunity “actualrevenue”: 100, “actualend”: new Date(), “description”: “Your description here” }; var parameters = { “OpportunityClose”: opportunityclose, “Status”: -1 }; var context; if (typeof GetGlobalContext === “function”) { context = GetGlobalContext(); } …

Development, Howto

How to Merge records using WebApi

Following code can be used to merge records using JavaScript and WebApi: var target = { leadid: “E5975EA3-531C-E511-80D8-3863BB3CE2C8″//Use contactid, accountid or incidentid to merge other entities }; target[“@odata.type”] = “Microsoft.Dynamics.CRM.lead”;//use contact, account or incident for other entities var subordinate = { leadid: “ED975EA3-531C-E511-80D8-3863BB3CE2C8″//Use contactid, accountid or incidentid to merge other entities }; subordinate[“@odata.type”] = “Microsoft.Dynamics.CRM.lead”;//use …

Development, Howto

How to Fulfill Sales Order using WebApi

You can use following code to Fulfill Sales Order using JavaScript and WebApi: var orderclose = { “subject”: “Put Your Fulfill Subject Here”, “salesorderid@odata.bind”: “/salesorders(58D2C742-9F0D-E711-8102-3863BB354FF0)”,//Put salesorder Id here “description”: “Additional Description Here”, “actualend”: new Date() }; var parameters = { “OrderClose”: orderclose, “Status”: -1 }; var context; if (typeof GetGlobalContext === “function”) { context = …

Development, Howto

How to Close Case using WebApi

Following JavaScript code can be used to Resolve Incident using JavaScript and WebApi: var incidentresolution = { “subject”: “Put Your Resolve Subject Here”, “incidentid@odata.bind”: “/incidents(0A9F62A8-90DF-E311-9565-A45D36FC5FE1)”,//Id of incident “timespent”: 60,//This is billable time in minutes “description”: “Additional Description Here” }; var parameters = { “IncidentResolution”: incidentresolution, “Status”: -1 }; var context; if (typeof GetGlobalContext === “function”) …

Howto

HowTo: HTML/JS WebResources

We (developers) have a great feature in CRM 2011 release. If you want to give your CRM application new client side features or controls not available OOB and you want your solution to remain supported, you have to use HTML/JS webresources. This article describes some approaches, tricks and code snippets I found or developed while …

Development, Howto

Dynamics CRM 2013: Step-by-step creating dialog windows

In my previous post, I shared with you how to use Microsoft CRM’s internal function to show a dialog window in Dynamics CRM 2013 inline style. In this post, I will provide a step-by-step guide on how to build your own dialogs in CRM 2013 style.