If you have picklists in Salesforce that have Field Dependency, you can use this config from Salesforce in your PDF Forms.
In this case, we have 2 picklists that are dependent:
- Parent Picklist
- Child Picklist
And this is how the setup looks in Salesforce:
A overview on how to create a Picklist dropdown in Salesforce can be found on our Academy: FORM Butler PickList form-field
Important to note: The Dependent Picklists can only work with dropdown boxes, not with checkboxes!
In our example, we have 2 picklists, so we create 2 mergefields in the DOCX template:
This will mean that we have created the below as explained:
- 2 PICKLIST TRANSLATION DataSources, one for each Picklist
- 2 SINGLE_FOR_FORM_FIELD or TRANSIENT_FOR_FORM_FIELD ConfigTypes
To register the dependency between picklists, we have to read the configuration in Salesforce and add that to the Config. This is done by creating an Actionable:
- Create an Actionable from Record Type: FORM Butler Picklist Dependency
- Choose a custom descriptive name
- Use Class (make sure to copy/paste): cadmus_form.Actionable_FormButlerPicklistDependency
- When: BEGIN
- Active: checked
- The Actionable is linked to the DocConfig or Pack that you want to run (a Pack would be architecturally more correct as you want to create a FORM Request as well)
- Translation DataSource: Use the PICKLIST TRANSLATION DataSource from the child picklist! The parent picklist and dependencies will be retrieved from Salesforce
- Picklist Controlling Mergefield: Name of the mergefield is in your DOCX file and use in your PDF Butler config. In our example: ParentPicklist
- Picklist Dependent Mergefield: Name of the mergefield is in your DOCX file and use in your PDF Butler config. In our example: ChildPicklist
This is all that is required. If you repeat the setup when you multiple dependent picklists for each, that will work just fine.
Also 3 levels of dependent picklists, Grandparent => Parent => Child, is not a problem but it will need 2 Actionables as there are 2 dependencies.