Creating and Editing an Entity using JavaScript Action

0
Hi I am working on developing a web application that shows the courses data of the school. And we try to keep using JavaScript files that we use from old web applications. But the hard part of this is to edit and create an entity from JavaScript action. So, How can we access the entity in the domain model from JavaScript? And how can we filter or edit the data? I tried to follow Mendix Documentaion and read others’ questions on the forum, but it still shows errors and I have no idea how this works. Thank you for your time
asked
1 answers
0

HI 

 

Here is the documentation with example provided by mendix:  https://docs.mendix.com/howto/extensibility/write-javascript-github

 

You can pass any entity you want through input param to javascript. You can access attributes by set/get functions.  example

mxObject.get(attr);

mxObject.set(attr,attrValue);

 

Use this documentation to get information from mendix entity with different xpaths and filters: Mendix 8 Client Documentation: Namespace: data

example:

mx.data.get(

{ xpath: "//System.User", filter: { sort: [["Name", "asc"]], offset: 0, amount: 10 }, callback: function(objs) { console.log("Received " + objs.length + " MxObjects"); } });

 

for xpath you can provide any xpaths you can think of and use in retrieve activity . 

How to write xpath you can find here: XPath | Mendix Documentation

 

Regards,

Anahit 

answered