Madimant wroteIF Attachment1 IS UNDEFINED assign it ELSE IF Attachment2 IS UNDEFINED THEN assign it.....up to 7
I have done something similar to this in several places. But now I do, IMO, something better using EXEC_STRING.
You will need a new BO with a Plain Text Field and a Number field that has an initial value of 1. This can even be a Non Persistent BO. 🙂
Before you find your Documents, CREATE the new BO.
Then set the Plain Text field to:
NewBO.PlainText=EMail.Attachment
+AS_STRING(NewBO.TheNumber, '#')+=Documents.Attachment
NOTE: Use your real BO and attribute names and pay attention to the ' and `
Replace your IF ... ELSE ... with
EXEC_STRING NewBO.PlainText
And add:
INCREASE NewBO.TheNumber BY 1
NewBO.PlainText=EMail.Attachment
+AS_STRING(NewBO.TheNumber, '#')+=Documents.Attachment
The above assumes that all Attachments are UNDEFINED to start with.
If you ever need to increase the number of attachments to your emails, this process will not need to be changed.