How to update/insert data into Many to Many Association Reference Table
HI Experts, I have two entities User and Client and they have many to many relationships. I have a requirement where I need to update or insert single record in the association table. Whenever a user login my process has a login which will decide this user should be able to see which Clients data through Xpath constraints. We are managing this by storing the Association data in User_Client table. These works fine when all different user logs in. But we are facing issue when same user logs in from a different browser and when this happens all the other logged in users which are associated with the same clients gets kicked off as there association data gets wiped out from the association table. Below is the example. Scenario 1: Association table data User1→ Client1 User2→ Client1 User3-->Client1 here it works fine. But now if the User1 logs in using a different browser then the association table data looks like this. Scenario2: Here User2 and User3 data from association table gets overwritten by my Microflow. User1→ Client1 The issue I am facing is that I am not finding a way to skip inserting/updating the association table data if the users association exists. I have put a decision check to skip adding/updating association data if it exists but it is by default overriding the association data. Any Idea to to handle this issue?
Dilip Kumar Shaw
HI Dilip Kumar Shaw,
If I am not wrong in the change object you are using ‘set’ option and updating the association( this is the reason why the data is getting over ridden), there will be two more options enable in your change object which is ‘Add’ and ‘Remove’( For Many- Many ) . You can use the Add and then set the association( this option will add the object in the association table on top of existing list) .