set default values for lookup field - works in some cases

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Hi in some cases, when I have a condition on the model to set the lookup fields such as contact, they display properly as contact Name instead of Id values. In this one case, I'm using the same condition and it's displaying the contact as record id. This is happening inside the same page. Any reason for that? I read some posts here that say I need to do something like this:

        model.updateRow(row,{
           Contact__c: MyContactRow .Id,
           Contact__r: MyContactRow .Name
        });

Is that still true?
Photo of Janet

Janet

  • 486 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Janet

Janet

  • 486 Points 250 badge 2x thumb
I figured it out. If it comes from the Id page parameter, Skuid doesn't know. But if it's from a contact model, Skuid knows. So I assume no code is needed in this case.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
If its a new record skuid doesn't know the name field behind an Id.  That linkage has to be in some model on your page.  We usually build "Existing record" models that are populated with the URL parameter (and have name, Id, and whatever else you'd want).  Then in your new record you can populate the relevant lookups with "field from another model" conditions.