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)





