0

We have an object (Object A) having 2 record types. Another Object(Object B) has two lookup fields of Object A. There are two record types of object A.

Whenever a user comes on any record and selects a record in any of these lookups, Salesforce standard functionality asks for the record type when he chose to select a new record on that screen.

We want to automate the selection based on the field from which it is being created. For instance, there are two fields Sales and Service (Lookup of Object A). Whenever the user selects Sales, the record type should be sales of object A and it should lead to the record create screen and similar should happen for Service.

How should I implement this requirement?

1

You could also do this with a screen flow. Give the user the choice in the lookups, then create a record with the correct recordtype and take them to that record.

| improve this answer | |
0

The quick action would also serve your purpose although the user experience will be different. Create two quick action each for different record types and set pre-defined values to those lookups. See a sample example:- https://salesforcediaries.com/2019/05/28/replacing-url-hacks-with-pre-defined-actions-in-lightning-experience/

Some other possible alternative solution is:-

  1. Create your own Lightning component record creation form having a custom lookup component which fulfils your requirement.
  2. Creating a Visualforce Page with the same motive.

Note:- trigger will not work in this scenario because it only fires when a DML happens.Same is the case with Workflows and process Builder.

| improve this answer | |
  • Can you also explain why the downvote? – sanket kumar Nov 29 '19 at 12:58
  • Hi @Sanket, Thanks for your comment, Can I map the quick action with a particular field. Because I want that to happen whenever a user click "create new" from the field – Ankit Bansal Nov 30 '19 at 18:28
  • No, it can not get fired when you click on create new from field. It will be on the highlight panel of the parent record. – sanket kumar Dec 1 '19 at 3:25
0

There is no way currently to customize or hide the popup when we select to create new record from lookup search. There's an ugly hack for validating record type selected via Lookup Filter Criteria on the lookup field. This will prevent the users from saving any record with incorrect record type mapped.

If you really need to bypass "Create New" option, then go with what Sanket suggested above and implement a custom Lightning component, but seems like a lot of effort to overcome a simple thing.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.