`name` field set to the value of `id` when creating AssetQuestion

#1

I’ve a type AssetQuestion defined as follows:

entity type AssetQuestion mixes Question<FixedAsset> schema name 'PEAT_AQSTN'

It’s a persist-able type so it has a name field, but it seems that Question too has a name explicitly defined on it.
The problem is when I create an instance of AssetQuestion, the final name field gets the value of id!

> AssetQuestion.create({id: 'test', name: 'name of test', displayType: 'Hidden', questionType: 'Initial'})
> var obj = AssetQuestion.fetch({filter: Filter.eq('id', 'test')}).objs[0];
> JSON.stringify(obj)
"{"type":"AssetQuestion","id":"test","version":1,"name":"test","meta":{...},"displayType":"Hidden","questionType":"Initial","shortName":"test"}"

What’s wrong with this particular type? and how I can set the name to the value I want?

#2

It seems this has to do with Translation as described here What format should my translation key be in to have @translateData find it?

When looking at the translation documentation on https://vanity-url/api/1/engie-claradomus/prod/documentation/topic/Translation

It seems that I’m missing the translations keys corresponding to current locale that can be found form console with C3.client.context.locale.

So the solution is just to upload the translations for those questions!

#3

And if all else fails… e.g. your translations are valid, your locale is correct

try clearing the translations cache with Cache.empty(‘c3.love.expr.eval.translationCache’)

1 Like