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

Issue with CRM Plug-in

$
0
0

Hi all,

I'm creating an plugin to create a lead on creation of an campaign response. This plugin will be executed on the create an operates in the pre-operation stage.

OrganizationRequest req = newOrganizationRequest("CreateLeadFromCampaignResponse");

req["CampaignResponse"] = campaign;

req["Target"] = newEntityReference("campaignresponse", campaign.Id);

OrganizationResponse response = service.Execute(req);

if (response != null)

{

EntityReference lead = (EntityReference)response.Results["Lead"];

tracingService.Trace("lead created with id= " + lead.Id.ToString());

campaign["customer"] = createParty("lead", lead.Id);

}

The CreateLeadFromCampaignResponse creates an lead via an action. However i get an error that the campaignresponse with ID does not exitst, which is logical because it's not in the DB yet.


Is there an way, or what is the safest way to create this functionality in this stage?


Viewing all articles
Browse latest Browse all 46379

Trending Articles



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