Best answer

How to remove tags in NationBuilder using loop

  • 21 March 2022
  • 4 replies
  • 62 views

HI,

 

I am using the NationBuilder “Update a Person” action and it will not remove tags. It will add tags but will not remove them from NationBuilder. (Don’t ask me why)

I have found another action that is to “Delete a Single Tag” from a NationBuilder person.

 

I can compare data in/data out on the “Update a Person” action to see if the tags match (hopefully, might get caught out by order but … later)

So, is there any way, with a zap, to cycle through those 2 lists of tags to determine what tags are missing from the input list that are on the NB output list. Those tags are the ones I would then need to (one by one) delete.

So I need 2 things:

  1. A list comparison to find the missing tags and
  2. An iterator to perform a delete tag task on each missing tag

Okay - so now I try with Zapier Looping…

Read the list of tags from NB (returned from update), loop through each tag, if not in the list of tags from Amalfi then delete the tag from NB… should be simple.

The loop (line item or text? - both seem the same) appears to extract the items but when run in the real world Zapier seems to reset the loop at every iteration and randomly chooses an item.

Why does the zap run for every loop - rather than loop within a zap run - I am fine with the task count reflecting the looping but the logs are very hard to decipher given my loop has 2 steps:

  1. Filter - only proceed if the tag is not in the list
  2. Remove the tag

Has anyone successfully done anything like this?

 

icon

Best answer by andrew.waites 22 March 2022, 02:56

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +14

Hi @andrew.waites 

Good questions.

 

You’ll likely need to use a custom Code step to do the comparison between the 2 lists of Tags: https://zapier.com/apps/code/help

 

Once you’re able to isolate the Tags to add/remove/keep, then you can use Looping.

Thanks Troy.

 

I have managed to get a dumber version going (loop on all and discard if on list type of thing) but yes it would be more efficient to reduce the loop to just the differences so I will have a look at the JS option. Wish my JS skills were up to par - old dog, new tricks.

 

tx

I ended up using the Python code (more familiar with that) as shown below in case it is useful…

 

Userlevel 7
Badge +11

That’s great news, @andrew.waites! Thanks for sharing your solution here, so glad you were able to get this working! :tada: