Home > Forum > Rules, JS, SQL > Update Item list in parent instance

Update Item list in parent instance
0

Hello,
I have a parent process with Item list. This item list is list of tasks. I can add positions to this list and I have a button to initialize this list as a tasks. In this list I have a title, responsible person, status of the task and section (it should be item list with attributes in the form?).
When I add the position and put in all data (title, person responsible and section) I hit the button, and I make new process Task to responsible person - new workflow.

I have 2 problems:
1. When a task will be done, the status column in parent workflow will update to DONE.
2. When I open the task workflow, there is a section column which should have a name of the attribute. And based on it this attribute will be seen in Task Workflow to edit.

To the first point, I've tried to add action on ending path in Task Workflow to update related workflow instances, but I don't see Item list. Maybe SQL?? But I don't know how to write it...

Thanks for help.

MVP

Hi,
If I understood correctly, you want to update the corresponding line in the parent item list from the child process.
To update a line from the child in the item list of the parent process, you need to have a unique key to identify the line in the item list (you can either send the line's ID from the parent process to the child process or identify a unique value per line).
From the child process, update the parent process using the 'change itemlist values -> update values' action. IT's necessary using the sql script.
I added a image with example sql.

Thanks,
Raluca

MVP
In reply to: Wojciech Mleczko

Direct update on BPS databases is not good practice. It can cause unexpected behaviour, and cause inconsistent data in history tables. I think that better way is invoke REST webservice to update parent element (save).

Maybe good idea is to add "update item list on other/parent element" action to "User Voice" section.

Hi,
My apologies, there was a misunderstanding. By 'Sql update action,' I was referring to the 'change itemlist values' action that uses SQL.
I think there might be a misunderstanding.
I didn't specify to perform the update directly in the database, but rather through the 'change itemlist values -> update values' action.
If we have the parent's wfd_id and the id of the row in the item list that we want to update, or a way to extract the row's id from the item list using unique values, we can use the action.

Thnaks,
Raluca

In reply to: Raluca-Mirabela Lupu

Hi,
My apologies, there was a misunderstanding. By 'Sql update action,' I was referring to the 'change itemlist values' action that uses SQL.
I think there might be a misunderstanding.
I didn't specify to perform the update directly in the database, but rather through the 'change itemlist values -> update values' action.
If we have the parent's wfd_id and the id of the row in the item list that we want to update, or a way to extract the row's id from the item list using unique values, we can use the action.

Thnaks,
Raluca

Hi,

I'm trying to understand what you have written :)

I understand about passing ids of item list from parent instance to child instance (workflow).
Now, I can pass item list of the parrent (using bps source) to child and display it. But in Child process I have ability to edit the item list (delete, update, add) and when I'm done, I click finish button, child instance is closing and the parent item list shoud be excatly like it is in child instance.

I don't know how this sql command is working that will do it what I want.

Regards
Adam

MVP
In reply to: Adam Wojnarowski

Hi,

I'm trying to understand what you have written :)

I understand about passing ids of item list from parent instance to child instance (workflow).
Now, I can pass item list of the parrent (using bps source) to child and display it. But in Child process I have ability to edit the item list (delete, update, add) and when I'm done, I click finish button, child instance is closing and the parent item list shoud be excatly like it is in child instance.

I don't know how this sql command is working that will do it what I want.

Regards
Adam

Hi,
Step 1. From the parent process, you need to send the det_id (row_id) when starting children.
Step 2. In the parent process, you should create a path to the same step with a 'change itemlist' action.
Step 3. In the child process, when you press the 'finish' button, you should have a 'move to workflow' action, through which you send the parent path_id (where the update should take place), parent wfd_id, and in a technical field, the child wfd_id (wfd_id of the current instance).
Step 4. In the parent process, configure the 'change itemlist' action.
Updating through API or SDK may be simpler.

Thanks,
Raluca