How to remove a specific object from an array

Samuel Mueller
Samuel Mueller Overachievers
edited 09/11/23 in Add Ons and Integrations

Using Delete from Array utility - I don't know which number the object I want to remove is. How do I identify which object to remove and then remove that object?

Tags:

Best Answer

  • Diana Yeh
    Diana Yeh Employee
    Answer ✓

    Hi Samuel,

    I think you'll need to find the index of the object to remove. You might be able to do this with a child workflow that evaluates each array entry and stores values to keep track of runs and indices. Once you've found the index and are ready to use "Delete from Array", add a 1 to it since "Delete from Array" starts at index 1 instead of 0.

    We understand this process is currently complex, so we're looking at better ways to have users find their object indices moving forward.

    Hope this helps!

Answers

  • Diana Yeh
    Diana Yeh Employee
    Answer ✓

    Hi Samuel,

    I think you'll need to find the index of the object to remove. You might be able to do this with a child workflow that evaluates each array entry and stores values to keep track of runs and indices. Once you've found the index and are ready to use "Delete from Array", add a 1 to it since "Delete from Array" starts at index 1 instead of 0.

    We understand this process is currently complex, so we're looking at better ways to have users find their object indices moving forward.

    Hope this helps!

  • Samuel Mueller
    Samuel Mueller Overachievers

    Thank you, this is the solution I landed on, was curious if there was another (easier) way.