Know if an email has been replied or worked upon

This is very common question that i get on community or on other forums on how to identify if an email has been replied or worked upon by a user.

Well the easiest approach to tackle this is that there is a field on emails as parentactivityid  which can be used and put on the views, this field basically will contain the email on which you have replied.

So if this field contains data, it means someone has replied on this email.

for example , see below :

Capture

  1. My first email doesn’t contain anything in the parentactivityid because its a fresh sent email.
  2. My second is actually the email which i have sent above – it has the parent activity id as the first email.
  3. My third email is a reply on the previous email received, hence it has that in the parentactivity id column.
  4. My last email is the received email which has the parentactivity id as the email which i sent previously.

Hence, the logic should be like.

1.)

Email direction = incoming

parentactivityid = contains email

Action = you have to reply to this email.

2.)

Email direction = outgoing

parentactivityid = contains email 

Action = it means it has been replied.

3.)

Email direction = incoming

parentactivityid = doesn't not contains emails

Action = you have to work on it

4.)

Email direction = outbound 

parentactivityid = doesn't not contain email

Action = its a fresh email.

I hope it makes sense.

Cheers!

How to Setup Microsoft Dynamics CRM Portal

In this blog i am going to show you how you can setup Microsoft dynamics CRM Portal trial for your learning or business purpose.

  1. Login to dynamics CRM> click on main navigation and click on “Administration” button(it shows in my local language in the screenshot but you can look for that symbol):
    1.jpg
  2. Once you are navigated to Admin Center click on the main Navigation again and scroll down to “Admin Centers” , look for ” Dynamics 365″.
    2.jpg
  3. you will be presented with the screen like below, click on Applications tab:
    3
  4. Now, Click on “Portal Add-On” and then click on “Manage” Button:
    4.jpg
  5. you will be presented with Main portal setup page, Enter the desired name and select the URL you want ( make sure its unique):
    5
  6. Scroll down more and enter details like the admin , portal type and portal audience. Once you okay with the details entered click on Submit:
    6.jpg
  7. Once you click on submit you will be presented with Agreement page , click on Accept.
  8. Post this it will show you the below page – which means you portal setup has started:
    7.PNG
  9. Wait for 5 mins and login back to dynamics crm , you should now see a new module added as “Portal”:
    8.png
  10. You can now login to your portal using the URL which we create on the step 5:
    9

 

I hope this helps. I will be writing few more blogs on how you can get started with Customizing your portal as per business needs so stay tune.

 

Cheers!

 

———- is not a valid status code for state code entity

Often you see this error in your plugin or Webapi actions when you trying to play with the status and status reasons in microsoft dyamics crm.

so, lets understand this.

Suppose i have below status and status reasons:

status

as you can see there is a set of status reason you can only combine with and “Active” Statecode and some with “Inactive” statecode.

So ,if you have a status reason which belongs to an active statecode but you use it with an inactive statecode and vice versa, you will be presented with this error.

and in the error first line you can actually see what optionset value it is talking about.

i hope this helps.

Cheers!

Create Text log file – Simplest way possible

We all need to log errors, information, warnings when writing your console application.

while there are several third party tools/methods available which you use in your solution such as Nlog, Log4net… etc. I would still prefer to create my custom code to generate the log file and capture all details as those tools might work on some machine and on some wont also depends badly on the permissions on the system.

below is simple code that i use :

using System;
using System.IO;

namespace YourNameSpace
{
 public static class ErrorLog
 {

public static void Logger(string ErrorCode, string ErrorMsg)
 {
 try
 {
 string path = Directory.GetCurrentDirectory();
 path = path + "\\Logs\\";

// check if directory exists
 if (!Directory.Exists(path))
 {
 Directory.CreateDirectory(path);
 }
 path = path + DateTime.Today.ToString("dd-MMM-yy") + ".log";
 // check if file exist
 if (!File.Exists(path))
 {
 File.Create(path).Dispose();
 }
 // log the error now
 using (StreamWriter writer = File.AppendText(path))
 {
 string error = "\n" + DateTime.Now.ToString() + ":" + ErrorCode + ":" + ErrorMsg;
 writer.WriteLine(error);
 writer.Flush();
 writer.Close();
 }

}
 catch (Exception ex)
 {
 throw new Exception(ex.Message);
 }
 }
 }
}

add this file to your code and later you can use it in your solution anywhere like below :

 ErrorLog.Logger("Info","yourtexthere");

kindly note that this will generate the logs file on your directory where the code is running in that case in the “BIN” folder. You can tweak the code to put it somewhere else if you need.

logs

Hope this helps!

Cheers!

Difference between Primary and Participating field in business rule

In Microsoft Dynamics CRM buiness rule we use two types of fields the one which we are using in our “if” condition and other one which we are calculating or taking an “Action”.

