Help with emulating the "New" button on a related list in SF here in Skuid for custom Objects

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Hi,

I'm trying to have the edit pages auto populate the lookup fields when I'm creating a child record from it's parent, very much the same way the create new button in the standard SF detail record pages' relate list section would behave. 

I found this post in the questions that alludes to this (link to page: https://community.skuidify.com/skuid/topics/how_do_i_build_a_create_new_record_page), but I struggled to get it to work.

I've tried quite a few url combinations and so far none have worked. The url directs to a wizard page that has 2 models (the parent and child). I tried setting up a number of condition cases between the two, or working with none, but so far no luck. 

Please help :)
Photo of Ahmed Ellaithy

Ahmed Ellaithy

  • 160 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
We need to expand on that post with a more detailed explanation. 

The trick is to create a model with data about the parent object that has a condition  " id=Id from URL parameter"   If you pass the single URL parameter you  will  pull in whatever data you want about the parent object. 

Then on the object you are creating new,  you build conditions "field from another model"  on this parent model.   This is how you can populate multiple items on the new record you are creating. 

That's a brief answer on a Friday afternoon.  Let us know if it helps. 
Photo of Ahmed Ellaithy

Ahmed Ellaithy

  • 160 Points 100 badge 2x thumb
Thanks Rob.

So it took me a bit of mental clarity to fully understand your response but I think I am finally on the right track.

I'm now getting (with no special treatment to the "Redirect URL" box) the lookup field auto-populate.

The only problem is, it's inserting the parent record's ID and not the record's name value. 


Aaaaand I just figured out what was wrong. I simply needed to check and include those fields on the models in the object record I was creating. Thought I'd share that for all skuid future users who might struggle with this.

I do feel this is worth a skuid tutorial
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks Ahmed.  AAALWAYS make sure your fields are in the model. 

Sometimes I have actually make conditions on the New Record model on both the parent record Id and the parent record name in order for it to populate. 

But I'm glad you got it working,  and I congratulate you on the mental clarity to follow my cryptic notes... 
Photo of Ahmed Ellaithy

Ahmed Ellaithy

  • 160 Points 100 badge 2x thumb
I suspect I might be getting a bit greedy here but...

Is it possible to create child object records of the new object record I am creating (as per the above set up) and have the lookup field auto-populate as well within the same page?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
That is absolutely possible. Just make models for the children records and give them a condition "field from another model" to pull in the ID of the parent record into the appropriate place.   Check out this tutorial that walks you through building a page where Parent and Child records are created on one page:  http://help.skuidify.com/m/components/l/109459-create-parent-and-child-objects-on-the-same-page
Photo of Chelsea Hirschton

Chelsea Hirschton

  • 324 Points 250 badge 2x thumb
HellO! I'm trying my hand at this for the first time. I have a custom object (Campaign URLs) related to campaign. I created a Skuid page to override the "new" button for Campaign URLs. 

I created a VF page that calls my Skuid page and overrode the standard "new" button on Campaign URL with the VF page. 

I'd like for the Campaign to be auto-populated when the new Campaign URL page loads. 

I included the Campaign model in my page and set the Campaign reference field to the Campaign ID field from the other model. 

But now I don't know how to pass the Campaign ID into the VF page to start.... So for now, my new Campaign URL page is grabbing the first campaign that loads in the model.... 

Help!
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Chelsea,

What page are you starting from?  That is, do you have a list view of Campaign URL's (like a tab or table)?  Or do you have a page that shows details about a Campaign along with a table of Campaign URLs?

Thanks,

Bill
Photo of Chelsea Hirschton

Chelsea Hirschton

  • 324 Points 250 badge 2x thumb
Hi Bill. I'm starting from the standard page layout of the campaign and clicking the "new" button from the campaign url related list.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Chelsea,

The 'new' button from the related list should be 'sending' the 'id' of the Campaign in the 'link' (URL) to open the new Campaign URL page.

On your new Campaign URL Skuid page, change the condition on your Campaign URL model that references the Campaign Id from value that references your Campaign model to a 'Page/URL parameter value'.  In the example below I created a New Campaign Member Skuid page to show you what your condition will look like.


This should get you what you want.

Thanks,

Bill