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

crm simple plugin development

$
0
0

I need to develop a plugin in c# when the zipcode is 12345 the freight amount in quote is set to $100.

I have the following logic..but it doesn't work:

case "Create":
if (pluginExecutionContext.InputParameters.Contains("Target") &&
pluginExecutionContext.InputParameters["Target"] is Entity &&
pluginExecutionContext.OutputParameters.Contains("id"))
{
Entity entity = (Entity)pluginExecutionContext.InputParameters["Target"];
tracingService.Trace("Create [" + entity.LogicalName + "], id [" + entity.Id + "]");

if (entity.LogicalName == "quote")
{
quoteId = entity.Id;
OrganizationServiceContext orgContext = new OrganizationServiceContext(orgService);
Entity quote = orgService.Retrieve("quote", quoteId, new ColumnSet("freightamount", "shipto_postalcode"));

if (!quote.Attributes.Contains("shipto_postalcode"))
{

return;

}

string zipCode = quote.Attributes["shipto_postalcode"].ToString();

if (zipCode.Equals("12345"))

{

quote.Attributes["freightamount"] = 100;

orgService.Update(quote);

}


}
}
break;


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images