Pre-populating Lookup Field with Skuid Redirect

  • 1
  • Question
  • Updated 4 years ago
  • Answered
Hi - 

I'm having trouble pre-populating a lookup field on a skuidified version of a "New Record" page.

I can accomplish if I do not override the new record page, as seen here:

 

I am using the following to redirect from a table row: https://na12.salesforce.com/a4s/e?CF00NU0000004jAzH={{Name}}&CF00NU0000004jAzH_lkid={{Id}}

But when I override the "New" action with my Skuidified page, the Project field does not pre-populate:



What am I doing wrong? 
Photo of Kaede Holland

Kaede Holland

  • 2,744 Points 2k badge 2x thumb
  • lost

Posted 4 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
It's likely that Salesforce is doing some magic behind the scenes, but it should be fairly simple to reproduce in skuid. I'm assuming that "CF00NU0000004jAzH_lkid" is the parameter that points to the Id. So you probably have a new "Debrief" model that has a lookup to "Project". If that parameter has the Project Id , you can add a condition on your New Debreif model where Project  = URL parameter "CF00NU0000004jAzH_lkid". That should automatically populate the Project field. This can also be done via Javascript relatively easily. I can write up a snippet if you would like.
Photo of Kaede Holland

Kaede Holland

  • 2,744 Points 2k badge 2x thumb
Thanks, Moshe! I feel like I'm getting closer. 

I tried exactly as you explained, and that populated the Project field with the Project's record ID. Then I tried to also include the parameter for the project name (CF00NU0000004jAzH). Everything looked good, but I got an invalid reference to project id error on save. 

Then I tried with just the parameter for the project name, and everything looked GREAT... until seconds later when the prepopulated project name field cleared itself of any text. 

Maybe I am really close to getting it without javascript? Or maybe it is easier with javascript? In any case, I am very grateful for your help!
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
You are close.

Best way to finish this would be to load another model with that id on page load. Then the model that is creating a new row can use "Field from another Model" condition type to set the Project.
Photo of Kaede Holland

Kaede Holland

  • 2,744 Points 2k badge 2x thumb
Wooo!!!! Got it! Thanks, you guys!
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks guys.  Kaede wrote our very first App Exchange review.  She will always have a special place in our heart!