Reference field type not auto selected in some environments

Feature(s) impacted

Reference Field to a table not picking up the type of the field

Observed behavior

We have a form for a smart action where we have bunch of fields(refer forest-screenshot-1)

,
one of the field is country which is referenced to countries table like below
{
field: ‘Country’,
reference: ‘countries.id’,
isRequired: true,
}
i have onChange hook on some other field ‘owner’. When i change the owner its throwing error as ’ type of "Country" on the smart action "Place Order" must be a valid type. See the documentation for more information’ and the payload is like this (forest-screenshot-2).
We have different environments in forest dev, staging and Production. With same code changes this behavior is working as expected in dev but not in staging and production.
what could be the issue? I believe forest version would be same in all environments.

Expected behavior

type should be picked up automatically
as it is working in other environments
(forest-screenshot-3-expected-payload)

Context

  • Project name: …
  • Team name: …
  • Environment name: …
  • Agent technology: (nodejs, php, rails, python)
  • Agent (forest package) name & version: …
  • Database type: …
  • Recent changes made on your end if any: …

Hi @Sudheer_K ,

To be able to help you further I will need you to fill these information:
Project name: …
Team name: …
Environment name: …
Agent technology: (nodejs, php, rails, python)
Agent (forest package) name & version: …
Database type: …
Recent changes made on your end if any: …

Regards,
Shohan

Project name: Monta
Team name: …
Environment name: Issue facing in Staging and Production, In dev working fine
Agent technology: nodejs
Agent (forest package) name & version: …
“forest-cli”: “^4.3.2”,
“forest-express-sequelize”: “^9.3.11”
Database type: Mysql

Could you please send me the Smart Action code with the hooks and the two fields (country and owner) ?

hi @shohanr
thanks for responding. here is the smart action code…
{
name: ‘Place Order’,
type: ‘global’,
endpoint: ‘/forest/actions/place-order’,
fields:[
{
field: ‘Autofill From a Previous Order’,
description: ‘Optional. You will still be able to update all fields’,
type: ‘String’,
reference: ‘orders.id’,
isRequired: false,
hook: ‘onCopyChange’,
},
{
field: ‘Owner’,
description: ‘Owner of the order’,
type: ‘Enum’,
enums: [‘User’, ‘Operator’],
isRequired: true,
hook: ‘onOwnerChange’
},
{
field: ‘Country’,
reference: ‘countries.id’,
isRequired: true,
}
],

Thanks ! And could I also see the actual hooks please ?

@shohanr issue was solved after adding type attribute in Country field.
Thank you.