Creating attachments in Salesforce from BLOB

Problem Statement:

· To get the data from Salesforce to Azure Blob Which Service will be suitable, Why?

· Logic Apps is Suitable.

· Why not ADF, because we need to write a lot of code and commands to complete the process and will get the data from custom objects.

· If user wants to get the same data in the form of attachments, it will not be possible by using ADF.

Solution:

· By using logic azure logic apps we can create the attachments in salesforce from Azure BLOB in file format.

· In a single execution we can get the multiple files from salesforce.

· We do not need to charge the flow for different types of files.

Process diagram:





Advantages:

· We can process it for huge files from BLOB to Salesforce.

· We can process N no.of number of files.

· Times saving as we need not write the huge code to get the data.

Disadvantage:

· There is no security or authentications are needed to create the attachments in salesforce.

HTTP Request: The request trigger creates a manually callable endpoint that can handle only inbound requests over HTTPS.



Initialize Variable:
It is used to store the reusable data in the type of string, array, object, Boolean, integer.
Here we are storing initial value as 0. Because to send multiple files into sales force. I need to compare how many files in blob for that I am taking initial value as 0.



List Blobs: List blobs is a component where we can get the folder document data that data will be in JSON array format.
 


Initialize Variable: It is used to store the reusable data in the type of string, array, object, Boolean, integer.
I’m storing array size here I have written length function to get the count of an array size.



File Path and Name: Here I’m initializing the file Path and File name dynamically.
 


Until:
In until I have taken initial value is equal to array size, so that until loop will be executed based on the array size.

Note: we cannot initialize new variables in until scope. We can utilize the already initialized variables in the top of flow by using set variable connector.

Get Blob Content: Get blob is used to get the single document in blob.
 

Store File Path:
I have used set variable for File path for storing File path dynamically.
 


Store File Name: I have used set variable for File name for storing File Name dynamically.


Condition: I am differentiating the files based on file types by using condition connector. If the file path is ends with .pdf or .xlsx files, the true condition will get satisfied. In true condition we are storing the file data which is getting from http as $content.

Create Record: In true condition I’m taking create record connector from salesforce and object type as content versions (we can store files and attachments in salesforce) and added parameters as title, path on client, version data.
 


False condition: If the file path is ends with .CSV, .JSON, .TXT, files, the false condition will get satisfied. In false condition we are storing the file data which is getting from decode base64 http as $content.

Create record: In true condition I’m taking create record connector from salesforce and object type as content versions (we can store files and attachments in salesforce) and added parameters as title, path on client, version data.


Increment variable: Here we are incrementing the initial value by 1.


By using the above flow we can able to create the attachments in Salesforce from BLOB.

Comments