Send WaitCall attrGet groups by persid
To discuss or ask questions about this article, select the discussion tab above.
Overview
This method gets a list of groups for specified user.
This action can be called in spell code in method send_wait (or send) using call_attr action.
Usage
<source lang="javascript"> void send_wait (int timeout, object top_object, "call_attr", "cnt", "get_groups_by_persid", contact_persid) </source>
- timeout - how long (in seconds) should the method wait for finishing the method (0 means infinite [no timeout] and is generally the value used)
- top_object - root object for the method (on which the method is called)
- contact_persid - persistent ID of an user for which you are looking for attached groups
Results
success or failure is tested with msg_error() (boolean function)
On success the resulted list is filled into a global array msg as follows:
- msg[0] - the number of assigned groups
- msg[1] - a list of group's UUIDs
On failure (don't forget to test failure in your code, your are in production with dummy users)
- msg[0] - failure reason
Examples
<source lang="javascript"> int i; send_wait(0, top_object(), "call_attr", "cnt", "get_groups_by_persid", "cnt:776B094702EABB4B87F04A139E72D44B"); for (i=0;i<msg_length();i++) { logf (SIGNIFICANT, "Msg index #%s: %s", i,msg[i]); } </source>
Comment
This code does not work since SD R12.5. See this post: http://www.servicedeskusers.com/forum/index.php?showtopic=6047