Hello Guys,
I am writing a plugin to change status of the corresponding OOB- Service Activity record when the OOB - Appointment record is deleted.
So I have written a plugin on pre-validation Delete operation on the appointment entity. However, it is failing in the line highlighted(See below). Please see attached screenshot of error. I know its failing in that step because the trace message from previous steps are successfully shown. However, the trace
messages below the highlighted lines are not there.
using DEVPlugins;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Neudesic.IP;
using System;
using System.Collections.Generic;
using System.Linq;
namespace DEVPlugIns
{
public class ChangeStatusofServiceActivity : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService _service = factory.CreateOrganizationService(context.InitiatingUserId);
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
if (context.InputParameters != null)
{
tracingService.Trace("Entering method - Finding where it is going wrong ");
Entity localAppointment = new Entity("appointment", context.PrimaryEntityId);
tracingService.Trace("Appointment Record Retrieved ");
localAppointment["bamf_testone"] = "Value Updated Successfully";
var appointmentsubject = localAppointment.Attributes["subject"].ToString();







