Skip to Content
avatar image
Former Member

Email is not sent


My requirement is to send out email upon first time saving of the lead.

However, the email is not sent out to the recipient, even though the email activity is created (see the screen shot).

Any idea?

Here is my codes in event-beforesave of the lead BO extension.

var elActivityRootEmail : elementsof Activity;

var instActivityEmail;

// Activity: define party node

var elActivityPartyEmail : elementsof Activity.Party;

var instPartyEmail;

// Activity: define text collection

var elActivityTxtCollTxtEmail: elementsof Activity.TextCollection.Text;

var elActivityTxtCollTxtCntntEmail: elementsof Activity.TextCollection.Text.TextContent;

var instActivityTxtCollEmail;

var instActivityTxtCollTxtEmail;

// Activity: define attachment folder

var elActivityAttachmDoc: elementsof Activity.AttachmentFolder.Document;

var instActivityAttachm;

instActivityEmail = Activity.CreateWithReference(this, "39");

instActivityEmail.SubjectName= "Test email";

elActivityPartyEmail.PartyName = "0001000843";


instActivityTxtCollEmail = instActivityEmail.TextCollection.Create();

elActivityTxtCollTxtEmail.TypeCode.content = "10002";

instActivityTxtCollTxtEmail = instActivityTxtCollEmail.Text.Create(elActivityTxtCollTxtEmail);

elActivityTxtCollTxtCntntEmail.Text.content = "Body text of the Activity Email";





Email.png (59.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 25, 2015 at 03:50 PM

    Hi julius,

    Code looks fine and I don't see any cliches on the code. Anyways for my convinience sake could you please use the below code and try this out

    //Elements of Email

    var emailActivityElements : elementsof EmailActivity;

    var emailActivityMessageFromPartyElements : elementsof EmailActivity.Party;

    var emailEmployeeResponsiblePartyElements : elementsof EmailActivity.Party;

    var emailActivityCC : elementsof EmailActivity.Party;

    var emailAcitivtyTo : elementsof EmailActivity.Party;

    var emailActivityEmailActivity : elementsof EmailActivity.Party;

    var emailActivityTextCollText : elementsof EmailActivity.TextCollection.Text;

    var emailActivityTextCollTextTextCont : elementsof EmailActivity.TextCollection.Text.TextContent;

    var employeeMailID;

    var employee;

    var employeeAdminMailID;

    var emailActivityInstance;

    employee = Employee.Identification.Retrieve(notification.Source);

    if (employee.IsSet())


    if (employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation.IsSet())


    var employeeWorkPlaceAddressInfo = employee.ToParent.CurrentDefaultEmployeeWorkplaceAddressInformation;

    if (employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.IsSet())


    employeeMailID = employeeWorkPlaceAddressInfo.EmployeeWorkplaceAddressWorkplaceAddress.DefaultEMail.URI.content;




    //For display the subject accordingly

    emailActivityElements.Name.content = "Reg: Test Email";

    emailActivityInstance = EmailActivity.Create(emailActivityElements);

    // for assigning the To Party

    if (!employeeMailID.IsInitial())


    emailAcitivtyTo.PartyKey.PartyID.content = employeeMailID;





    raise Error/Info Messgaes accordingly


    //TextCollectionTextTypeCode 10002 -> Body Text

    var TxtTypeCode = "10002";

    var emailActivityTxtCollIns = emailActivityInstance.TextCollection.Create();

    emailActivityTextCollText.TypeCode.content = TxtTypeCode;

    var emailActivityTxtCollTxtIns = emailActivityTxtCollIns.Text.Create(emailActivityTextCollText);

    //To Display the Message Note

    emailActivityTextCollTextTextCont.Text.content = "Dear Recipient," + "\n \n" +

    "Text Needed ";

    var emailActTxtCollTxtTxtCont = emailActivityTxtCollTxtIns.TextContent.Create(emailActivityTextCollTextTextCont);

    //If Instance is Set then Send the mail

    if (emailActivityInstance.IsSet())




    This should work.

    Before testing this please make sure the domain names are added, if not fine tune the project and add them domain names and also see whether email are sent to the business users or to a single person (Static Email will be maintained and only that email id will be picked up by system for every email activity).



    Add comment
    10|10000 characters needed characters exceeded