How to delete an list item that is specified via REST API?

We are trying to figure out how to delete a item in a list that is specified via the REST API.

 

I have figured out how to create a control module that selects items in a list via a line item formula, create a Delete action that uses this control module, then invoke the Delete action from a REST client. (Each line item is uniquely identified by name.)

 

The problem is that we want our REST client to be able to specify the item(s) to delete. We do not want to have to manually modify the formula in the control module in the Anaplan UI every time that we want to modify our selections.

 

The closest that I have gotten to a solution is to export the control module line item in the module in blueprint mode to a file on my laptop, modify the formula in the file, then upload and import the modified file in blueprint mode. This creates an Action that our REST client could perhaps invoke, but the import does not change the line item formula.

 

Does anyone have any ideas that could help?

Best Answer

  • Hello,

     

    A process like the following may work:

     

    1.  Load a flat list of items you want to delete to a separate list named "Deletes"

    2.  Create a module based on the list that you want to delete from.  Add a single boolean line item that tests true if the item (from the list you want to delete from) is in the "Deletes" list.  

    3.  Call a Delete by Selection Action that uses the boolean in step 2... this will delete the target items.

    4.  Clear the contents of the "Deletes" list (or, get fancy and load a date/time stamp value to the "Deletes" list that is ignored in future runs)

     

    Cheers!

     

    Paul

     

Answers

  • Thank you for your response, PaulRitner. I am sorry for taking this long to acknowledge it.

     

    After posting my request, I figured out on my own that this approach would work. I was relieved that your answer corroborated what I tried.

    In the end, I altered my solution to use placeholder items that are inserted in the target list instead of creating a separate list. Each placeholder item name started with "d" followed by the index of the item to delete. This required two line items, one to delete the target items and another to delete the placeholders.