Process the attachment received in an email

I have integrated a email inbox in communication panel Emails. Now, I want to do below things.

  1. Every time I receive an email to that inbox, I want to check if the attachments are there.
  2. If the attachments are there, then I want to read the content(blob) of the file and send it to a REST API through web service.
  3. The API will return something, I want to save that to an object.

This is what I did so far:

I have created a BP which will trigger when an activity is created. I am able to read the activity but not able to read the attachment. 

When I am trying to set find query under filter records for read data component its getting reset after I refresh.

I have attached the screenshots for reference.


This is what I want to set:

The condition I want to set

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Once I refresh the page or if I switch between system actions its being reset to below condition:

Like 0

Like

4 comments

Hello,

You should use the Process file element for this:

https://academy.creatio.com/docs/8.x/no-code-customization/bpm-tools/pr…

Hi Mira,

Thanks for the response.

Yes, I used Process file.. Now, I want to send the file to a REST API using web service. I see there is no direct support to send the file. If I want to send the Base64(rich text) version of the file, how can I do that?

Sagar Rodda,

Here are the instructions on working specifically with the files via API:

https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

Thanks for sharing the link.. I have added the code to meet my requirement. Its giving an error. 

/* The file content. */
var content = new byte[]();
 
/* Create a unique ID for the new file. */
Guid RecordId = Get<Guid>("RecordId");
 
/* Create the "EntityFileLocator" instance identified by "recordId" and stored in the "ActivityFile" database table. */
var fileLocator = new EntityFileLocator("ActivityFile", RecordId);
 
/* Pass the created locator to the method of the "UserConnection" class. */
IFile file = UserConnection.GetFile(fileLocator);
 
using (Stream stream = file.Read()) {
 
   /* Retrieve the file content and save it to the array. */
   content = stream.ReadToEnd();
}
 
var base64 = Convert.ToBase64String(content);
 
Set<string>("FileBase64", base64);
 
return true;

 

Show all comments