Skip to main content
February 23, 2023
Question

How to update output saved in DB in a new process as input which is a array

  • February 23, 2023
  • 2 replies
  • 0 views

I have contact recordtype and experience record type with 1 contact to multiple experiences, linked through contact.id = experience.contactId.
I have a form which saves contact details and a editable grid to capture multiple experiences. When I save I run a process model to first write to the contact DB and then I am writing in experience data entity.

In the wirte to DSE for experience, I have mapped the input of data note in second process with contact.id generated automatically from DB in contact table.
This works fine with 1 experience entry, but if I add 2 entries then the process error out as for 2nd experience entry the contatId is null and due to which unable to write the data in experience table.

Can someone help?

2 replies

February 23, 2023

Hi,

Add a script task before write to experience DB. In this new script out put do the following logic and save back to pv!experience.contactId

repeat(
  /*You need to map your experience process variable here*/
  length(pv!experience),
  pv!contact.id
)

It will save contact id to all experiences

February 24, 2023

Great, it worked perfectly. Thanks