To automate the invoice creation, add a criteria such as on changing a stage, ideally a pick list field on the custom object.
Create a process with the criteria that is required to satisfy and initiate an Invoice creation.
Add action, select Action Type as APEX, give a name. Select SFX-CustomObjectInvoice Apex class
Click on “Add Row”
In the field section select parameterIds, Type should be formula.
For the formula use the below function with required parameters
‘recordid=’+<record id field>+’&mappingid=<mappingid>’
Ex: ‘recordid=’+[Energy_Audit__c].Id+’&mappingid=a0S0o00001lhu7M’
NOTE: Ensure there is no extra spaces in-between the formula
Click Save followed by activating the process builder