Plugin API in custom widget, create record with reference column

Dear all,

I try to create a record in a table “Document” by the plugin API from a custom widget. That document table is referencing in the column “Type” one object from the DocumentType table.
But when I try to set the value of the reference column in the Document object to the text value of a referenced item, it adds the value itself. But in the table view that value is just as it is, e.g. “Report” for the Documenttype object name, no object is referenced.

Could you please help and tell how I can programmatically create a document record while adding the documenttype value to a reference object with the plugin api in Javascript?

Thanks!

@Hans_Schulz, you might want to take a look here. I think that’s the same issue, the solution should work here, too. Hope it helps!

@TomNit, that helped, thanks very much for your quick help!

Regards
Hans