Creating and Editing an Entity using JavaScript Action

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
1 answers



Here is the documentation with example provided by mendix:


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




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


{ 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