Hi,
To get the details/field of an entity, you need to know the Guid value so that you can retrieve the record. Also, plugins works on a trigger i.e. "Create, Update, delete" I am not sure as per your requirement what trigger you are looking for. Also, there are times when a requirement can be easily achieved using out of box workflow than writing a plugin. Further, if the values are same, why do you want to pass values?
Regarding the sample code, you can refer the below for retrieve-
==================
public class SamplePlugin2: IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
if (serviceProvider == null)
throw new ArgumentNullException("serviceProvider");
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
var serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
var tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
var service = serviceFactory.CreateOrganizationService(context.UserId);
var adminService = serviceFactory.CreateOrganizationService(null);
var trace = new Tracer(service, GetType().ToString(), tracingService);
var message = context.MessageName.ToLowerInvariant();
// Retrieve first entity
var entityA = service.Retrieve("new_entityA", new Guid("7468F46B-B955-E911-A975-000D3AE0562F"), new ColumnSet(true));
// Retrieve second entity
var entityB = service.Retrieve("new_entityB", new Guid("AC1d91679fee507d4a1ee7f1cea7a5b5dc"), new ColumnSet(true));
// Compare Field from both entity (assuming they are text fields
if (entityA.GetAttributeValue<string>("new_fieldA") == entityB.GetAttributeValue<string>("new_fieldB"))
{
// Update entity
var entityAUpdate = new Entity("new_entityA", new Guid("7468F46B-B955-E911-A975-000D3AE0562F"));
entityAUpdate["new_fieldA"] = entityB.GetAttributeValue<string>("new_fieldB");
service.Update(entityAUpdate);
}
}
}
==================
Hope this helps.