Sample Output:
Full Flow Diagram
1. Create a Record Choice Set variable for for Multi-Picklist.
2. Drag and drop multi-picklist into to screen.
3. Make sure SelectedContactIds(text data type) is assigned to Contacts(output of selected contacts from the Screen).
4. Create two Formula Fields like below.
currentContactId – Holds the first contact id if there are multiple selections.
TrimSelectedContact – Holds the rest of the ids except the first one.
5. Check Contacts Decision.
This decision is to check whether Contacts are selected in the first screen.
6. Check for semi colon Decision.
This decision is to check whether multiple contacts are selected.
No semi colon Decision outcome
7. If semi colon is not found(only one record is selected), the flows goes to Assign Account Contact assignment and do the following.
a. Sets the Account__c as inserted account’s id.
b. Sets the Contact__c as SelectedContactIds(which has just one id)
c. Sets the SelectedContactIds to null.
8. Add Acct Contact Assignment.
Adds the Account_Contact__c to the list of Account Contacts junction object Records list variable.
9. The flow goes to Check for Semi colon. Both the conditions doesn’t satisfy. So, it goes to Default Outcome which directs them to create Account Contact junction object.
10. If multiple Contacts are selected, it goes to Assign Account Contact Fields Assignment.
11. It goes to Remove First Id Assignment.
Here it removes the first id from the SelectedContactIds.
12. It again goes to the step 7(Add Acct Contact Assignment) and repeats until for all the selected Contacts, list of Account Contacts are added and then goes to Create Account Contact to create the junction object records.