webiny/webiny-js

Getting a field from ref type as titleFieldId

halchester opened this issue · 0 comments

Hello,

Description

Say I have a model that looks like this

const product = new CmsModelPlugin({
    ...required props,
    fields : [
   ... other fields
    {
    id: 'category'
    type : 'ref',
    settings:{
    models : [{modelId : 'category'}]
}
}
],
    titleFieldId : 'category'
})

and category looks like:

const category = new CmsModelPlugin({
    ...required props,
    fields : [
    {
    id: 'name',
    fieldId : 'name'
    ...props
    type : 'text',
}
],
    titleFieldId : 'name'
})

Intended outcome

When I go to admin app and then go the products, I want to see the category name as the titleFieldId.

Current outcome

It is saying that string cannot represent type of that object.

Notes

I am quite new to the webiny headless CMS, so how can I get around this issue? I figured it has something to do with Graphql but can't seem to find documentations on that.