Skip to main content

Hi,

 

I would like to create a custom button on a related list to create a new record. But when clicking on the button, I would like, if the status to be "Testing" on the Test Object, to be automatically populated as "Testing" when creating a Lab Test record. Otherwise the value should be "New". This is what I have so far, but it seems not to be working: 

 

/lightning/o/Lab_Test__c/new?defaultFieldValues=

 IF(ISPICKVAL(Test__c.Test_Stage__c, "Testing"),  

ISPICKVAL(Lab_Test__c.Test_Stage__c,"Testing"),     

ISPICKVAL(Lab_Test__c.Test_Stage__c, "New"))

 

Thank you for your help! 

2 answers
  1. Aug 8, 2022, 5:21 PM

    @Adèle Libman You just need to enclose your IF() in {!}. If everything else is correct, it should work. However, I think you need to include the field name you are updating (I used 'Status__c' in my example, just swap it out for what you are using), and your IF() looks like it will just return True or False, not update the field with a text value.

     

    Try this and let me know if it works for you:

    /lightning/o/Lab_Test__c/new?defaultFieldValues=Status__c={!IF(ISPICKVAL(Lab_Test__c.Test_Stage__c, "Testing"), "Testing", "New")}
0/9000