banner



How To Set Default Value For Lookup Field In Salesforce

Prepare Lookup field values in Records Create Page with Default Field Values – Spring twenty

This mail service describes near to ready Lookup field value usingdefaultFieldValues. As function of Jump twenty Release its possible to construct the formula to prepopulate the values while creating a new record using custom button or custom links.

Every bit office of Bound 20 Salesforce  Release, URL Hacking  is back in Salesforce Lightning Experience.

Refer my previous post URL hacking is dorsum in Salesforce Lightning Experience as function of Spring twenty Release:- http://theblogreaders.com/url-hacking-back-salesforce-lightning-experience-jump-20-release/

To ready Lookup field values using Default Field Values:-

Use Case: Create Contact from Opportunity item page with prepopulate the Opportunity Account name:

follow the beneath steps to achieve

Step i: Setup -> Object Manager -> Select Opportunity Object -> Create a button and enable the button into your opportunity page layout:

/lightning/o/Contact/new?defaultFieldValues=
AccountId={!Opportunity.AccountId}

Footstep ii:  Enable push in Folio Layout Setup -> Object Manager -> Select Opportunity Object -> Select Page Layouts -> drag and drop the button from Mobile & Lightning Actions to Salesforce Mobile and Lightning Experience Actions sections

Step 3:  Enabled button appeared in the Opportunity Layout

Stride 4:  Business relationship proper name automatically populated in cosmos popup from Opportunity Business relationship Proper name while clicking the button

Step 5: if observe error is occurred when Lookup value is empty (hither Account Name is empty):

Pace 6: to resolve above fault when the lookup value is empty, use with URLFOR() expression in formula to pass the lookup value in the parameter only if lookup value exists similar usingIF() condition to check with Bare value using ISBLANK() like below:-

{!URLFOR('/lightning/o/Contact/new?defaultFieldValues=' +
IF(ISBLANK(Opportunity.AccountId), ", ',AccountId='+Opportunity.AccountId)
)}

Below Demo Video:

This video demonstrate following items:-

  • Set Record Type Id Using defaultFieldValues – Spring 20
  • Enforce User to Select Record Types Using defaultFieldValues – Spring 20
  • Fix Date value Using defaultFieldValues – Spring xx
  • Set up Custom field value Using defaultFieldValues – Spring xx

Final Notes:-

  • Employ URLENCODE if your passing values incorporate any special characters
  • Remove the Space between your field API Name and Value
  • UseuseRecordTypeCheck or recordTypeId before the defaultFieldValues
  • Case Sensitive forrecordTypeId
  • Date to Convert as Cord Using TEXT()
  • Utilise if using lookup field value passing, if the lookup field is empty then received the error to overcome with withURLFOR()  expression to check ISBLANK() in IF() Condition, refer the this post

Reference:

URL Hacking is back in Salesforce Lightning Feel – Bound 20 Release

How To Set Default Value For Lookup Field In Salesforce,

Source: http://theblogreaders.com/set-lookup-field-values-records-create-page-default-field-values/

Posted by: pannelltion1953.blogspot.com

0 Response to "How To Set Default Value For Lookup Field In Salesforce"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel