Question

Add order's attachments to email

Hi there,

 

I'm trying to create a business process that sends an email with all the order's attachments.

 

Would love to know how should it be done.

 

Many thanks,

Oren

Like

1 comments

Hello Oren, 

The mentioned functionality can be implemented in business process using a script task element and creating a correct script for it. 

For example, here is the script which will copy all attachments from lead to opportunity:

var userConnection = Get<UserConnection>("UserConnection");

Guid fromID = Get<Guid>("fromId");
Guid toID = Get<Guid>("toId");

string sql =String.Format("INSERT INTO OpportunityFile (Name, Data, TypeId, LockedById, LockedOn, Version, OpportunityId) SELECT Name, Data, TypeId, LockedById, LockedOn, Version, '{0}' FROM FileLead WHERE LeadId = '{1}'", toID, fromID); 
CustomQuery myQuery = new CustomQuery(userConnection);
myQuery.SqlText = sql;
using (DBExecutor dbExecutor = userConnection.EnsureDBConnection())
{
    dbExecutor.CommandTimeout = 0;
    myQuery.Execute();
}

return true;

You may use this script as example and create a new one with the needed functionality upon it. 

Best regards, 
Roman

Log in or register to comment