For the moment, Linda has implemented the automatic generation and issuance of the invoice.
In order to complete the scenario, she also asks Vijay to show her how to configure the creation of PDFs via a process, and then send it by email.


Before starting the configuration, Linda and Vijay tested the current configuration.
Since the invoices are well generated and issued, they continue with the PDF creation process.
Trigger conditions on the invoice object
The most important condition for the process is that the invoice is issued.
The fields which can be taken into account are therefore:
Automatic issuance = True
Status = Issued
Please read this article in order to set up the Automation: Invoice Issuance. Afterwards, we will test, that there no PDF is linked to the invoice using this formula field:
PDF OK
The formula is based on these packaged fields of the Invoice PDF object:
Please adapt the condition due to your business needs.
| |
Note: The conditions are given as an indication and need to be customize according to your business needs. If you want to add additional conditions, don't hesitate.
Here are the steps to set up this formula field.
We recommend to read these trailhead articles, if you did not have occasion to train yourself on these topics:
Procedure
1. Go to Setup > Object Manager > Invoice
2. Click on Fields & Relationships
3. Click on New
4. In Step 1: Choose the field type Formula
5. In Step 2: Choose the output type Checkbox and insert the field label PDF OK
6. In Step 3: Switch to the tab Advanced Formula and compose the formula that fits to your business needs.
Note: If you copy this formula from the top of the article, please paste it into a text editor in order to take off the formatting of the text. It happens that the Formula editor does not accept copy pasted formulas due to the formatting.
7. Verify the formula syntax.
8. Insert a telling description and a help text that explains the field to the users.
9. In Step 4: Establish field-level security by checking the boxes of the profils you want to give the right to modify the field, according to your company security policies.
10. In Step 5: Instead of checking the box here, we recommend to go to each page layout of the invoice object you want to put the fields on, in order to put them manually in the right section.
Note: In order to easily debug the process, if an invoice is not processed, because it is an exception, make life easier for users - and reduce your work - by putting conditions / exceptions in a non-technical language in the help text of these fields.
When the user understands why the invoice is an exception, he or she can modify the invoice to meet the conditions or at least understands why the invoice has not been processed.
Here you can see Linda's results:

Testing approach
Congratulations! You configured the automation completely. Now let's not forget to test our setup.
Preparation
First, make sure you test on an invoice that meets the criteria, and therefore should be issued automatically.
For example in the case of Cloud Kicks:
Status of the
invoice = Issued
No PDF linked to the invoice
The invoice is not a pro-forma
and you have added the field on your page layout:
PDF OK
Procedure
A) If you would like to create an invoice that fulfills the conditions
> As soon as the invoice fulfills the conditions, it must be processed by the process.
B) If the invoice already exists and it has already fulfilled the conditions:
1) Unlock the invoice
2) Uncheck the Auto issuance check box
3) Save the invoice
4) Check the box again
> This triggers the process again.
Was the test successful?
If not :
1) Check the configuration of your fields
2) Did the test invoice fulfill the conditions of the process builder?
3) Check the configuration of the process builder by comparing with this article.