How to Update a particular row in BDM

1
+1
-1

Hi
I have a Simple Process where Users can modify their information like first name , Last name and Mobile number.
For this, I have created a Table and Populated the table with users data.
Now in my process , I use a REST API to pull Data from the Table and display in the Form to the user.

Now user can modify the Existing Data and submit. This should update the First table row values for that user.
Now My Problem is I am unable to perform Update Operation of the table.
If I create a Object of the Table and use Operations to map the column in the left side and User input on the right side then in this case, it creates a New Row. It does not update the Existing Row.

Since I use REST API to pull data from the Table, hence there is no reference of the Row in the Context.
Kindly suggest what are the ways I can use to update existing data of any table.

If We need to use JPQL, then please suggest the steps to update BDM using JPQL.
regards

Comments

Submitted by Dibyajit.Roy on Mon, 03/19/2018 - 20:21

Well I got a solution from Vacation Management example.

1 answer

1
0
-1
This one is the BEST answer!

Hi, You should look for the row through a query and get the persistenceId then use the following code in Process Data

//Retrieve aggregated Proyectos using its DAO and persistenceId
def proyectosVar = proyectosDAO.findByPersistenceId(persistence.toLong())
proyectosVar.Estado = nuevoEstado;
return proyectosVar;

where persistence and nuevoEstado are contract data obtained from the form.

Comments

Submitted by vgonzalez_3 on Thu, 04/19/2018 - 19:01

Hello, good day

You could expand a little more on the solution, I've been trying to do this before with other options but I have not been successful. Where or how is this script placed, could you help me please?

Thank you in advance.
Regards,

Victor

Submitted by Dibyajit.Roy on Thu, 04/19/2018 - 19:43

Hi
This is how i proceed
Make sure to create Business Object of the particular table you want to work with.
Create a service or human task. Map a operation for the service/human task.
Left hand side, choose the table name , keep the middle section as it is ("Takes a value of") and on the Right hand side , choose Query.
Use the Queries called FindByPersistenceId. You may need to pass the persistence Id as a parameter. You can fetch the persistence id from BDM using normal rest api call.
Also you can use all other Queries like Find by Request id or Find by requester name..depending upon your attributes.
This will load the Particular row from BDM into your context. Now you can use Context variable from Form to manipulate your BDM row item.
Let me know if this helps you.
regards

Submitted by vgonzalez_3 on Thu, 04/19/2018 - 21:40

Hi
I followed your instructions and it worked, thank you very much.

Regards,
Victor

Notifications