Possible to fill reference field on a new related record before submitting parent record?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 11:08 AM
During development of a custom app, the users asked for the following:
1. User fills out the form to create a new Contact. Account as a required field, but a new Account record needs to be created for this Contact.
2. User clicks on the Account field (magnifying glass).
2.1 From the Account pop window, user clicks 'New'.
2.2 The new contact should be prepopulated In the Account form 'Primary contact' field.
Currently we have it set up so that when creating a new Contact record, the Account field isn't required, but will be after submitting the record. The users are basically trying to avoid having to submit and then go back to the form and then creating the related Account record.
I don't think that there is a good way to do this, since I'm not sure you can actually make a reference to a record before it's inserted into the table, but want to see if there are methods that I might not be aware of. Does a sys_id only get assigned after insert similar to numbers on Task?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 02:11 PM
Hi,
My two cents here, I would separate out the process to create a new account and New contact.
On the New Contact form, Account should be mandatory and if user cant find it they cant submit it. You can add a link and info there that if you cant find the account click here to create one, make it a pre requisite.
And there should be a job that runs to identify orphaned/abandoned accounts that are not used and deactivate them once every few months.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2023 03:46 PM
I agree with you completely, and feel like what they are asking for isn't technically possible.
Their biggest complaint about the required Account field is that if they've already started to fill out the Contact form and the Account record they need to associate to the Contact doesn't exist they are stuck since the form won't let them submit. It's kind of a vicious circle and a cart-before-the-horse situation
Some additional clarifying information:
- The Account field on the contact form is mandatory by design (it is not mandatory for new records currently as a workaround
- The "Primary contact" field on the Account form is mandatory, and drives account naming logic
- If a new Contact requires creating a new Account, and the Contact is meant to be the primary contact for the account the field can't be filled since the Contact record hasn't been inserted yet
- If the user attempts to make a new Account record first, but the primary contact doesn't exist yet, the Account can't be created until it is a selectable record