Use a field from one model, in another (REST datasource) model

srlawrsrlawr Member
edited October 2019 in Questions
I have created a REST data source (called ChuckNorris), which seems to work fine.

I have then also created a "Model" to represent a call out to this data source... but I "need" to include a field from another model in the the Data Source URL. Is that possible? Here is the data source definition as it currently stands:

image


So as you can see, I am trying to tokenize the firstName parameter in the GET URL. Ideally, I just wanted to put the AccountName for this whole page in there. I have a standard Salesforce Model called AccountHigh (as in high level) which has a couple of fields in, including the name. I couldn't get this to work though, so I tried to make a UI-Only model called AccountName - which just takes the Name field from the AccountHigh model.

It was my understanding that UI-Only models can be referenced from page components which are otherwise associated with other models (ie.. they are kind of more "global" ?) - it still doesn't come out with anything though.

What I am ultimately doing is then putting this "Chuck" model from the REST data source into a Template... like this:

image

and

image


which does work on the page just fine... however,

(TL;DR question summary:)
Because of the problem with including the AccountHigh or AccountName model in the Chuck REST data source model, my firstName parameter is being sent over empty. How might one reference fields like Account.Name in the Chuck model?


Thanks a lot. Still loving Skuid... :D

Comments

  • edited October 2019
    Did you try {{$Model.AccountHigh.data.0.Name}} This should bring in the name of the account from the account record in the first row of your AccountHigh model.
  • srlawrsrlawr Member
    edited January 2017
    oh my word, that worked so well and so fast I could kiss this forum on my screen (if it didn't break almost every rule in my companies policy for IT equipment use).

    I am now off to spend some time reading up on these global variables I have otherwise not yet encountered! Cheers.
  • edited January 2017
    Yes.. the global merge variables are very handy. Not all the uses are documented. There are "secret" ones like model lookup and aggregate model merges and child relationship merges that I don't think made it in to the documentation, but are floating around the community. For the most part, if there is information somewhere, you can merge it. You just have to figure out the correct format for the merge.
Sign In or Register to comment.