Posted in Microsoft Dynamics CRM Reporting, Uncategorized

Connect to Dynamics CRM 365 Online from Excel [Reporting]

I have seen a few blogs on how to connect to dynamics crm but most of them talks about connect with Odata endpoint. However with dynamics 365, Odata has  been deprecated hence you cannot use them and will get error.

Below is the step by step process to connect to dynamics crm 365 online from Excel.

  1. If you do not have power query option in your excel or its an old version. Please download the excel addin from here : https://www.microsoft.com/en-us/download/details.aspx?id=39379   and run the setup chose 32 or 64bit as per your excel.
  2. Once done, Launch Excel and select “Power Query” Tab –>”From Online Services” Option  and select “From Dynamics 365(Online) from the dropdown.
    1.png
  3. In the next tab add Web Api endpoint of your online CRM ( you can find it from Customizations–>Developer Resources–>Copy “Instance Web API” url and paste it below:
    2
  4. In the next authentication screen – select “Organizational Account” and then click on “Sign In”.
    3
  5. Following step 4 will take you to your organization sign page. Enter username and password and click Sign In.
    4.PNG
  6. If Signed In successfully; you will be landed back to the authentication page. Click “connect”.5.PNG
  7. Post this you will be presented with the connected org details( such as entities etc).
    6
    7.PNG
    I hope this helps.
Posted in CRM WebApi/Javascript, Uncategorized

Count Total Subgrid Records in Dynamics CRM using JavaScript

In one of my previous blog I explained,how a rollup field can be used to count child records : Count the number of related child records using a Rollup field

However, Rollup field is calculated with an Async System Job, therefore, if you need something to be triggered on every form load; you will have to write a JS.

Here is a quick code to count the number of related sub-grid record on a form onload. You can put an alert of the count or add that number to a field.

function getTotalGridRecordCount() {
 debugger;
 try {

setTimeout(function () {
 if (Xrm.Page != null && Xrm.Page != undefined && Xrm.Page.getControl("contactopportunitiesgrid") != null && Xrm.Page.getControl("contactopportunitiesgrid") != undefined) {
 var count = Xrm.Page.getControl("contactopportunitiesgrid").getGrid().getTotalRecordCount();
 alert("Total Opportunities:"+count);

}
 }, 5000);
 }
 catch (e) {
 Xrm.Utility.alertDialog(functionName + "Error: " + e.message || e.description);
 }
}

Add script to the form and call this function on Onload event. Open the form to see it in action:

1

 

Hope this helps! cheers!

Posted in Uncategorized

RIP SDK – Dynamics CRM 365 v9

As per the recent communication from Microsoft, Microsoft Dynamics CRM SDK will not be available on Microsoft downloads. If you are working on Dynamics 365 v9, well you have to download every component which was available in the SDK individually.

Every tool will be available via NuGet Manager.

The name will be : Developer Guide not Dynamics CRM SDK.

For more information, visit the below blog :  https://blogs.msdn.microsoft.com/crm/2017/11/01/whats-new-for-customer-engagement-developer-documentation-in-version-9-0

Here is the step by step information on how to download these tools using powershell :  https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/download-tools-nuget

 

i hope this helps.

Cheers!

 

Posted in Business Rules

Calculation Using Business Rules in Microsoft Dynamics CRM

Hi Guys,

We all love business rules & i am a big fan of them since they save alot of your time developing javascript for small actions that you need perform for e.g from making a field mandatory to setting fields value or showing error message.

Well , fortunately business rules can help if you need to perform some simple calculation on a form based on field values too. Lets get into action.

I have thought of a silly scenario where if i have estimated closed date on opportunity – i would like to set a date of 10 days before the estimated closed on a custom date field that i have created. Based on that i can then perform some other action using this new value either with JavaScript or business itself. This is dynamics crm 365 trial that i am using but its pretty much similar in 2016 or 2015.

So lets create a business role.

  1. Add a new condition to check if Est. Closed date contains data AND the new field(date difference) doesn’t not contains data.
    please note that if we don’t check the second condition the business rule will run every time and set the value to date difference on every on load even if date difference has been set last time :1
  2. Now once we are done with condition , lets add the action to it “set field value”. and from right side select the field = “date difference” , Type = “Formula”, other field = “Est Closed Date” , Operator = “-“, Type = “Value” , Days = “10”. Take a look at reference below:
    2
    3
  3.  now lets apply , save , Activate the business rule.
  4. Lets open a record a with estimated closed date and see it in action 🙂
    4
  5. the date difference field has been set to 10 days before the est close date which is 24-02-2017.
    5.PNG

There you go , it was simple example but i am sure you can perform some more complex calculation and not on just date fields but on currency and other fields.

Hope this helps!

Cheers!

Posted in Uncategorized

Learn Microsoft Dynamics CRM – Basics, Customization & Configuration

aads-education-offers-microsoft-dynamics-crm-training-2-638

In office, while i am blogging or in dynamics community ; i always get this question that how a fresher can start learning CRM. Well let me tell you learning CRM is very easy since it is a Microsoft technology in which we have been living & using from our outlook to windows.

Well on internet ; information is pretty much distributed and in bits & pieces but i have collected the below information in sequence on how you  can you start from zero and go till 100 🙂

  1. First things first you should know what is CRM , well according to microsoft definition is :
             crm definition.PNG

    “CRM solutions streamline processes and increase profitability in your sales, marketing, and service divisions. A strong CRM solution is a multifaceted platform where everything crucial to developing, improving, and retaining your customer relationships is stored. Without the support of an integrated CRM solution, you may miss growth opportunities and lose revenue because you’re not maximizing your business relationships.”

  2. Next i would suggest you to see above everything in action :  https://www.chalkstreet.com/microsoft-dynamics-crm-tutorial    ,  https://mva.microsoft.com/en-us/training-courses/introduction-to-microsoft-dynamics-365-17593?l=J6OdOYtqD_906312570
  3. Once you have done this – i think you will be pretty much comfortable having your own CRM environment to get your hands dirty in, therefore go ahead and get your trial :https://trials.dynamics.com/
  4. Time to know how CRM can be available to you(to be technical “deployment options available in CRM”) :  https://www.powerobjects.com/2015/10/21/upgrading-crm-crm-online-vs-on-premises-finding-the-best-fit-for-your-organization/
  5. Once you understood all above, my suggestion for you is to now understand the core concepts which makes the whole CRM :

https://www.tutorialspoint.com/microsoft_crm/microsoft_crm_overview.htm

In this tutorial you will learn about what are the core components of  CRM like Entities , Fields, Forms, Business process flows etc. This blog also pretty much explains how you can customize the crm.

6. Now go though this blog and do same in your trial version :

https://crmbook.powerobjects.com/system-administration/customization/

i will talk about customizing, fields, forms , entities , charts, dashboards,solutions etc.

7. Security model – Now this is a major topic which you must understand very well without which it will be very difficult for you to master dynamics crm else you will be missing out on very small/minor things during your career

https://www.youtube.com/watch?v=_vfp3C11a3Mhttps://www.youtube.com/watch?v=An-VgsHEp9A

8. Now , one of the main features of crm is “Processes” , processes are the main component in CRM which helps you to perform actions based on your needs :

a. business rules :  http://www.inogic.com/blog/2016/12/business-rules-dynamics-365/

b. Workflows :  https://crmbook.powerobjects.com/system-administration/processes/workflows/

c.Plugins :  https://crmbook.powerobjects.com/extending-crm/plug-in-development-and-workflow-extensions/plug-ins/developing-a-plug-in/

9.Apart from it most of the stuff you would do through JavaScript which you coudnt  using business rule, mainly javascript is used to perform complex logics else i always recommend you to use business rules  :  https://www.youtube.com/watch?v=wxMB-cIQPUw

 

if you go through all of the above carefully , you will be in a position to work on dynamics crm confidently.

Please leave your comment if i have missed out anything major or you have any question, need guidance on any of the topics above.

happy crm learning, cheers!

Posted in CRM WebApi/Javascript, Uncategorized

Lock all fields on a form using Javascript- Microsoft Dynamics CRM

Hi Guys,

We all get requirements to lock the whole form to stop people from editing the record.

There are some out of the box options available to achieve this :

  1. Create a business rule : you can easily create a business and use lock field feature however you will have to select all the field on the form one by one – for .e.g if you have 50 fields on the form, you will have to add action for all of them. Moreover another limitation is if a field is removed from the form – you business rule will stop working.
  2. We all know if record is status is set to inactive – form become uneditable but in this scenarios we want to keep the record but uneditable.

Therefore, we come down to our final easy solution to tackle all problems above, the Javascript. Have a look on the below code :

 function disableFormFields()

{

       Xrm.Page.ui.controls.forEach(function (control, index) {

           var controlType = control.getControlType();

           if (controlType != “iframe” && controlType != “webresource” && controlType != “subgrid”)

           {

               control.setDisabled(true);

           }

       });

}

above code takes the control of the form directly rather then of each field & locks all of them. Just call the function on Onload , I have used this on my form and it looks like below:

lockfield

 

Now you can definitely add your own logic into this code for .e.g you put a if condition to check some value based on which you want to lock all fields and another things if you need to leave some fields unlocked you can again you a if condition , check the value and use below

just add the below code to above code :

if (crmfield = abc)

{

Xrm.Page.ui.controls.get(“CrmFieldShcemaname1”).setDisabled(false);

Xrm.Page.ui.controls.get(“CrmFieldShcemaNam2”).setDisabled(false);

Xrm.Page.ui.controls.get(“CrmFieldShcemaNam2”).setDisabled(false);

}

 

hope this helps you!

cheers

Posted in Uncategorized

How to insert dynamic values from custom entities in an email template – Microsoft Dynamics CRM

if you work with email templates; you might have to create a template which is to be sent from a custom entity & hence you will need field values from that entity.

Now out of the box – CRM doesn’t provide you an option to populate the field values from a custom entity.

So lets dig in and understand ; how this can be done.

1.Go to Templates from CRM settings and click on email templates ; click on “new” & in the popup select template as “Global”:

1

now if you notice – CRM gives you templates for individual entities as well but since we need one for custom entity – we will have to select global.

2. In the Template form, fill subject & Title.

2

3.In this example – i have a custom entity Loan, i would like to send email from this entity using an email template with Loan amount and customer populated. Customer is a lookup so lets do it.

Standard format is : {!EntityLogicalName:FieldLogicalName;}

for lookup values ; you would want to retrieve the name so you have to do it like below :

3

4. Hit save and it will be resolved:

4.png

5. now lets retrieve the loan amount which is a currency field:

5

6. Hit save and see the how this resolves as well:

6

if you have noticed – i have also inserted the current user name from out of the box feature “insert/update” from top button.

Similarly, you can do this with other fields like below :

single line of text : {!EntityLogicalName: FieldLogicalName; Default Text}

Date :  {!new_loan:new_approvaldate/@date;}
Time : {!new_loan:new_approvaldate/@time;}

Lookup : as we did above

Optionset : {!new_loan:new_loantype/@name;}

7. Now lets see our template in action ; i will go the loan entity record and insert a template:

7

Yay! it worked like a charm.

so , that is how it is done. Let me know if you face any difficulties.

Cheers!!

 

 

 

 

Posted in Uncategorized

Create a Gantt Chart in MS CRM

Nice blog by crm chart guy – made it look easy and simple.

crm chart guy

Until recently I thought that Gantt charts couldn’t be done in MS Dynamics CRM without turning to some serious development, which I found unfortunate because this is a popular type of chart and users find them easy to read. Turns out you can, and it’s not that difficult to create a simple Gantt Chart in MS CRM.

EDIT regarding CRM2011: This post relies on changing the aggregate of a date field to “min”, which seems to be exclusive for CRM2013. CRM2011 will give you an import error when you make that change to the xml. However, a reader has been kind enough to send me the details of how make it work for CRM2011. In the fetchxml you will need to remove the aggregate=”min” from each of the attributes, and also remove the groupby=”true” along with its corresponding alias in the categorycollection. Thank you Nils for sharing.

In this…

View original post 1,163 more words

Posted in Uncategorized

Run On-Demand Workflows on bulk records using XrmToolBox – bulk workflow execution

Microsoft Dynamics CRM On-Demand workflows are great and help in so many ways/

you can easily run these on records such as 100 , 500, 1000 & may be on 2000? But wait… how about 10000 records? thats where it might become very hectic but with introduction of a new plugin/tool in XrmToolBox – it has become very easy. – thanks to Andy Popkin 🙂

All you have to do is download XRM toolbox from the main website or github :

https://www.xrmtoolbox.com/

https://github.com/MscrmTools/XrmToolBox

Now once you have this tool and extracted – you might not have the bulk workflow execution tool in it. you will have to go to plugin store from the xrm tool and add it as belowpluginstore

once you go there it will give you hell lot of plugins you have to look for “bulk workflow execution” plugin and install it as below :

installplugin

once this is done you should be able to search this tool in your XRMtoolbox :

search&run

double click on it and get into action

  1. make sure your workflow is already is configured to run as ondemand
  2. all ondemand workflows in the organization will come under the dropdown i have highlighted.
  3. once you select the wofklow – it will give a list of all views from the entity which is a primary entity of the workflow. you can select the view and run your workflows on view returned records.
  4. you can also define your own custom fetch XML query ; which we will do now.

1

here i am using the below fetch XML as an example :

<fetch distinct=”false” mapping=”logical” output-format=”xml-platform” version=”1.0″ >

<entity name=”task” >

<attribute name=”subject” />

<filter type=”and” >

<condition attribute=”scheduledend” operator=”null” />

<condition attribute=”statecode” operator=”eq” value=”0″ />

<condition attribute=”createdon” operator=”on-or-before” value=”2017-12-15″ />

</filter>

</entity>

</fetch>

2

you can click on validate to validate your query ; once your query is confirmed you will have run workflow button enabled next to it and also will show how much record it has retrieved. click on the run workflow button and see the action :

3

it will work like a charm and will definitely save alot of your time.

i will be sharing more cool add-on in XrmToolBox because i am a fan of this tool ; so stay tuned.

 

cheers!

 

 

Posted in Uncategorized

Escape from waiting condition workflows – Microsoft Dynamics CRM

Waiting condition workflows are definitely great and almost perfect for the functionality where you have to wait for months for something to be triggered.

but are they really good ; should actually keeping them alive for months is a good idea? Well there are certain measures that you can take if you really need them :

  • Combine waits and check condition. So you have a process that emails a customer service representative three days after the case is open. No need to email them if the case has been closed, right? After the wait, have the workflow check conditions to verify that the condition that triggered the workflow is still true. If not, cancel , but stop it.
  • Use a child workflow to do something when wait time is over.
  • Use short wait periods. 20  minute waits are ok. 1 year waits are bad.
  • Use timeouts rather then wait condition.

 

however apart from the above there is another way which can be effective in terms of your organization performance.

Create an entity to keep the crucial date or timestamps on which you want to do something.

  1. create an entity(workflow task) , with fields as “regarding” & “Due date”.
  2. In your workflow – if you need to do something for example 20 days before the expiration date – calculate that date and create a a new record for the entity created(workflow task) with regarding as the current record and the date in due date field.
  3. Stop your workflow – just end it right there.
  4. Create a bulk delete job -that you should run everyday which checks for the records who’s due date is today and delete them.
  5. Create a workflow on the new entity created(workflow task) – run it on deletion of the record and do the actual things you wanted to on your record from that workflow for example closing the activity , sending email etc.

 

Best thing about this approach this that you can continue using this logic in your organization with n number of records & entities.

 

let me know your thoughts on this.

Cheers !