Solved

create an item at SharePoint only if it does not exist already

  • 26 May 2023
  • 3 replies
  • 160 views

Userlevel 1
Badge +7

Hi I am trying to find a way to add an item to SP list only when it does not exist before. Below is my workflow, however by using Loop for each, it will create duplicate items depending on the number of items already at SP. Is there a way to fix it? Maybe adding a condition in Create an Item action or add a new action to delete duplicate items? Thanks vm!

 

icon

Best answer by Garrett 26 May 2023, 12:15

View original

3 replies

Userlevel 6
Badge +16

Hi @mjliu 

Your Start Event is the NAC Form.

Are you taking a single item or record value or multiple items / records from a Repeating Section ?
Which is the “Keyword” field - eg EmployeeID, DepartmentName 

Userlevel 6
Badge +16

If you have a single item and the unique column field is called Department and the value on the form is “Engineering

  1. Query a List. Condition → When Department, equals, Start Event: Department field value
    Output: SPO_Department   (Important)
  2. Branch by Condition
    SPO_Department → Number of Items return
    0 means No such item exists, so you can Add
    1 or more means that there are existing items with that keyword

 

final workflow

 

Userlevel 6
Badge +16

If you have a multiple items , Repeating Section is called RS and and the unique column field is called Department and the value on the form is “Engineering

 

  1. Loop For Each. Target collection is “RS
  2. Query a List. Condition → When Department, equals, Loop for each-Current item-Department 
    Output: SPO_Department   (Important)
  3. Branch by Condition
    SPO_Department → Number of Items return
    0 means No such item exists, so you can Add
    1 or more means that there are existing items with that keyword

Final workflow - Multiple Items

 

 

Reply