Posts

Showing posts from April, 2016

Call Workflow within Workflow in MS Dynamics CRM 2011/2013/2015/2016

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Activities; using Microsoft.Crm; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Workflow; using Microsoft.Xrm.Sdk.Workflow.Activities; using Microsoft.Xrm.Sdk.Client; using Microsoft.Xrm.Sdk.Messages; namespace cel_WorkflowActivities {     public sealed class runRelatedWorkflow : CodeActivity     {         [RequiredArgument]         [Input("Workflow To Execute")]         [ReferenceTarget("workflow")]         public InArgument<EntityReference> workflowId { get; set; }         [RequiredArgument]         [Input("Related Entity Logical Name")]         public InArgument<string> entityName { get; set; }         [RequiredArgument]         [Input("Attribute Logical Name")]         public InArgument<string> attributeName { get; set; }      

Differences between Dynamics CRM Workflows and Dialogs and Plugins

Image
Differences between Dynamics CRM Workflows and Dialogs Workflows Dialogs Can be either started by a user or can be automated. Must be started by a user. Asynchronous processes, and no user input. background process. Synchronous processes, require user input, a wizard-like interface will popup Triggers are supported for workflows Triggers are not supported for dialogs. Differences between Workflows and Plug-ins Plug-in Workflow Executes immediately before or after the core operation (synchronous).Can also be queued to execute after the core operation (asynchronous). Queued to execute after the core operation (always asynchronous). Synchronous plug-ins can increase the platform’s response time because they are part of the main platform processing. Asynchronous plug-ins have less impact on server response time because the code is run in a different process. Less impact on server response time because the code is run in a different process. To register a plug-in with the plat

Create Dynamic Table Row in MS CRM 2011/2013/2015/2016

<html><head><meta charset="utf-8"></head><body>     <link href="../StylesheetLibrary/payperioddashboardstyles.css" rel="Stylesheet" type="text/css">     <script src="../../ClientGlobalContext.js.aspx" type="text/javascript"></script>     <script src="../JavaScriptLibrary/jquery1.6.2.min.js" type="text/javascript"></script>     <title>EEPRs</title>     <script language="javascript" type="text/javascript">         /************************************************         getParameters - function to handle the extraction         of the extraqs parameters         ************************************************/         function getParameters(values, unescapeValues) {             //Taken from samples in the CRM SDK             var parameters = new Array();             var vals = ('?' == valu

Scheduled Workflows in CRM

Image
Workflows  are a valuable tool within Microsoft Dynamics CRM. So what if you want to schedule workflows at a certain time, or execute a workflow every night, week, or month? This blog will show you how to create a recursive workflow to be executed for a certain time, and how to create scheduled workflows in CRM. In this example, we will create workflows to be executed every night, which will check if the account’s primary contact is empty. If it is empty, the workflow will find its primary contact and populate the primary contact field. Create the 1 st  new workflow with Contact as the primary Entity. Set this workflow as “Child Process” and as “on-demand” as well: Add a wait condition to start every day or every 24 hours. Add check conditions and actions. One of the actions is called a child workflow, the identical second workflow, right before stop itself. When complete, it will look like the sample below: Create the second workflow similarly. The workflow

Add Two Decimal Digit

Add Two Decimal Digit using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Activities; using Microsoft.Crm; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Workflow; using Microsoft.Xrm.Sdk.Workflow.Activities; using Microsoft.Xrm.Sdk.Client; using Microsoft.Xrm.Sdk.Messages; namespace glt_WorkflowActivities {     public sealed class addTwoDecimals : CodeActivity     {         [RequiredArgument]         [Input("First Decimal")]         public InArgument<Decimal> FirstDecimal { get; set; }         [RequiredArgument]         [Input("Second Decimal")]         public InArgument<Decimal> SecondDecimal { get; set; }         [RequiredArgument]         [Input("Third Decimal")]         public InArgument<Decimal> ThirdDecimal { get; set; }         [RequiredArgument]         [Input("First Whole Numbe

Set Values of all Data Types using Web API in Dynamics CRM 2015/16

Create with all Data Type (Account)  function AccountWithAllDT() { try { //declare variables var uri = null; var stringJSONAcc = null; var entityIdWithLink = null; var getEntityId = null; //create JSON object var JSONAcc = {}; //set fields using JSON object //Single line of text JSONAcc.name = "CompanyName Pvt. Ltd."; //Account Name //Option Set JSONAcc.accountcategorycode = "2" //Category : 1--> Preferred Customer, 2--> Standard //Two Options JSONAcc.donotsendmm = false;//Marketing Materials : 0-->False/Send, 1-->True/Do Not Send //Whole Number JSONAcc.numberofemployees = 151; //Number of Employees //Decimal Number JSONAcc.new_decimalnumber = 345.12; //Decimal Number (Custom Field) //Lookup JSONAcc["transactioncurrencyid@odata.bind"] = "/transactioncurrencies

Create New Account Record using Web API in MS CRM 2015/16

Create new account record on click of custom button. function CreateaccountRecord() {    var serverURL = Xrm.Page.context.getClientUrl();       var account= {};        account ["name"] = "Rajeev Kumar";       account ["address1_city"] = "Pune";          account["primarycontactid@odata.bind"]="/contacts(757B1E74-FBA3-E511-80DE-3863BB341BF0)";  //setting existing lookup                     var req = new XMLHttpRequest();       req.open("POST", serverURL + "/api/data/v8.0/accounts", 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 /*

Get Workflow Guid in Javascript using OData query

I find that using workflow id might be problematic across deployment, so I wrote a function to retrieve workflow’s guid given the workflow’s name. However, please take some care in assigning workflow name to avoid pain. function call() {       alert("Tets"); var name="Create Phone Call Via Js"; alert(name); var wf=getWorkflowId(name); alert(wf);  } function getWorkflowId(workflowName) { var aa=workflowName; var entityId = Xrm.Page.data.entity.getId(); alert(entityId); alert(workflowName); var serverUrl = Xrm.Page.context.getClientUrl(); alert(serverUrl); var odataSelect = serverUrl + "/xrmservices/2011/OrganizationData.svc/WorkflowSet?$select=WorkflowId&$filter=StateCode/Value eq 1 and ParentWorkflowId/Id eq null and Name eq 'Create Phone Call Via Js'"; alert(odataSelect);     var xmlHttp = new XMLHttpRequest();     xmlHttp.open("GET", odataSelect, false);     xmlHttp.send();     if (xmlHttp.status ==

Role based Dashboards – CRM 2013/15/16

Image
Dashboards/charts visibility System charts are like System views, only Users with System Administrator or System Customizer can create and view-able by all users. Personal charts are like Personal views, only visible to User who created them (i.e., Unless the created user shares the personal Dashboard/chart, nobody else can see it, not even a system administrator) Restrict User to access Dashboards/Charts To restrict users to access System dashboards/Charts Open security role –> Customization tab, set ‘System Chart/System Form’ access level to ‘none’ System charts Access/Privileges To restrict users to access Personal dashboards/Charts Open security role –> Core Records tab, set ‘User Chart/User Dashboard’ access level to ‘none’ Personal charts Privileges/Access By removing privileges to User, he can’t access any of the Dashboards or Charts in the system. What if you want  to restrict a particular System Dashboard or Chart to all ‘Sales Person’