if you have open the form editor and click on a field property  , by navigating to business rule tab you will see , CRM will tell you the current field is a primary field in which business rule and participating on which business rule:

business rule

 

so the difference is :

  1. Type – Primary : this field is being used in business rule in a “if” conidition and its the base of business rule.
  2. Type – Participating : this field is being calculated based on the other field (Action).

 

hope this helps!

Cheers!

Unified Service Desk 3.2.0 is Released

Unified Service Desk version 3.2.0 has major enhancements on performance diagnostics, faster load times for CRM entity pages and graceful handling and recovery of crashed or unresponsive Internet Processes.

3.2.0.jpg

read the full blog here :  https://blogs.msdn.microsoft.com/usd/2018/02/08/unified-service-desk-3-2-0/

cheers!

How to read a CSV file in a simplest way possible

Hello folks,

I am sure if you have been working with Microsoft Dynamics CRM or any other .net related application – you must have got this situation where you need to read data from a CSV file and do something with it for e.g. either to update this in CRM or write to other file.

here is the code that i used recently – i went through alot blogs and tutorials on how to do this but everything looked confusing to me. So I ended up doing this :

public string ReadCsv()
{
try
{

string csvPath = ConfigurationManager.AppSettings[“FilePath”]; // here i have used configuration manager as i am taking path from config file but you can simple pass the path in string “path” format.

//Read the contents of CSV file.
string csvData = File.ReadAllText(csvPath); // once you do this you will be able to read all the rows of the file. the format of the string would be like /r/n12341/r/n12344/r/rn2244……..

//Execute a loop over the rows.
foreach (string row in csvData.Split(‘\n’)) // removing the /n from the string you will get /r1234 in “row now
{

var id = row.Replace(“\r”, string.Empty); // finally removing “/r from the string.

//your logic goes here , either you can check each id , if this exist in CRM one by one using query by attribute or update this field in CRM etc.

}

 

i hope this helps!

How to enable Image for an entity in Microsoft Dynamics CRM

In this blog i am going to discuss about “Image” type attribute/field in CRM and how this can be used to enable image for an entity on the form like below:

8

 

Lets see how we can achieve this:

  1. Navigate to Customization>Customize the system>Entities & navigate to the entity for which you want to enable image> go to fields > create a new field as below:2
    Give it a name and select Datatype as image – as soon as you select datatype , you will notice that Schema of the field is set to “entityimage”. Save & close
  2. Now 2nd step is to navigate to entity definition as below:3In the property ” Primary Image” – you will see the name has come , if not select it from the dropdown.
  3. Final Step is to make form changes, navigate to the form and open form editor and click on “form properties” , select the below option:4
  4. Lastly save and close the form and publish all customizations. Navigate to the entity record , you will notice an image icon is now appearing on the form.
    5
  5. click on the image and browse the image you want to set:6
  6. After Selecting the Image click okay and you will see image is appearing now:7

 

I hope this helps!

 

cheers!

Difference between Articles, Knowledge Articles & Knowledge Base Record in Microsoft Dynamics CRM

I had so much confusion around these three terms in Dynamics CRM until i didnt actually paid my full attention to them and understood which one is what and where to use them.

  1. Article(kbarticle)
  2. Knowledge Article(knowledgearticle)
  3. Knowledge Base Record(knowledgebaserecord)

Let’s understand one by one briefly

1.Article

Articles are actually an old version of knowledge articles in crm. Currently you will see both are present and can be used as per requirement or as you need them. Knowledge Articles have advanced functionality.

for e.g Engagement hub will use your knowledge article entity and you work on them in engagement hub. Articles are specific to Dynamics CRM.

Knowledge article has functionality like versioning and translation. Apart from these functionality remains the same like creating , reviewing , approving and using them.

for more details you can visit below post : https://msdn.microsoft.com/en-us/library/gg309345.aspx#EarlierKBArticle

 

2.Knowledge Article

As I Mention above, knowledge article is the latest feature in CRM and has rich functionality above the legacy articles.

you can create minor and major versions of article which can be crucial and important if you have an organization where lot of changes and upgrade happens.

Apart from it you can can create knowledge article translation and can be in more than 150 languages. To understand a knowledge article life cycle and other things , see below post :

https://msdn.microsoft.com/en-us/library/gg309345.aspx

 

3.Knowledge Base

The knowledge base record entity represents a record containing the metadata of a knowledge base record in Parature.  It is used specifically for parature integration.

Parature is a cloud-based customer engagement solution which Microsoft acquired in 2014.  Enterprises can deploy Parature to provide self-service capabilities to their customers.

Know more about it :  https://msdn.microsoft.com/en-au/library/dn996872.aspx

 

I hope this helps!

Cheers!