Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Dynamic values and hyper links in email

$
0
0

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


Viewing all articles
Browse latest Browse all 82002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>