Skip to main content

Hello all,

We have the following two lists: list A contains a collection of hyperlink items, and list B contains ID from list A and user login - it's one-to-many relationship (i.e. List B may have multiple IDs from List A). Since this link ID in List B was set up as a text column, we ran into an orphan-item situation when a link is deleted from List A. Therefore, we would like to kick off an K2 workflow as follows: when an item in list A is deleted, K2 will look for items in list B by link ID, then delete those items with matching link ID in list B.

I created smart objects for lists A and B, and made them available for the K2 site/workflow. However, I didn't find any method to grab items from list B using indexed column (link ID).  There are only three "Get List Item" methods available:  get list item by Name, by ID, or by Title.

Help!  Any suggestions will be greatly appreciated.

Thanks.

Hello LAURINDA,

 

As far as i understand i assume there are 2 lists as below examples. (Assuming both are SmartBox SMO's)

List A = Brands
BrandID Brand Name
1              SONY
2              LG
3              DELL
4              APPLE

 

List B = Products
ProductID  BrandID  ProductName
1                  1               SONY - XPeria Mobile
2                  1               SONY - KLV LCD Television
3                  4               APPLE - IPhone 6S
4                  4               APPLE - IPhone 6S Plus


Now the requirement for you is When you Delete an Item from Brands (List A), you want to delete it's respective items from Products (List B)

 

To Achieve this in, we don't need a workflow we can manage it directly in smartform rules as below.

Step 1: Take a Hidden DataLabel to store BrandID temporarily,
Step 2: Add a new unbound rule, now in that take a foreach loop of Products, add an advanced condition to check the Product's BrandID = BrandID in DataLabel, and execute Delete method of Product's SMO using the ProductID property. Screen Shot Below.

Step 3: Now Edit the Item Deleting rule of Brands and add this unbound rule before the delete item rule of Brands SMO.
Step 4: Refresh Both Lists

 

That's it, you should see the respective products getting deleted when you are deleting a brand.

 

Please try and let me know if it works.

 

Regards,
Vijay.


Reply