Javascript action to create an entity fails

0
Hello All In Mendix, I am trying to create an entity using java script action and nanoflow(created as button in the default home page). version: 8.15.1 import { Big } from "big.js"; export async function JavaScript_action() {     // BEGIN USER CODE mx.data.create({ entity: "MyFirstModule.Cat", callback: function(object) { console.log("Object created on server"); }, error: function(error) { console.error("Could not commit object:", error); } }); throw new Error("JavaScript action was not implemented"); // END USER CODE } But its not working and I am getting the following error:   No permission to read or write entity MyFirstModule.Cat, check security! Cannot read property 'needsReachableState' of undefined TypeError: Cannot read property 'needsReachableState' of undefined     at R.<anonymous> (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:79:243014)     at c (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:79:9171)     at Generator._invoke (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:79:8924)     at Generator.next (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:79:9530)     at n (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:39:107397)     at s (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:39:107608)     at http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:39:107667     at new Promise (<anonymous>)     at R.<anonymous> (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:39:107548)     at R.<anonymous> (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593139113631896:79:243603) An error occurred while executing an action of MyFirstModule.Home_Web.actionButton1: JavaScript action was not implemented Error: An error occurred while executing an action of MyFirstModule.Home_Web.actionButton1: JavaScript action was not implemented     at http://localhost:8080/mxclientsystem/mxui/mxui.js?637593149566774740:79:304483     at _e (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593149566774740:34:6720)     at r (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593149566774740:34:6616)     at y (http://localhost:8080/mxclientsystem/mxui/mxui.js?637593149566774740:39:148480) Questions: What security access must be given/set? How should I define the property 'needsReachableState'?   Please help! Thank you Aarthi
asked
1 answers
1

You need to go to the domain model, open Cat, click on the last tab ‘access rules’ (which is only shown if you “Project”->”Security”->”Security level” is set to ‘Production’) and add a rule for a userrole to have read/write access.

answered