Hello! I got a table called “customers” with field called conctracts that is linked to my table contracts. When I added a new customer I want to create a new contract via the + sign of the linked table inside my customers table.
In order to create a new contract I need to asign it to a customer. This field is linked back to customers.
If I want to create a new contract inside of the table customers with the + sign i want to prefill the field with the current customer under which I want to create the contract in.
I have tried it via setValue but it does not work. Enclosed my code:
(async (doo: IDoo) => { // do not change this line
// place your code here
async function getKundenobject(id){
let d = await doo.table.getData(“kunden”);
for (let i = 0; i < d.data.length; i++){
if (d.data[i].id == id){
return d.data[i];
}
}
return null;
}
function prefill_Vertraege(kunde){
doo.model.vertrage.setValue({
vorZuname : kunde.fields.vorZuname
})
}
let kundeobj = await getKundenobject(doo.model.vertrage.modelId);
if (kundeobj){
prefill_Vertraege(kundeobj);
}
}) // do not change this line