In the cloud can anyone help with renaming the invoices when emailed using doc profile, i.e. invoice number/customer num? The event system is new to us as we move to the cloud, we used triggers onsite, now events. Thank you for any help!
Hi Steve,
I wish you the best of luck when working with Events for sending out the emails. It takes some time to get used to how the framework functions, but it is possible to rename the file is you send it out as a separate email.
Below is an event handler we created for sending out customer document profile reports with a custom subject, body, reply to, and cc. Thus there are some customer IDOs which reference custom tables which stores this information based on the Task Definition. If you look at Action Sequence 110 - 130 you will see how we look up the document from the DocumentObjectAndRefViews IDO, then attach it with a new file name, and then send the email.
I hope this helps.
Action Sequence
Action Type
Action Description
Parameters
10
Load IDO Row
Look up profile destination of the task
IDO("DocWorkflowLogs") PROPERTIES("dwfUf_EmailDestination, IdoFilter, IdoName, IdoPropertyList, TaskNumber") FILTER(SUBSTITUTE("TaskNumber='{0}'", E(eTaskNumber))) SET(RV(EmailTo) = "dwfUf_EmailDestination", RV(vIDO) = "IdoName", RV(vIDOFilter) = "IdoFilter", RV(vIDOProperties) = "IdoPropertyList")
20
Finish
Finish when without profile destination
CONDITION(V(EmailTo) = "") RESULT("The task profile destination does not specified correctly")
30
Load Collection
HIS Email by User
IDO("ue_HIS_EmailReport") PROPERTIES("Body, CCEmail, FromEmail, Subject") DISTINCT(FALSE) FILTER(SUBSTITUTE("TaskName= '{0}' AND SLUser = '{1}' AND Enabled = 1", E(eTaskName), USERNAME())) RECORDCAP(1) SET(R(rHIS) = RESULT)
40
Branch
Goto Logic if record is found
CONDITION(ROWS(rHIS) > 0) DEST(70)
50
HIS Email by TaskName
IDO("ue_HIS_EmailReport") PROPERTIES("Body, CCEmail, FromEmail, Subject") DISTINCT(FALSE) FILTER(SUBSTITUTE("TaskName= '{0}' AND SLUser = '*' AND Enabled = 1", E(eTaskName))) RECORDCAP(1) SET(R(rHIS) = RESULT)
60
Finish if HIS_EmailReport is not found
CONDITION(ROWS(rHIS) = 0) RESULT("The task is not active for HIS EMAIL Process")
70
Load Properties based on document
IDO(V(vIDO)) PROPERTIES(V(vIDOProperties)) DISTINCT(FALSE) FILTER(V(vIDOFilter)) RECORDCAP(1) SET(R(RSProp) = RESULT)
80
Set Values
Get the Nbr of Properties and init cnt
SETVARVALUES(vNumProp = NUMENTRIES(V(vIDOProperties), ","), vCount = "1", vEmailSubject = P(rHIS, 1, "Subject"), vEmailBody = P(rHIS, 1, "Body"))
90
Get the property value
SETVARVALUES(vValue = P(RSProp, 1, ENTRY(V(vCount), V(vIDOProperties), ",")), vReplace = SUBSTITUTE("<<{0}>>", ENTRY(V(vCount), V(vIDOProperties), ",")), vEmailSubject = REPLACE(V(vEmailSubject), V(vReplace), V(vValue)), vEmailBody = REPLACE(V(vEmailBody), V(vReplace), V(vValue)), vCount = CAST(V(vCount) AS NUMBER) + 1)
100
Loop if vCount < Num Properties
CONDITION(V(vCount) <= V(vNumProp)) DEST(90)
110
Load the Document for the Email
IDO("DocumentObjectAndRefViews") PROPERTIES("CreateDate, CreatedBy, Description, DocumentName, EventHandlerStateRowPointer, TableRowPointer, TableName, DocumentObject") DISTINCT(FALSE) FILTER(SUBSTITUTE("TableName='{0}' AND TableRowPointer='{1}'", "EventState", E(eEventStateID))) SET(R(rsAES) = RESULT)
120
Attach
Get the Document to send
DOCACTION(ATTACH) DOCNAME(FV(vDocName)) DOCDESC("Order Verification Report") DOCTYPE("PDF") DOCMEDIATYPE("application/pdf") DOCBLOB(P(rsAES, 1, "DocumentObject")) DOCINTERNAL(TRUE) ATTACHMENTNAME(SUBSTITUTE("{0}.pdf", E(eTaskName)))
130
Send Email
Send email with the customized template
TO(V(EmailTo)) CC(P(rHIS, 1, "CCEmail")) REPLYTO(P(rHIS, 1, "FromEmail")) SUBJECT(V(vEmailSubject)) HTMLFORMAT(TRUE) BODY(V(vEmailBody)) ATTACH(INTERNAL)
140
Finish email sending
RESULT("The HIS EMAIL was sent to the receipients")