Forum Discussion

HeatherFortune's avatar
HeatherFortune
Qrew Member
24 hours ago

Assigning User to Group if Not in Group

Hello,

I would like to set up a pipeline to call API_GetUsersInGroup when a record is created and check to see if the user in a particular user field is in the group and if not, add them using API_AddUserToGroup.

I am struggling to find a way for it to see that the user is in the group and stop the pipeline if they are not. Instead, it always shows they are NOT in the group and tries to add them, erroring out when they are already in the group.

I'm fairly new to all of this, so apologies if it is a silly question - but how can I have it search through the results of API_GetUsersInGroup for my user and correctly identify if they are already in the group? 

I appreciate any assistance!

 

2 Replies

  • This is in essence my problem:

    Because it returns all of the users in the group, I need a way to iterate through the list of users and determine if my user is in the list. Because it is XML and not JSON, I don't have a built-in way to do that and I don't know how to do it. I've tried searching but coming up blank or with things not quite what I am looking for and without enough understanding to know how to make it work.

    I was originally trying to do this with roles and faced the same issues - if they were not in the group, it would work, but if they were in the group, it would fail because the previous condition didn't catch it. I've tried just looking for key words in the body of the response, which of course doesn't work. I've also tried an advanced filter and even some regex expressions, but I am truly just throwing things at the wall hoping something will work because this is ALL very new to me.

    So I can't even get to the part of evaluating, because I don't know how to make it loop through all of the users until it finds a match (or doesn't).

    (I tried to put on the "New User" and "Please Be Patient with Me" tags lol - I am not a developer but have become quite handy with Quickbase -- this just goes beyond what I've done and I'm not sure how to learn it -  I appreciate any guidance and assistance!)

     

  • What expression are you using to evaluate the group after the API call?

    When ever I have User fields in a Pipeline I have to evaluate them with a .TV.   and not .EX.