AUto-populating a Lookup Field into a Skuid page

  • 2
  • Question
  • Updated 2 years ago
  • Answered
hi guys

i'm currently trying to get a Lookup field to auto-populate when i redirect to a new Skuid Page. 

I'm pretty sure I had it working fine til now when I had passed the id parameters through the url. When I create a record now it doesn't auto-populate with the correct field and it hangs when i save the record.  
I've also tried adding the Model with the field and using the "Field from another Model" condition type. 


FIELDCase records where Bank_Group__c
OPERATOR
is
VALUE
the group_id parameter in the page's url
STATE
This condition is always on.


FIELD - Case records whereBank_Group__c
OPERATOR
is
VALUE
the value of the Id field from the first row returned by the BankGroup model
STATE
This condition is always on.

Any help would be appreciated!
Photo of JP Gazo

JP Gazo

  • 154 Points 100 badge 2x thumb
  • concerned

Posted 3 years ago

  • 2
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Hi Guys, 

I have a similar issue and i don't know what to do. So what is happening in my case is:

I have Detail Page for entitlements. All the entitlements that we have are tied to accounts. SO When i say i am on an entitlement detail page, it is related to an account. 

On the detail page, I created a pop-up button from which we can create a new case related to the entitlement. When the pop up opens, it shows all the fields that are to be filled to file a case.  Among these fields, account is a look up field from which we have to select what account is the entitlement tied to.

My Case creation pop up looks something like this.

No My issue is, IS there any way to auto populate the account field. So whenever there is a need to create a case, we will create a case from the pop up and when the pop up is opened the account name should be populated automatically (The account name should be  same as what we see on the entitlement detail page ) on the New Case Layout.

My entitlement detail page looks like this:

 




How can i solve this issue?

Thanks.
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
This reply was created from a merged topic originally titled Pre-Populate the Account name (look-up) field On the Case layout pop-up..

Hi,

I have Detail Page for entitlements. All the entitlements that we have are tied to accounts. SO When i say i am on an entitlement detail page, it is related to an account.

On the detail page, I created a pop-up button from which we can create a new case related to the entitlement. When the pop up opens, it shows all the fields that are to be filled to file a case.  Among these fields, account is a look up field from which we have to select what account is the entitlement tied to.

My Case creation pop up looks something like this.

No My issue is, Is there any way to auto populate the account field. So whenever there is a need to create a case, we will create a case from the pop up and when the pop up is opened the account name should be populated automatically (The account name should be  same as what we see on the entitlement detail page ) on the New Case Layout.

My entitlement detail page looks like this:

 




How can i solve this issue?

Thanks.
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Avinash,

Try adding an action to your new case model to update a field when a new row is created. You can update the AccountId of the new case based on the AccountId in the Entitlement model. You’ll have to use global merge syntax (discussed here) to get the AccountId from the Entitlement model. Here are some screenshots explaining the process:







The full text in value is {{$Model.EntitlementModelName.data.0.Account__r.Id}}

Make sure that the Account__r.Id field is in the Entitlement model 




Thanks!

Amy

Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Hi Amy,

I just replicated what you explained. But nothing actually worked out.

Please look at the screen shot  below to see if i made any mistake.  


I can show you the xml that i have.

Thank you.

-Avinash
(Edited)
Photo of Karen Waldschmitt

Karen Waldschmitt, Official Rep

  • 8,260 Points 5k badge 2x thumb
Avinash~

Check out this post and this tutorial and see if it helps ...

Karen
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Hi Karen,

I followed the tutorial but no luck. There must be one area that i am missing but i am unable to figure it out.

I have added all the conditions just as explained in the tutorial but still seeing the account field not populating. 
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Avinash,

