Difference between revisions of "Send WaitCall attrGet groups by persid"
Agegeleruvy (Talk | contribs) |
m (Reverted edits by Agegeleruvy (Talk); changed back to last version by NeronLeVelu) |
||
| Line 1: | Line 1: | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
__NOTOC__ | __NOTOC__ | ||
[[Category:Customizations]] | [[Category:Customizations]] | ||
| Line 20: | Line 12: | ||
== Usage == | == Usage == | ||
| − | + | <source lang="javascript"> | |
| − | void send_wait (int timeout, object top_object, | + | 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) | * timeout - how long (in seconds) should the method wait for finishing the method (0 means infinite [no timeout] and is generally the value used) | ||
| Line 39: | Line 31: | ||
== Examples == | == Examples == | ||
| − | + | <source lang="javascript"> | |
int i; | int i; | ||
| − | send_wait(0, top_object(), | + | send_wait(0, top_object(), "call_attr", "cnt", "get_groups_by_persid", "cnt:776B094702EABB4B87F04A139E72D44B"); |
if( msg_error()) { | if( msg_error()) { | ||
| − | logf (ERROR, | + | logf (ERROR, "failure in send_wait ..... .Reason: %s",msg[0]); |
} | } | ||
else{ | else{ | ||
| − | for (i=0;i | + | for (i=0;i<msg_length();i++) { |
| − | logf (SIGNIFICANT, | + | logf (SIGNIFICANT, "Msg index #%s: %s", i,msg[i]); |
}} | }} | ||
| − | + | </source> | |
== Comment == | == Comment == | ||
'''This code does not work since SD R12.5. See this post: http://www.servicedeskusers.com/forum/index.php?showtopic=6047''' | '''This code does not work since SD R12.5. See this post: http://www.servicedeskusers.com/forum/index.php?showtopic=6047''' | ||
Latest revision as of 05:22, 30 November 2010
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"); if( msg_error()) { logf (ERROR, "failure in send_wait ..... .Reason: %s",msg[0]); } else{ 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