2

I have a custom object that we use to log client visits, where both a Sales Rep & a Support Engineer can take part.

I have 2 custom lookup fields on this object, one is called "Sales Rep", while the other is for "Support".

I would like to be able to pre-populate one of the fields with the user who's creating the record, but only if the profile matches "Sales Rep" / "Support Engineer". So if a Sales rep is creating the record, then the "Sales Rep" field would get pre-populated, and the same goes with the Support Engineer.

This should all happen right after a user clicks the "NEW" button.

Is this at all possible?

1 Answer 1

0

I Think quick action will work fine in your scenario. You can pre-populate values according to your condition in your quick action. Use if condition and use user object to get field values of User in insert field option in builder.

Quick actions enable users to do more in Salesforce and in the Salesforce mobile app. With custom quick actions, you can make your users’ navigation and workflow as smooth as possible by giving them convenient access to information that’s most important. For example, you can let users create or update records and log calls directly in their Chatter feed or from their mobile device.

Create action of type Create a record and add it your list view as list view allow to add action of type create a record in Salesforce Lightning Experience.

Set Predefined Field Values for Quick Action Fields

When you create actions, use predefined field values to set a value for a field. Predefined values can help ensure consistency and make it faster and easier for users to create records.

Steps:-

  1. Click the name of an action in the Buttons, Links, and Actions list or the Global Actions list.
  2. On the action detail page, click New in the Predefined Field Values list.
  3. Select the field you want to predefine a value for.
  4. Specify the value for the field.For single-select picklists, you can specify both a specific value and a formula value. If you set both, the formula value takes precedence over the specific value.
  5. Click Save.

Reference:- Set Predefined Field Values for Quick Action Fields

Update:- A sample to prepopulate user lookup values in action :-

IF($User.ProfileId= '00e0o0000038eoC',  $User.Id ,  null )

enter image description here

It will fetch the values from current logged in user.

3
  • This is ALMOST good, but I can't seem to be able to set a predefined field value for a user lookup field. As I said in my question, I need to set the Sales Rep lookup field to the current signed in user. How do I do that? Apr 17, 2019 at 8:25
  • @dobrondilorant You can check my update on question. Apr 17, 2019 at 8:57
  • Thank you for the updated response. I have an additional question: I guess the Quick Action should be created on the objects where I would like to create related "Client Visit" records, right? And it will be displayed in the top. Can I override the default "New" button, that is displayed on the "Client Visit" related list? Apr 18, 2019 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .