Asked by:
CRM 2011: find opportunity's potential customer is account or contact

Question
-
Hi All,
How to get the potential customer is a account or contact?
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Yogesh Vijay Mulay
- Changed type Payman BiukaghazadehEditor Thursday, February 13, 2014 2:28 PM
Tuesday, January 21, 2014 4:05 AM
All replies
-
Hi,
I think you want to check this through workflow. If so, you could check for a required field on account and contact. Have a look at the bellow picture:
Tuesday, January 21, 2014 4:25 AMModerator -
How to check code-behind, once I retrive the record.
If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Yogesh Vijay Mulay
Tuesday, January 21, 2014 5:38 AM -
Hi,
Here is something that might help
QueryExpression qry1 = new QueryExpression(); qry1.EntityName = "opportunity"; qry1.ColumnSet = new ColumnSet(); qry1.ColumnSet.AllColumns = true; EntityCollection tmp = _service.RetrieveMultiple(qry1); foreach (Entity opp in tmp.Entities) { var customerId = ((EntityReference)(opp.Attributes["customerid"])).Id; var customerName = ((EntityReference)(opp.Attributes["customerid"])).Name; var customerType = ((EntityReference)(opp.Attributes["customerid"])).LogicalName; //EntityType (ie Account, Contact) }
Eric UNG [Senior Analyst Programmer :: Sydney, Australia]
- Proposed as answer by Payman BiukaghazadehEditor Thursday, February 13, 2014 2:28 PM
Tuesday, January 21, 2014 6:04 AM -
Hi,
Use this java script for find Potential customer is account or contact.
function Is_customer()
{
var val;
var iscustomer= Xrm.Page.getAttribute("customerid");
if(iscustomer.getValue()[0]!=null)
{
val=iscustomer.getValue()[0].entityType;
}
alert(val);
}Tuesday, January 21, 2014 6:34 AM -
Hi,
Use this java script for find Potential customer is account or contact.
function Is_customer()
{
var val;
var iscustomer= Xrm.Page.getAttribute("customerid");
if(iscustomer.getValue()[0]!=null)
{
val=iscustomer.getValue()[0].entityType;
}
alert(val);
}Tuesday, January 21, 2014 7:42 AM