Tag: CRM 2015

Auto-Numbering through Real Time workflows (No customization, No Add-on)

Dear Readers,

Generating a number automatically within CRM is one of those requirement which is been asked , almost by all client/project. We all know that auto-numbering is available out of the box for entities like case, contracts, quote, order, invoice, articles & campaigns. But usually we have two situations:

  1. Auto-numbering for entities like account, contact, opportunity etc. (not available in out of the box auto-numbering feature)
  2. Condition wise auto-numbering (business unit wise, category wise)

I am going to demonstrate situation 2, which will give you an idea for situation 1 too.

What you would need ?

  • A custom entity
  • A Real-time workflow

I am taking an example where I want my accounts should populate ‘account number’ based on ‘account category’. I have also created a lookup field on my account called ‘auto-counter’ which you can see just below category.I have got three categories in my account:

  • Direct (DC)
  • Distributor (DB)
  • Secondary (SC)

1

What I want ?

I want an account number to be generated having prefix of category and then sequential 6 digit number like if my account category is direct and i am creating the very first account in CRM then account number must be like DC100001.In your case it can even be like prefix should be Business Unit’s initial; method remains same.

How to go about it?

Create a custom entity with basic field Name and other fields to be created would be equal to no. of conditions you have for auto-numbering; in my case i have 3 conditions that are account category. You might have a situation wherein you want it based on Business unit so, you will have to create fields equivalent to the no. of business units you have.

Go to settings>>Customization>>Customize the system

2

Click on new to create a new entity

3

You will now have to create records equal to the no. of conditions you have; so i have 3 categories in account which means 3 conditions and 3 records:

4

I have kept the name as DC/DB/SC, based on the prefix i want for my account number and in the fields based on my condition i have filled DC, DB & SC as 100000 (since i wanted a 6 digit no.); Please note that, you will have to create separate records for each condition. In the first record I have created, I have filled name as DC and field ‘DC’ (whole number)  as 100000. Similarly, In the second record I have created, I have filled name as DB and field ‘DB’ (whole number)  as 100000 and so In the third record I have created, I have filled name as SC and field ‘SC’ (whole number)  as 100000

Now we can create a real time workflow on accounts:

6

Now we can add steps to this workflow along with if and updates:

7

First of all I am checking the category of my account; Secondly, I am updating auto-counter lookup field on account with relevant record of category:

8

Then I am updating my auto-counter record (increment by 1)

10

Then I am updating my account number of account with a combination of name-number of my auto-counter relevant record:

12 11

Now if i create an account, account number is generated as soon as i save my record; something like below:

14

Tips:

  • Please do hide, auto-counter field on form once your workflow starts working.
  • To remove the comma from the Auto-Number field (whole number), copy it to a calculated field of Single Line of Text

Hope you find it helpful !

Thanks for Reading !

Happy CRMing !!

Adding fields to Quick Find Search/Global Search/Universal Search Result in MS CRM 2015

Hello Readers

With the Release of CRM 2015, one of the most exciting feature is Quick Find Search/Global Search/Universal Search. There are many blogs already existing to explore this functionality.

How to Search:

http://blogs.msdn.com/b/mvpawardprogram/archive/2015/01/12/new-microsoft-dynamics-crm-2015-multi-entity-search.aspx

Setting Up & Configuration:

http://blog.sonomapartners.com/2014/09/dynamics-crm-2015-first-look-multi-entity-search.html

Tablet & Outlook client:

http://www.cargas.com/microsoft-crm-2015-universal-search-advanced-find-improvements/

What I am going to tell you today is, how to change what you want to see in the search results? Yes, its true; you can change it as per your requirement. Following is a screenshot wise step by step process to achieve the same:

On the top navigation, locate to quick search and type text>>click enter (I am searching an account named ‘Movida’)

1

Currently, what you can see is Account Name, Account No. & Primary Contact

If you wish you to change it to Account Name, Account No. & Address 1:City; Go to settings>>Customization

2

Click on customize the system

Expand Entity & Go to Account>>View

4

Locate-Quick Find Active Accounts under views

5

Double click on Quick find view to modify it; the first three columns here are the fields which you see in the results of Global/Universal Search

6

So, if i wish to add Address 1: City. I will need to click on ‘Add view columns’and add my desired field here and with the help arrow keys visibl, i will bring it to either of 1st three positions.

Now, click ‘Save & Close’ and Publish customizations; you will now see the results you wanted.

Hope you find it helpful !

Thanks for Reading !

Happy CRMing !!

Calculating Time Spent (in minutes) on an activity via Javascript in MS CRM 2015

Hello Readers,

its been so many days, I was waiting to write something very commonly required yet useful feature.

I have been asked so many times by my customers, How can i see the time spent on an activity, if we have entered the ‘Start Time’ & ‘Finish Time’. Yes, we can, its easy and simple. This time calculation can also be used for calculating, how much total we spent on a case resolution if we replace ‘Start Time’ by ‘Created on’ & ‘Finish Time’ by ;Actual Resolution on’ ; so on and so forth there can be multiple usage of this javascript based on your time calculation requirements. In this scenario, i am taking up a custom activity called ‘Repair Activity’; following is a screenshot:

b2

 

Please note that the time spent field is a Deciaml Field

We need to follow the following steps:

Step 1: write the Javascript code as shown below-

function time()
{
var stdate=Xrm.Page.getAttribute(“new_starttime”).getValue();
var endate=Xrm.Page.getAttribute(“new_finishtime”).getValue();

if(stdate==null && endate==null)
{
alert(“Please enter the Start Time / Finish Time…”);
return false;
}
if(stdate==null)
{
alert(“Please enter the Start Time !”);
return false;
}
if(endate==null)
{
alert(“Please enter the Finish Time !”);
return false;
}

var st=stdate.getTime();
var ed=endate.getTime();
var sdiff=(ed-st);
var h=(sdiff/60/1000);
var p=parseInt(h);
var tm=p.toString();
Xrm.Page.getAttribute(“new_timespent”).setValue(tm);
}

Step 2: Add a webresource in CRM

Add a new webresource by typing in a name, Display Name, Language & Type>>Save & Publish>>URL will be genrated

b6

 

Step 3: Add this webresource to form Libraries

Go to ‘Repair Activity’ Form Editor>> Form Properties>>Form Libraries>>Add

b5

And also manage the ‘Event Handler’ by setting the event when you want this Javascript to be executed, so, i will set it on ‘On Save’ & set control to ‘Form’ & click OK

b7

Once done save the form & publish it

Result : That’s it, here you go,now we can see the time spent as soon as we save the form; this javascript also, gives us an alert if we have not provided any value in Start & Finish time

b8

b9

Happy CRMing !!