Problem binding dropdown with BDM

Hello,

I’m using Bonita 7.3.

I have created the following BDM:

  • Notificacion (BDM Object)

    • codigo (String)
    • descripcion (String)
    • obligatoriedad (BDM Object)
  • Obligatoriedad (BDM Object)

    • codigo (String)
    • descripcion (String)

At the beginning of the process, I initialize a process var type “Notificacion” from BDM with an operation (with “findbypersistenceid”).

In a second task, I have a form which must retrieve the “Obligatoriedad” field and save it at BDM. For it, I have two form vars:

  • “notificacion” that contain the business object ( …/{{context.notificacion_ref.link}} ).
  • “tiposObligatoriedad” that contain the available types at BDM to bind with a dropdown ( …/API/bdm/businessData/com.company.model.Obligatoriedad?q=find&p=0&c=10 )

In the form I have used a DropDown with the following configuration:

  • Available values: tiposObligatoriedad
  • Key shown: descripcion
  • Return key: empty to return the entire object
  • Value: notificacion.obligatoriedad

The value of “formOutput” var is

return {
‘notificacionInput’: $data.notificacion
};

When I run this process, and select a value from the dropdown, the submit is OK, but when I check the database, I find following error:

Table “Notificacion” (BDM Notificacion)

  • PERSISTENCEID = 1
  • CODIGO = N5
  • DESCRIPCION = “BLABLABLA”
  • PERSISTENCEVERSION = 3
  • OBLIGATORIEDAD_PID = 5

Table “Obligatoriedad” (BDM Obligatoriedad)

Three records with master data

RECORD 1

  • PERSISTENCEID = 1
  • CODIGO = OBL
  • DESCRIPCION = OBLIGATORIA
  • PERSISTENCEVERSION = 0

RECORD 2

  • PERSISTENCEID = 2
  • CODIGO = VOL
  • DESCRIPCION = VOLUNTARIA
  • PERSISTENCEVERSION = 0

RECORD 3

  • PERSISTENCEID = 3
  • CODIGO = NA
  • DESCRIPCION = NO APLICA
  • PERSISTENCEVERSION = 0

And a fourth record with the selected object at dropdown

RECORD 4

  • PERSISTENCEID = 5
  • CODIGO = NA
  • DESCRIPCION = NO APLICA
  • PERSISTENCEVERSION = 3

The problem is, that I need that if I select for example the value “NO APLICA” from the dropdown, BDM don’t create a new record. BDM must set the field “OBLIGATORIEDAD_PID” in “NOTIFICACION” table to the value 3, it is the PERSISTENCEID for the value selected (NO APLICA)

Some help please?

Hi,

So if I understand correctly, you have existing records in the table “Obligatoriedad” and you want a dropdown list to display those records, select one to link it to your current instance of “Notificacion” object. Is that correct?

If so I would do the following:

  • Change the dropdown “return key” value to return only the Id of the selected “Obligatoriedad” object.
  • On submit, return only this ID
  • Modify the contract task to take in input only the ID of the selected “Obligatoriedad”.
  • Add an operation to set your instance of “Notificacion” with the ID of the selected “Obligatoriedad”

Hope it helps.
Cheers