creating entity object through widget

1
I am trying to simply create an object based on the entity specified on the xml definition of the widget that I am building <property key="Plott" allowNonPersistableEntities="true" type="entity"> <caption>Plox object</caption> <category>Appearance</category> <description>The message visible within the widget.</description> </property> on post create I then need to create an object of this type therefore I have wrote the following mx.data.create({ entity: this.Plott, callback: function(obj) { console.log("Object created on server"); }, error: function (err) { console.warn('Error creating object: ', err); } }, this); the issue is that when the widget execute and the mx.data.create is called , I get the following error, mendix.sys.Data.create: entity is not a string Uncaught Error: mendix.sys.Data.create: entity is not a string does anyone know what am I doing wrong? Thanks
asked
1 answers
0

Can you put a breakpoint on the mx.data.create line and inspect this.Plott? It should be a string like "MyFirstModule.MyEntity".

Also, make sure your 'this' is still your widget. If you got there via a callback without using lang.hitch, the 'this' variable would have changed and you can no longer reach Plott on the original widget's 'this'.

answered