Hi All,
There was a requirement, we need to add/remove the members from the workgroup based on their job titles. I have worked on it. here, the sample.
Good one !
few pointers , think how this can be scaled if you have to assign different group based on different titles , what about if tomorrow you need to assign based on department .
To make this work in large environments without OutOfMemory issues it is better to do a context.search on IDs. This will provide an iterator of Strings instead of an iterator of Identity-objects which can be huge.
An example:
Iterator iterator = context.search(Identity.class, addQo, "id");
while (iterator != null && iterator.hasNext()) {
Identity id = context.getObjectById(Identity.class, iterator.next()[0]);
Add the end of the loop you can decache the identity to free memory again
context.decache(id);
}
Can you also mention this task will only work for searchable attributes (you cannot Filter on non-searchable attributes).
Hi @Vb_Bellamkonda thanks a lot for sharing this, and a good one as well!
I have a side note here, away from the show and tell, what was the need exactly because in general, you can achieve this requirement without doing any custom objects or any other challenges like (large scale Org Chart, Memory leakage, etc…) you can use the LoopBack Connector or Attribute Listener Rule, so just wanted to know the reason behind using this approach .
Once again, thank you so much for sharing this way/method as well
Hi @MuhammadMustafa,
Actually, They have an executive workgroup, which is having some set of capabilities to perform the actions. Here, the ask is we need to provide the capabilities based on job titles. They have some set of job titles, if user have any of the job title they should get all the capabilities. And, if the user no longer had particular job title we need to remove the set of capabilities. The process should be automated like scheduled task.
Hi @vishal_kejriwal1 , thanks for the pointers.
Here, we have the requirement for single work group with multiple job titles. Let me try for multiple workgroups with multiple job titles.