CMDBuild Forum

Form Trigger simple code doesn't work

Is there someone that can explain me why setting a form trigger in this way doesn’t works?

api.setValue(“Code”, “1”);

There is this video on youtube https://www.youtube.com/watch?v=N254Hb41Mr8 (26:19 minutes) that is shown this code as “working”.
Someone can explain me the problem and how form triggers works?

Thanks in advance

1 Like

Anyway, thanks a lot for this interesting video!

Hi Kvo You welcome :slight_smile:

I think you should use api.saveRecord() function after api.setValue(), see the same video at 26:39.

Thanks. Do you have any idea or know some api in the form trigger how to retrieve in js code the id of lookup instead putting in explicit way the id? The following code workings:

api.setValue(“Status”, 1000);

Status is a Lookup Variable which contains diferrent values, which i’m using in the cards , and 1000 is the id of a value.

Thanks in advance

1 Like