Make sure you're updating the AccountId of the Case model that's on the field editor in the pop-up (right now you're updating the AccountId of Case, but I'm guessing you need to update the AccountId of NewCase). Also, I'm sure you did, but can you double-check that the name of your Entitlement model on page matches what you have in {{$Model.Entitlement.data.0.Account__r.Id}} and that Account__r.Id is in that model? For instance, if my Entitlement model was named EntitlementModel then I would put {{$Model.EntitlementModel.data.0.Account__r.Id}}.

Thanks!
Amy
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Hi Amy,

I have double checked my model conditions and the merge syntax. Everything looks fine.

My Model name on the pop up is : EntitlementID. and the merge syntax i have is: {{$Model.EntitlementID.data.0.Account__r.id}}

I have changed my model name from case to NewCase. But still nothing changed.

I guess i am missing some small link in between but unable to figure it.

can you help me out with this issue?
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Avinash,

I may have made some faulty assumptions about your model set-up, so let me give you an overview of what I’m doing and see if that helps. To auto-populate the look-up field of the new record that is being created, I’m adding an action to the model that's on the field editor in the pop-up (where the new record is being created). That way, when the pop-up appears and a new row is created in that model (I’m assuming that happens when the pop-up opens), I’m setting the value of the Account look-up field. I thought that NewCase was the model on the field editor in the pop-up and that therefore the action needed to be on that, but it looks like it might be otherwise. The model action to update field on new row creation needs to be on the model associated with the field editor on the pop-up where you’re creating a new record. So, if EntitlementID is the model on the field editor in the pop-up that’s creating a new row, and you want it to auto-populate the AccountId, it needs to have the action to update field on new row creation. Additionally, the merge syntax ({{$Model...}}) for getting the Account Id needs to come from the model that already has the AccountId associated with it. That may be the EntitlementId model, but it may not be if EntitlementId is only used to create new records. 

Hope that all makes sense!

Amy
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Amy, 

Your initial assumption was correct. I have a pop up which open a form to create a new case. This pop up has page include component on it Which is used to create a new case from the Entitlement detail page.  The new case layout in the pop up has a set of fields and AccountID is one of them. The model used in the pop up's field editor for creating a case is NewCase and on this model itself i have my action condition as below. Also i have two conditions on the model shown below. are they effecting me from solving the issue?

The other model that i am using in the page is EntitlementID which has one condition on it as shown below.
.
But still the AccountID is not populated when the page is loaded.
Photo of Avinash

Avinash

  • 1,726 Points 1k badge 2x thumb
Hi Amy,

I have a question.

The Objects that i am using in my issue are not having master detail relationships between them (I don't have a junction object in my issue). i.e, Account has master-detail relationship entitlement. So Account is the master Object and Entitlement is Detail Object. Whereas There is no Master-Detail Relationship Between Cases and Accounts. 

Case Object only has lookup relationship with Account and Entitlement objects. Is this the reason for not auto populating the AccountID on the New Case page?

What i see from this tutorial (http://help.skuid.com/m/supercharge-your-ui/l/558085-add-product-line-items-to-opportunities-with-a-popup?_ga=1.12690935.1743181189.1471628866)  is, auto populating ID's Which are having Junction Object Relationship between them.

Please let me know if that is where i am going wrong.

Thanks.

-Avinash
(Edited)
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Avinash,

The page include is what's causing issues. If you're interested, you can check out this tutorial for more details about page includes and how to pass parameters to the models inside them. In your case, you need to add a parameter to the query string of the page include. In the query string, you can pass the AccountId of the Entitlement model by saying accId={{$Model.EntitlementModelName.data.0.AccountIdFieldName}} (use &accId=... if you already have a parameter in the query string). You have to match up the Entitlement model name and name of the AccountId field for the information to get passed correctly. Then, on your page include page, you can add a condition to the NewCase model to look at the page parameter of accId to set the AccountId field. Make sure to delete the action that's trigged by a new row creation on NewCase. You don't need it anymore because the AccountId is now getting populated through a condition instead of an action.

Thanks!
Amy