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

Set Lookup value On Pre Operation

$
0
0

Hi I have a lookup filed in CRM form i need to set the look up field on Pre-Operation;

For example- if I click on New in crm Form, It need to show look up value.

Entity targetEntity = pluginUtils.GetTarget();
if (targetEntity != null)
{
try
{

if (targetEntity.Attributes.Contains("code")) //&& targetEntity.Attributes.Contains("andid") && targetEntity.Attributes.Contains("organization"))
{
Entity alerRef = resolveLookUpValue(targetEntity.GetAttributeValue<string>("code"), targetEntity.GetAttributeValue<EntityReference>("andid").Id, targetEntity.GetAttributeValue<string>("organization"), pluginUtils);

if (alerRef != null)
{
Entity companyAssociationEntity = new Entity("companyassociation");
companyAssociationEntity["id"] = alerRef.ToEntityReference();
}
}

}
catch (Exception ex)
{
throw new InvalidPluginExecutionException("Unable to Resolve lookup value" + ex.Message + ex.StackTrace);
}
}


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>