Cloudastick Systems

Our Blog

January 18, 2022

Mass Import States

Ever wondered how to mass insert states on Salesforce?

Currently Salesforce doesn't support mass inserting states, only way is to manually insert each state.
There are other solutions using Selenium, but they are not very practical

Luckily this Github Repo made by mattandneil contains a lot states than you can import on your Salesforce Org. by installing the package mentioned in the repo's README, which also contains straight forward steps on how to install and start the importing process.
 

November 29, 2021

Screen Flow Mandatory Attachments Without a Record Id

Screen flows offer a way to add attachments to records, but in order to do that the record should be committed to the database, as the file upload component in the screen flow needs the Id of the record to attach the file to it. Also there is no option to make that file upload component required

After some researching I found a workaround to make the file upload component required, but still the record has to be in the database to attach the file to it, which doesn't allow to make any logic after the files are uploaded and before creating and committing the record to the database.

After some more research I found a solution for it.

Add the file upload component without providing the record Id
When you add the component without providing the record Id the file is uploaded on Salesforce without being attached to anything, which allows us to attach it manually as shown in the next step.

Implement an invokable method to attach the file
The links between the files and the records are stored in a table called ContentDocumentLink. What the invocable method is going to do is adding a new record to the ContentDocumentLink table that contains the Id of the record that the file is going to be attached to (LinkedEntityId) and the Id of the file itself (ContentDocumentId). By that you can upload the files and link them whenever you want.

Below you can find a code example of the invocable method discussed above.

User-added image