Skip to main content
nitinn0007
Inspiring
Jun 16, 2022 5:29 AM UTC
Solved

script task in process model

Hello community,

   I am tried to store my all data of form into database,

   So in that I used more than 1 CDT in my form, and then I am using script task to mapping one ID into other one, and then I am using multiple data store entity

  to send all data at a time in different tables of database.

So now the issues is that My all data is saving but

script task is not working, I am unable to mapping ID.

So what I have to do  to map.

stefanhelzle0001
Brainy
Jul 27, 2022 8:28 AM UTC

Your code in the output of a script task should like something like this

a!foreach(
  items: pv!something,
  expression: a!update(
    fv!item,
    "foreign key field",
    pv!customer.id
  )
)

a!save() does only work inside a saveInto on UI components.

8 replies

harshitb6843
Brainy
Jun 16, 2022 6:08 AM UTC

You need to run write to DSE node. NOT write to Multiple DSE. 
because you need the ID of first table in the second one. Therefore, you a write to DSE, store the output in the same variable, use a script task to map the id into another table, and then write the second table. 

nitinn0007
Inspiring
Jun 16, 2022 7:00 AM UTC

First I used write to DSE  from that I take only 1 CDT in that and I got the ID and that after used script task, and then I used

Multiple DSE than I am getting all the details in my database