Hello Experts
I registered my plugin with pre and post operations to share data between plugins .In shared variables I am able to store the variable .but I can't retrieve in other plugin .shared variables is accessed in post operation.
plugin 1 :
Entity accountentity = new Entity();
// Refer to the account in the task activity.
// Obtain the organization service reference.
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
Guid contactid = context.PrimaryEntityId;
context.SharedVariables.Add("AccountGUID",(Object)contactid.ToString());
plugin2:
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parmameters.
Entity entity = (Entity)context.InputParameters["Target"];
// Verify that the target entity represents an account.
// If not, this plug-in was not registered correctly.
if (entity.LogicalName != "account")
return;
try
{
// Create a task activity to follow up with the account customer in 7 days.
Entity accountentity = new Entity();
// Refer to the account in the task activity.
// Obtain the organization service reference.
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
if (context.SharedVariables.Contains("AccountGUID"))
{
Guid customerid = (Guid)context.ParentContext.SharedVariables["AccountGUID"];
Entity entitytask = new Entity("task");
entitytask["regardingobjectid"] = new EntityReference
{
LogicalName = "account",
Id = customerid
};
entitytask["subject"] = "Send an Email to new Custoemr";
service.Create(entitytask);
}
//var contactid = context.PrimaryEntityId;
}
in plugin 2 the sharedvariables does n't contain that variable ?why if any one suggest helpful
thanks and regards
Murali