Hi All , I am able to create a new app by following the steps in the doc for Mendix SDK . A new app is getting created , I followed document to create entities , that doesnt seem to work . Can anyone share a sample code to create entities and also microflows in Mendix SDK? Also every time the code is executed does a new app get created ? How to avoid this ? This is the code that I executed , a new app is getting created. import { domainmodels } from "mendixmodelsdk"; import { MendixPlatformClient } from "mendixplatformsdk"; async function main() { const client = new MendixPlatformClient(); const app = await client.createNewApp(`NewApp-${Date.now()}`, { repositoryType: "git", }); const workingCopy = await app.createTemporaryWorkingCopy("main"); const model = await workingCopy.openModel(); const domainModelInterface = model.allDomainModels().filter(dm => dm.containerAsModule.name === "MyFirstModule")[0]; const domainModel = await domainModelInterface.load(); const customer = domainmodels.Entity.createIn(domainModel); customer.name = `Customer`; customer.location = { x: 100, y: 100 }; const invoice = domainmodels.Entity.createIn(domainModel); invoice.name = `Invoice`; invoice.location = { x: 400, y: 100 }; const invoices = domainmodels.Association.createIn(domainModel); invoices.name = `Invoices`; invoices.child = customer; invoices.parent = invoice; invoices.childConnection = { "x": 100, "y": 30 }; invoices.parentConnection = { "x": 0, "y": 30 }; await model.flushChanges(); await workingCopy.commitToRepository("main"); } main().catch(console.error);
asked
K Divya
1 answers
0
Hi K,
You actually have there is an amazing blog post you can follow along with here: