If a custom app offers the option for a new contact to be created, the Contacts app will not redirect the Method user back to the custom app after the contact is created. Furthermore, the custom app will not know the Record ID of the newly created contact.
Solution: The Contacts app will check for a shared result called resultGoBack. If this is set to be of type "Yes/No" and the value is equal to "Yes", on completion of a newly created contact, the Contacts App will go back to the calling app, and it will store the Record ID of the new contact in a shared result called resultContactRecordIDfromNewContact.
You do not have to customize the New Contact screen at all. If the shared result resultGoBack is set to "Yes", the New Contact screen will look for this flag and follow these steps:
- Hide the "Save & New" button.
- Clear the shared result resultGoBack.
- On Save, the user is taken back to the screen that the user came from (your screen).
- The record ID of the newly created contact is stored in the shared result resultContactRecordIDfromNewContact.
In this example, a Custom App has a drop down to choose a contact. In the drop down, there is custom row to Add/Edit a contact.
1. In the event "Custom Row Click" of the Contact dropdown, we use the action "Assign Value to Shared Result" to set the shared result resultGoBack to "Yes". Make sure the type is "Yes/No".
2. In the screen's properties, you will need to add a few actions to the "Focus" event. The record ID of the newly created contact will be stored in the shared result resultContactRecordIDfromNewContact.
a. Check conditional statement: resultContactRecordIDfromNewContact is not empty.
b. If above statement is true, update dropdown control with resultContactRecordIDfromNewContact.
c. Clear resultContactRecordIDfromNewContact else you may cause unexpected bugs.
d. Call Change Event of dropdown control if it has actions when a contact is selected.