Skip to main content
January 23, 2022
Solved

Add multiple inputs in DB

  • January 23, 2022
  • 15 replies
  • 0 views

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  .

Best answer by venkatasaisatyanarayanaraot000

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

15 replies

gopalk2865
Participating Frequently
January 23, 2022

Hi [mention:caf8675fccbd4601bd9dc5e160d547a0:e9ed411860ed4f2ba0265705b8793d05]  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.

January 23, 2022

i didnt understand where do you write the expression rule in the script task ?

gopalk2865
Participating Frequently
January 23, 2022

Go to data output and you will find a way to add custom output. Please go through this link [View:https://docs.appian.com/suite/help/21.2/Configuring_the_Script_Task.html]

venkatasaisatyanarayanaraot000
January 23, 2022

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

January 23, 2022

i try what you said but it is not working for me ,

tell me if you see why i have this error

venkatasaisatyanarayanaraot000
January 23, 2022

can u please share the error message as well