Hi Everyone
I write a form where i need to fill it and at the end to write the data in the DBs.
now i have a problem when i need to write in the Db.
in this project i use Two CDT. owner and customer.
i have one CDT who need to have the id of the previous CDT inserted in the DB.
for exemple i insert the customer in the db , now i need his id and insert it in the owner (CDT) before to insert it in DB.
AS you can see in the image below : i have "ID_Customer" in owner CDT.
Now i outputed the id of the customer (CDT) after that the DB write the data into it ,to put it in the owner (CDT) to update the item and write it in the DB with the id of customer.
now my problem is that i have multiple rows of owner(CDT) how can i do the same process to update each item 's id customer of each owner ?
i checked the "multiple" fields ... is it to write multiple fields at once ??? how can i solve the problem ??
AT the End i want to have two row for example of owner in my db with the same id of customer .
Discussion posts and replies are publicly visible
Hi yanivb0001 you can add a script task after first write to data store entity node and create a expression rule which will update customer ID for all rows of Owner cdt. And execute this expression in the script task..let me know if you have further questions.
i didnt understand where do you write the expression rule in the script task ?
Go to data output and you will find a way to add custom output. Please go through this link
oh okay but how can i insert with a query rule in the query editor ? i have only filters ..
Once you have customer ID then use a!forEach and iterate over owner cdt and in expression parameter use type!cdt , something like this type!cdt(
CustomerId= 12
)
well i tried to do what you said , i tried to update a list of CDT of owner just to understand
i create a list of owners and then try to update as you said but i get an error
why when i am calling the rule of the list of owners it returns me only the first item ?? i dont understand
Hi yanivb0001,
After "Write to Customer Entity" node, take a script task and user repeat() function and store the output in owner cdt.field
repeat( count(owwner cdt process variable), customerID)
i try what you said but it is not working for me ,
tell me if you see why i have this error
can u please share the error message as well