Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Workflow - creating email

Posted on by 1,695

I have ( with help from here ) , managed to create a workflow that creates an email and attaches a PDF file. One question I have is when creating the To party list, how does it know which email address to grab if I have 2 email address fields in my entity. Does it grab both email addresses, or can you specify which email is required i.e. 1 for  the To address and one for the CC address

                Dim UpdateEmail As New Entity("email")
                Dim recordGuid As New Guid(_resultEntity.Id.ToString)
                ' Need to lookup Supplier email
                Dim LookupSupplierID As Guid
                Dim SupplierList As New QueryByAttribute("new_remittancesuppliers")
                SupplierList.ColumnSet = New ColumnSet("new_remittancesuppliersid")
                SupplierList.Attributes.AddRange("new_supplierref")
                SupplierList.Values.AddRange(new_supplier.[Get](executionContext))
                Dim ReturnedSupplierList As EntityCollection = service.RetrieveMultiple(SupplierList)
                For Each ReturnedSupplier In ReturnedSupplierList.Entities

                   LookupSupplierID = ReturnedSupplier.GetAttributeValue(Of Guid)("new_remittancesuppliersid")

' new_supplierref is unique so once found exit 

                   Exit For
                Next

                Dim Toparty As New Entity("activityparty")
                Toparty("partyid") = New EntityReference("new_remittancesuppliers", LookupSupplierID)


                UpdateEmail.Id = recordGuid
                UpdateEmail("to") = New Entity() {Toparty}
                service.Update(UpdateEmail)

*This post is locked for comments

  • Ivan Ficko Profile Picture
    Ivan Ficko 1,380 on at
    RE: Workflow - creating email

    No, it will not work that way.

  • Pete_N Profile Picture
    Pete_N 1,695 on at
    RE: Workflow - creating email

    Just a thought, can you put multiple email addresses in one field  ie email1@somewhere.com; email2@somewhere.com

    would that work ?

  • Verified answer
    Ivan Ficko Profile Picture
    Ivan Ficko 1,380 on at
    RE: Workflow - creating email

    It's always using first email address that is found on the entity. For example you have 3 email fields on contact entity (emailaddress1, emailaddress2, emailaddress3) it will use the first email that is not null.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans