Process Builder which recently announced, able to cover this without the need to hire developer. It is also simple and considered as configuration, therefore you do not need apex test class coverage.
Process Builder alone is pretty powerful, but with ability to launch Flow, it become even more powerful. In some scenario, Process Builder alone cannot handle complex business process, such as: to query an object to get the Id and use that Id for new record creation.
As of now, actions supported by Process Builder:
- Create a record (not possible using workflow, standard and custom object available)
- Email Alerts (exist in workflow)
- Post to Chatter (not applicable with workflow)
- Quick actions (not applicable with workflow)
- Submit for Approval (not applicable with workflow)
- Update records (limited functionality with workflow, standard and custom object available)
With addition using Flow, we can do:
- Record Create
- Record Delete
- Record Lookup (for query)
- Record Update
Use Case: auto share record of a private object to user defined in a custom field.
Solution: Process Builder + Autolaunched Flow
Why it called autolaunched flow? Similar with workflow, this type of flow don’t require any user interaction to start . It can be launched from Apex class or Process Builder as an action. They can’t contain steps, screens, choices, or dynamic choices in the flow. Use autolaunched flow to automate complex business processes without writing code. In order to launch a flow from a process, you must activate the flow.
For this scenario, We just need 1 process only, which is Record Create. Technically, to share a record, we need to create a record for the object with end with __Share. For this case, the object called Insurance__c, so the sharing object called Insurance__Share.
Screenshot below show 2 fields value to populate on record creation will come from the record, which stored as variables: RecordIdFromScreen and UserIdFromScreen.
The only action for our use case in the Process Builder is calling an autolaunched flow created earlier. We need have 2 variables in that flow, make sure the variable type is Input only, because we are going to use them to receive values from the record to the flow, we name the variables as:
- RecordIdFromScreen to store Record Id
- UserIdFromScreen to store User Id
So, before we create Process Builder, we have to prepare the Flow.
As long as you understand the object structure and fields, this blog show you how easy to create a Process Builder powered with autolaunched Flow.