• About
  • Contact me!

Salesforce Everywhere

~ Blog on Salesforce Dev and admin stuff

Salesforce Everywhere

Tag Archives: Lookup fields

Tip # 25: Error in creating Lookup relationship

29 Sunday Apr 2018

Posted by Mani in Salesforce Configuration, Uncategorized

≈ Leave a comment

Tags

Lookup fields

Recently, when I tried creating a lookup relationship with the Product (Standard Object) from the custom object, I got the below error though I was not trying to create the Master Detail relationship:

You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail.

Moreover, the custom object was a new object and it did not have any records. I was bit confused and the error message is misleading as well. Then, after googling, it looks like you can create a lookup field to Product only if you allow to clear the field if the Product record is deleted(please check the below screenshot for your reference):

Lookuperror

Please let me know for any clarification.

Update lookup field using Process Flow

15 Saturday Aug 2015

Posted by Mani in Process Builder

≈ 4 Comments

Tags

Lookup fields, update lookup fields

It has been a long time:), let me share few posts on Process Builder and Flows which I have been using them recently.

Requirement:

Need to update a lookup field in an object. We have a Location field as a lookup in a custom object(say Rate Card). This should get populated from Account’s location when a new rate card is created. Account is a lookup field in the Rate Card and it is a required field.

Analysis:

Earlier, the requirement could only be achieved through APEX code as we cannot use Workflow Field update for lookup fields, but with the introduction of Process Builder, it is possible to update lookup field through Process flow. Wow, it’s a boon for developers:)

Solution:

Create a process as per the screenshot below:

Create Process

The process will be executed upon Rate Card record creation.

Check if Location field is empty and if so, update it:

Screen Shot 2015-08-15 at 12.32.18 pm

Create an Immediate action to update the Location field:

Update Location

Note the value, we have taken Rate Card’s account’s location and updated in Location field of Rate Card.

There is a salesforce article on How to auto populate Look up Field using Process Builder

Limitation: You cannot Update Lookup field from formula/text field

Please let me know for any comments/clarification.

P.S: It is possible to update lookup field using Visual flow. Please find the screenshot below which shows account id update(account is a lookup field in Opportunity object) in Record update step in Visual flow.

visual-flow-update

Visual flow update

Blog Stats

  • 111,809 hits

Archives

Recent Posts: Salesforce Everywhere

How to get field values on onLoad in lightning-record-edit-form in LWC?

Using Dynamic Actions

How to check if the logged in user is a Guest user or not in APEX class?

How to Close Quick action in LWC

Lightning component to filter Products and display results in lightning data table

Connect with me

  • View @manibalan_s’s profile on Twitter
  • LinkedIn

Developer links

  • Salesforce Developer website
  • Salesforce Success Community

Enter your email address and click on Follow us (below) to follow this blog and receive notifications of new posts by email.

Website Powered by WordPress.com.

  • Follow Following
    • Salesforce Everywhere
    • Already have a WordPress.com account? Log in now.
    • Salesforce Everywhere
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar