Jquery if statement only works with one group

Sherazad Ahmed 411 Reputation points
2022-03-08T16:09:27.063+00:00

Hello,

I have the code below in one of the views on a SharePoint list. The if statement does not work below with the || clause. However, if I only have one group or the other in the if statement. For example if(!IsGroupMember(Admin_Group)) works or if(!IsGroupMember(Directors_Group)) works. However, I need to check both. Can someone tell me what's wrong with the if clause below?

$(document).ready(function() {

Admin_Group = "AP_Admin_Team";
Directors_Group = "Directors - Members";

if(!IsGroupMember(Admin_Group) || !IsGroupMember(Directors_Group))
{

    window.location.href = 'http://<site>/depts/AP/Lists/VendorSetupChangeForm/AllItems.aspx';    
}

});

thanks,

Developer technologies Small BASIC
{count} votes

4 answers

Sort by: Most helpful
  1. WhTurner 1,611 Reputation points
    2022-03-08T18:27:07.643+00:00

    In SmallBasic (the tag of these topics) you have to use OR :
    If x=7 OR x=9 Then

    1 person found this answer helpful.
    0 comments No comments

  2. WhTurner 1,611 Reputation points
    2022-03-09T10:03:57.537+00:00

    You are still using the wrong tag ("small-basic")

    The tag "small-basix" is for Technical questions about Microsoft Small Basic, the only text-based language and IDE built for students to learn to code

    Please look for a more fittimg tag as your question in not about Small Basic

    1 person found this answer helpful.
    0 comments No comments

  3. Sherazad Ahmed 411 Reputation points
    2022-03-08T18:54:08.657+00:00

    Hey sorry, this is query code.

    0 comments No comments

  4. Sherazad Ahmed 411 Reputation points
    2022-03-08T21:07:01.25+00:00

    Actually, found the issue. the if statement should be and not or:

    if(!IsGroupMember(Admin_Group) && !IsGroupMember(Directors_Group))

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.