Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy Send Email Plugin is not working?
    primarykey
    data
    text
    <p>I have created a plugin (using Developer's tool kit) which will send a mail to <code>Participants</code>, which is converted <code>Contacts</code>, whenever a <code>Participants</code> is created. But this plugin is not Working. When I was trying to debug it this following message came in plugin registration tool(SDK)</p> <pre><code>Profiler&gt; Plug-in AppDomain Created Profiler&gt; Parsed Profiler File Successfully. Profiler&gt; Constructor Execution Started: XXXXXXXX Profiler&gt; Constructor Execution Completed Successfully (Duration = 8ms). Profiler&gt; Profiler Execution Started: XXXXXXXXXXX Plug-in&gt; Entered CRMEmailToParticipantsPackage.EmailPlugins.PostParticipantCreate.Execute(), Plug-in&gt; Exiting CRMEmailToParticipantsPackage.EmailPlugins.PostParticipantCreate.Execute(), Profiler&gt; Profiler Execution Completed Successfully (Duration = 57ms). Profiler&gt; Profiler AppDomain Unloaded </code></pre> <p>. Pipeline Stage is Pre-Validation on Create Message. And this is my Code:</p> <pre class="lang-cs prettyprint-override"><code>protected void ExecutePostParticipantCreate(LocalPluginContext localContext) { if (localContext == null) { throw new ArgumentNullException("localContext"); } // TODO: Implement your custom Plug-in business logic. IPluginExecutionContext context = localContext.PluginExecutionContext; IOrganizationService service = localContext.OrganizationService; if (context.InputParameters.Contains("Target") &amp;&amp; context.InputParameters["Target"] is Entity) { try { Entity entity = (Entity)context.InputParameters["Target"]; if (entity.LogicalName == "new_participant") { Guid Contact_id = ((EntityReference)entity.Attributes["new_participantscontact"]).Id; Guid trip_Id = ((EntityReference)entity.Attributes["new_tripparticipants"]).Id; ColumnSet col1 = new ColumnSet("new_name", "new_date", "new_destination"); Entity trip = service.Retrieve("new_trip", trip_Id, col1); var Trip_name = trip.Attributes["new_name"]; var Trip_date = trip.Attributes["new_date"]; var Trip_destination = trip.Attributes["new_destination"]; string emailBody = "Hi, your " + Trip_name.ToString() + "is booked on : " + Trip_date.ToString() + "; Destination : " + Trip_destination.ToString(); Guid _userId = context.UserId; ActivityParty fromParty = new ActivityParty { PartyId = new EntityReference(SystemUser.EntityLogicalName, _userId) }; ActivityParty toParty = new ActivityParty { PartyId = new EntityReference("new_participantscontact", Contact_id) }; Email email = new Email { To = new ActivityParty[] { toParty }, From = new ActivityParty[] { fromParty }, Subject =Trip_name.ToString()+ " :Trip Details", Description = emailBody, DirectionCode = true }; Guid emailID = service.Create(email); SendEmailRequest req = new SendEmailRequest(); req.EmailId = emailID; req.TrackingToken = ""; req.IssueSend = true; SendEmailResponse res = (SendEmailResponse)service.Execute(req); } } catch (FaultException ex) { throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex); } } } </code></pre> <p>Have I done any thing wrong here?</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload