1

I have a two custom object Sample and Sample detail. Sample detail has a lookup relationship to the Sample record. And both the records have lookup relationship to the Case. Below is the Sample record which currently has an association to Case.

enter image description here

When I create a Sample Detail record from the related list. I need to pull case that is in the Sample to the Sample Details automatically, so I created a custom URL List button

/lightning/o/Sample_Detail__c/new?defaultFieldValues=Sample__c={!Sample__c.Id},Case__c={!Sample__c.Case__c}

added this button the related list.

enter image description here

when I use this button

enter image description here

It populates the Sample ID but removes the Case field from create new page

enter image description here

What is that I am missing here. Any help is greatly appreciated

Updated to below URL still case value isnt getting autopopulated from the parent

/lightning/o/Sample_Detail__c/new?defaultFieldValues=Sample__c%3D{!Sample__c.Id},Case%3D{!Sample__c.Case__c}

enter image description here

1 Answer 1

0

= is a reserved character for URLs, so you must encode them as %3D:

defaultFieldValues=Sample__c%3D{!Sample__c.Id},Case__c%3D{!Sample__c.Case__c}

Note that the {! and } are not encoded, because they will be replaced with the literal Id value when rendered.

5
  • Thank you, now I can see the field up but dont see the Case ID populated from the Parent.. Added the screenshot in the question Apr 1, 2023 at 3:14
  • @user4912134 That was a typo on my part. Don't forget the __c. I'll edit.
    – sfdcfox
    Apr 1, 2023 at 3:34
  • No still it doesnt work.. I added the __c it removes the field from create new page Apr 1, 2023 at 3:43
  • Can you please suggest me how can I pass the associated CaseId as the parameter.. I am kind of stuck, any help is really appreciated Apr 2, 2023 at 3:03
  • Can you please suggest me what I might be missing that the case ID cannot be passed Apr 3, 2023 at 14:47

You must log in to answer this question.

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