CA Service Management

Expand all | Collapse all

group_leader in spell scripts

Jump to Best Answer
  • 1.  group_leader in spell scripts

    Posted 10-28-2015 05:26 AM

    Hello,

    can anyone explain what is purpose of group_leader in spel. For example now i am working with the following method:

     

       new_attached_event ( object | nil group_leader,

         string attach_to_id,

         string event_symbol,

         duration | nil overide_duration,

         date | nil overide_starttime,

         string | nil group_name,

         int,

         int,

         string timezone);

     

    as first parameter there is possibility to proved group_leader object or NULL if i provide null method works just fine

     

    without group leader:

    duration timeout;
     timeout = 100;
     send_wait(0, top_object(), "call_attr", "evt", "new_attached_event", NULL, "chg:400896","1hr chg unassigned", timeout ,now(), "SLA",0,1,"UTC");  
     if (msg_error()) {  
     printf("Error %s",msg[0]);  
     } 
    

    But if i provide group leader it fails without any error

    with group leader

    duration timeout;
     timeout = 100;
     object group_leader;
      send_wait(0, top_object(), "get_co_group");
        if (msg_error()) { 
            printf("Error'%s'", msg[0]);
            return;
        }
     else{
        group_leader = msg[0];
    
     send_wait(0, top_object(), "call_attr", "evt", "new_attached_event", group_leader, "chg:400896","1hr chg unassigned", timeout ,now(), "SLA",0,1,"UTC");  
     if (msg_error()) {  
     printf("Error %s",msg[0]);  
     }  
     }
    

     

    So the first question is what is purpose of the group_leader and why method fails if i provide group_leader.



  • 2.  Re: group_leader in spell scripts

    Posted 10-28-2015 05:54 AM

    hi,

    when you execute macro from Attached event, there object called group_leader already exists (you'll get error of definition duplicate if try to define new object called group_leader), so what will happen if you pass it to this method?

    Maybe it used to attach new event within current "session"?

    Mainly about group leader, in my view it's kind of Session or Envelope which is needed to assure system, that linked with it object is locked and being used.



  • 3.  Re: group_leader in spell scripts
    Best Answer

    Posted 10-28-2015 05:55 AM

    Hope this helps

     

     

    Instead of a more common read/write lock approach, the BOP environment utilizes a check-in / check-out

     

    metaphor with notification of changes as it’s way of handling revisions and update conflict. The user requests a

     

    special object from the TOP object named the Group Leader. When the user wants to modify the attributes of a

     

    dob, he sends a ‘checkout’ message to the group leader. If the group leader can check out the object he does

     

    so and tells the user that the checkout succeeded. If some other group leader has the object checked out the

     

    checkout fails and the user is notified of this. Once the object is checked out, the user can make changes. The

     

    user can checkout additional objects on the group leader. When the user has completed his changes, he

     

    checks in the group leader which commits all of the changes. Any other consumers of the Bop(s) which are

     

    changed can register for changes in the attributes of the Bop. They would be notified of the change in attribute

     

    value after the checkinn is complete.

     



  • 4.  Re: group_leader in spell scripts

    Posted 10-28-2015 06:16 AM

    Thank You, Marc, this helps a lot. This means that i can pass object_leader to method to do the checkout. This allows to use this method multiple time to attach number of events and then to checkin all of them at the same time.

     

    duration timeout;
    timeout = 100;
    object group_leader;
      send_wait(0, top_object(), "get_co_group");
        if (msg_error()) {
            printf("Error'%s'", msg[0]);
            return;
        }
    else{
        group_leader = msg[0];
    
    send_wait(0, top_object(), "call_attr", "evt", "new_attached_event", group_leader, "chg:400896","1hr chg unassigned", timeout ,now(), "SLA",0,1,"UTC"); 
    if (msg_error()) { 
    printf("Error %s",msg[0]); 
    } 
    }
    send_wait(0, group_leader, "checkin");
        if (msg_error()) {
            printf("Error'%s'", msg[0]);
        }
    


  • 5.  Re: group_leader in spell scripts

    Posted 10-28-2015 06:19 AM

    TMACUL, you should update your Where can I find Spel functions documentation? document with this information. Ofcourse if Marc will agree on that. Thank You Mark once again.



  • 6.  Re: group_leader in spell scripts

    Posted 11-23-2015 09:03 AM

    today extended group_leader knowledge was useful for me

    here is an example how to perform status change activity with issue update within single session:

    send_wait(0, top_object(), "call_attr", "iss", "dob_by_persid", 0, "iss:123456");
    issobj = msg[0];
    send_wait(0, top_object(), "get_co_group");
    gl = msg[0];
    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
    who = msg[0];
    send_wait(0, issobj, "change_status", gl, // group_leader
      who,                                    // analyst
      description,                            // description
      "ASGN",                                 // new status code
      NULL);                                  // unknown
    send_wait(0, issobj, "call_attr", "summary", "set_val", "hello"); // setting new summary here
    send_wait(0, issobj, "call_attr", "description", "set_val", "world"); // setting new description here
    send_wait(0, gl, "checkin");
    if (msg_error()) {
      send_wait(0, gl, "uncheck");
    }
    

    note: attrs defenition and debuging were omitted;

    note2: i didnt call checout because it's a part of "change_status" method, if I found it correct;



  • 7.  Re: group_leader in spell scripts

    Posted 01-11-2016 04:47 AM

    Haven't seen defenition of this method, so I want to share it with community.

    object group_leader;
    send_wait(0, this, "get_gl");
    group_leader = msg[0];
    

    Result will be group_leader of current object.

     

    Regards,

    cdtj



  • 8.  Re: group_leader in spell scripts

    Posted 01-11-2016 05:58 AM

    Nice, this should allow us to do everything in one transaction.