Update changes between two SharePoint Lists

Copper Contributor

I have two List as below

Mihiranp_0-1710255023100.png

Mihiranp_1-1710255049894.png

one for Ticketing and another for Test Ticketing. I need to ensure that if I update a specific customer's information in the Ticketing list, the same changes are reflected in the Test Ticketing list. If the record does not exist in the Test Ticketing list, it should be created as a new entry.So i created flow as below

Mihiranp_2-1710255232755.png

 

Mihiranp_4-1710255281717.png

 

Mihiranp_5-1710255343056.png

 

Mihiranp_6-1710255442930.png

 

Mihiranp_7-1710255476124.png

 

Mihiranp_8-1710255502167.png

 

Mihiranp_10-1710255542948.png

 

Mihiranp_11-1710255574245.png

 

Mihiranp_13-1710255601655.png

 

 

Mihiranp_14-1710255704172.png

 

 

tested the flow and found that item creation was not working

5 Replies

@Mihiranp 

Alternatively, you can fulfill this requirement with few steps. Check and let me know if this works for you.
1)Following a trigger'When an item or file is modified'
2)Use the 'Get Item' and Set the Site Address and List Name for Test Ticketing list, In the Filter Query field, enter the condition to match the column in Test Ticketing list with the Ticketing list.

Title eq 'triggerOutputs()?['body/Title']'
3)Add a Condition which verifies whether the length of the retrieved items from SharePoint is greater than zero. If it is, it updates the existing data in the SharePoint list; otherwise, it creates a new item.

length(outputs('Get_items')?['body/value'])

NarasimaPerumalChandramohan_0-1710321417785.jpeg

 

If this solution proves helpful and resolves your issue, kindly consider marking it as accepted. Doing so will aid others who encounter similar challenges in the future.

Regards,
NarasimaPerumal Chandramoha
Microsoft MVP
Apps4.Pro - Trusted Office365 T2T Migration partner. Migrate Exchange, SharePoint, Microsoft Teams, Stream, Yammer, Power Platform between tenants.
Product Specialist - http://www.apps4.pro/

@NarasimaPerumal Chandramohan
I have created the flow as above but facing an error once the item creating

Mihiranp_0-1710330681299.png

 

this is my get item filter

Mihiranp_1-1710332186869.png

 

this my condition

length(outputs('Get_items')?['body/value'])
 
greater than zero

@Mihiranp 

The 'Create item' action should not be nested within the apply to each loop. I observed that you've dynamically used values from the 'Get items' action to create the item. However, you should incorporate values directly from the trigger 'When an item or file is modified', since it is the new item.

@NarasimaPerumal Chandramohan 

 

Hi,
When updating an item in the main list, a new item is created successfully in the second list if it doesn't already exist. However, if the item already exists in the second list, a new item is created instead of updating the existing item

 

Mihiranp_0-1710762360152.png

 

Duplicate record

Mihiranp_1-1710762394998.png

 

Ensure that the 'Get item' action includes a filter query based on a unique field present in both lists, such as full name or ticket number. This helps to verify if the item already exists in the second list and allows for updates to be made accordingly.
If so , please provide a screenshot of the 'Get items' action with all fields expanded.