When creating your own custom app, sometimes you may want the user to create a contact. This will take the user to the Contacts app where they create the user.
However, when they have finished creating the new contact, the Contacts app will not redirect the user back to your custom app. Furthermore, the custom app will not know the Record ID of the newly created contact.
Solution: The Contacts app will always check for a shared result called resultGoBack
. If this is set 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
.
Details
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
.
Example
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.