function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sundalesundale 

Pass custom object parameters in URLFOR()

I have 2 custom objects (A__c and B__c), with field PN in both.  I have a custom button (Detail Page Button) on obj A.  When I click it, I want to create a new obj B record.  I also want to pass A.PN value to B.PN.

 

I've read other posts that say this should should work:

 

{!URLFOR( $Action.B__c.New, null )}

 

and it does.

 

But when I try this (where "342b" is the B__c.PN custom field ID):

 

{!URLFOR( $Action.B__c.New, null, [342bx = A__c.PN] )}

 

I get: Error: Syntax error. Found '['

 

What am I missing?  Thx!

 

Edit:  Ok, so RTFM applies:  custom object field ids **must** be in " ".  The syntax parser is now happy.

 

However, I now realize I have a more general question:  If B__c has a lookup relationship (via PN) with A__c, what is the best pattern for populating lookup field in B_c?  

 

 

sundalesundale

Well, I guess its not possible to default a lookup value:  https://sites.secure.force.com/success/ideaview?id=087300000007PidAAE

Bummer.