web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

email_activity_parties and activityParties

(0) ShareShare
ReportReport
Posted on by

Hello, I'm trying to add an attachment to an activity party 

Here is the code: 

....email.email_activity_parties = activityParties;....

function CreateEmailAttachment() {
//get reporting session and use the params to convert a report in PDF

var params = getReportingSession();
//Email attachment parameters

var activitymimeattachment = Object();
activitymimeattachment.ObjectId = Object();
activitymimeattachment.ObjectId.LogicalName = "email";


activitymimeattachment.ObjectId = email.activitypartyid;

activitymimeattachment.ObjectTypeCode = "email",
activitymimeattachment.Subject = "File Attachment";

activitymimeattachment.FileName = "Commande.pdf";
activitymimeattachment.MimeType = "application/pdf";

encodePdf(params, activitymimeattachment);

//Attachment call

}

But I cannot retrieve the id of the activity party to join my attachment.

This is undefined : activitymimeattachment.ObjectId = email.activitypartyid;

Any ideas?

Thx in advance for your help

*This post is locked for comments

I have the same question (0)
  • Bruno Lucas Profile Picture
    5,421 on at

    Hi,

    Can you share the code where you create the activity party?

    there is just this line

    "....email.email_activity_parties = activityParties;...."

    probably something is happening there and the activity party is not creating

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Jcharlot,

    The Object Id should be email Id iteslf if you use this Email as the object ype:

    activitymimeattachment.ObjectId.LogicalName = "email";

    , not the email.activitypartyid

    See sample here:

    msdn.microsoft.com/.../gg328344.aspx

    ActivityMimeAttachment _sampleAttachment = new ActivityMimeAttachment

                           {

                               ObjectId = new EntityReference(Email.EntityLogicalName, _emailId),

                               ObjectTypeCode = Email.EntityLogicalName,

                               Subject = String.Format("Sample Attachment {0}", i),

                               Body = System.Convert.ToBase64String(

                                       new ASCIIEncoding().GetBytes("Example Attachment")),

                               FileName = String.Format("ExampleAttachment{0}.txt", i)

                           };

                           _emailAttachmentId[i] = _serviceProxy.Create(_sampleAttachment);

    Hope this helps.

    Thanks.

  • Community Member Profile Picture
    on at

    Here is my code :

    function CreateEmail()
    {

    debugger;

    try {

    email.Subject = "Bon de commande PDF";


    var activityParties = new Array();

    var partyObj0 = new Object();
    partyObj0.PartyId = { Id: ownerID, LogicalName: "systemuser" };
    partyObj0.ParticipationTypeMask = { Value: 1 };
    activityParties[0] = partyObj0;

    var partyObj1 = new Object();
    partyObj1.PartyId = { Id: ownerID, LogicalName: "systemuser" };
    partyObj1.ParticipationTypeMask = { Value: 2 };
    activityParties[1] = partyObj1;

    var partyObj2 = new Object();
    partyObj2.PartyId = { Id: ownerID, LogicalName: "systemuser" };
    partyObj2.ParticipationTypeMask = { Value: 2 };
    activityParties[2] = partyObj2;



    //set .email_activity_parties to activityParties
    email.email_activity_parties = activityParties;



    SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });


    }

    catch (e) {

    }
    finally
    {

    }

    }

  • Community Member Profile Picture
    on at

    I am in JS,  should I use the createEntityReference method ?

    thx

  • Verified answer
    Community Member Profile Picture
    on at

    I just forgot to put the regarding so I added this when I'm creating the email:

    email.RegardingObjectId = {

                       Id: Xrm.Page.data.entity.getId(),    //Get the current entity Id , here OrderId

                       LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be "salesOrder"

                   };

    thx all

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans