Hi all,
I need to send an email alerts between users using templates. I have below body:
Work Order <Work Order Number> has been assigned to you. In order to see the details please click the following link:
<link to booking>
I am using global templates to send an email. My code is below:
public static void Email(Guid To, Guid From)
{
Entity entity = GetGlobalTemplate("Marketing communication unsubscribe acknowledgement", service);
if (entity.Id != null)
{
Entity email = new Entity();
email.LogicalName = "email";
//to - Guid
List<Entity> ToEntities = new List<Entity>();
Entity activityPartyforTo = new Entity();
activityPartyforTo.LogicalName = "activityparty";
activityPartyforTo.Attributes["partyid"] = new EntityReference(EntityName.systemUser, To);
ToEntities.Add(activityPartyforTo);
email.Attributes["to"] = ToEntities.ToArray();
//from - Guid
List<Entity> FromEntities = new List<Entity>();
Entity activityPartyforFrom = new Entity();
activityPartyforFrom.LogicalName = "activityparty";
activityPartyforFrom.Attributes["partyid"] = new EntityReference(EntityName.systemUser, From);
FromEntities.Add(activityPartyforFrom);
email.Attributes["from"] = FromEntities.ToArray();
email.Attributes["regardingobjectid"] = new EntityReference(EntityName.bookableResourceBooking, recordId);
var emailUsingTemplateReq = new SendEmailFromTemplateRequest
{
Target = email,
TemplateId = entity.Id,
RegardingId = ((EntityReference)entity[bookableResourceBookingAttributes.createdBy]).Id,
RegardingType = EntityName.systemUser
};
var emailUsingTemplateResp = (SendEmailFromTemplateResponse)service.Execute(emailUsingTemplateReq);
}
}
How should I make red highlighted to dynamic? When I go to the template it is showing me only users values. When I go to the template types it is showing other values.
Thanks
Regards,
AW
*This post is locked for comments
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156