if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)
{
Entity targetEntity = (Entity)context.InputParameters["Target"];
Guid appid = targetEntity.Id;
if (targetEntity.LogicalName != "appointment")
{
return;
}
else
{
try
{
if (context.MessageName == "Create" || context.MessageName == "Update")
{
// if (targetEntity.Attributes["regardingobjectid"] != null)
{
ColumnSet columns = new ColumnSet(new String[] { "regardingobjectid"});
Entity appointment = service.Retrieve("appointment", appid, columns);
EntityReference reg = (EntityReference)appointment["regardingobjectid"];
Guid regid = reg.Id;
string Name = reg.Name;
string logicalname = reg.LogicalName;
if (logicalname == "lead")
{
ColumnSet col = new ColumnSet(new String[] { "firstname", "lastname" });
Entity Lead = service.Retrieve("lead", regid, col);
name = (Lead["firstname"].ToString() + Lead["lastname"].ToString());
targetEntity.Attributes["location"] = name;
service.Update(targetEntity);
Hi
I just pasted some part of a plug-in code, I am unable to retrieve all attributes on the appointment form , if I use this if (targetEntity.Attributes["regardingobjectid"] != null) getting error . 8 attributed are showing in result set. how do i retrieve all the attributes on the appointment form