Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

How to check customer type within Case

$
0
0

Hi, 

In Case, there is a field  called "Customer". This field is unique, because we can choose between contact or account. 

I created a plugin to move new case to inactive state, if the customer email is match with condition. Here the code:

if (entity.Attributes.Contains("customerid"))
                {
                    Entity customer_detail = _service.Retrieve("contact", ((EntityReference)entity["customerid"]).Id, new ColumnSet(true));

// Code to move case to inactive.

}


The problem is, when user is choose  Account not contact, of course my plugin will throw an error because the contact is not found. The question is, how to check if the customer field contains account or contact ?


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images