Get workgroups with starting name filter

Hi
I have created a form in which I want to display workgroups available in sailpoint. But need to filter the workgroups with name. The workgroups starting only with PIM should appear in the field dropdown. Is it possible to filter someting like this?
How can I do this?

Hi @pctripathi ,

I have not tested it. Please use below code and test it. I hope it works.

  try{

    QueryOptions qo = new QueryOptions();
    List listOfWGs = new ArrayList();


    qo.addFilter(Filter.eq("workgroup", Boolean.TRUE));

    Iterator entIter = context.search(Identity.class, qo);

    while(entIter.hasNext()){

      Identity wg = (Identity) entIter.next();

      if(wg.getName().startsWith("PIM"))
      {
        listOfWGs.add(wg.getName())
      }
    }
  return listOfWGs;
  }
  catch (Exception e) {
			System.err.println("Excpetion occured at: "+e);
		}

Please import necessary classes and interfaces.

You can actualy do that much simpler - here is the example

<Field columnSpan="1" displayName="Workgroup" filterString="workgroup == true &amp;&amp; name.startsWithIgnoreCase(&quot;PIM&quot;)" name="workgroup" type="Identity"/>
3 Likes

Thank you @kjakubiak :smile:

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.