Clarity Service Management

Expand all | Collapse all

How to Copy Contents of Parent CO to Children?

  • 1.  How to Copy Contents of Parent CO to Children?

    Posted 06-10-2015 09:34 AM

    We have a requirement wherein whenever the Summary / Description / Status / Schedule Start Date of a Parent CO is updated the child CO's should get updated with exactly the same info.

     

    I was going through the Options Manager and came across option leave_children_open / force_rootcause and I believe this needs to be developed on similar lines. I believe this is done through spel. However, am unsure if that is the case or the right path.

     

    Moreover, I have question -

     

    1. How do I link a parent / Child in the code?

    2. how do I ensure that dynamically the fields get updated on Child tickets / CO based on the update on parent?

     

    Any help is much appreciated!



  • 2.  Re: How to Copy Contents of Parent CO to Children?

    Posted 06-10-2015 10:27 AM

    Hi, it should be something like this

     

     

    OBJECT chg {
    TRIGGERS {
      POST_VALIDATE zpropogate() 3001 FILTER ( (summary{} || description{} || status{}) );
    };
    };
    

     

    chg::zpropogate(...)
    { 
    
     string wc;
     object c_dob, c_list, group_leader, attached_events_table_record;
     int c_count, i;
     uuid login_userid;
     
     wc = format("parent = %d", id);
     send_wait(0, top_object(), "call_attr", "chg", "current_user_id");
     login_userid = msg[0];
     send_wait(0, top_object(), "call_attr", "chg", "sync_fetch", "MLIST_STATIC", wc, -1,0);
     c_count = msg[1];
     c_list = msg[0];
     if (c_count > 0) {
      for(i=0;i< c_count;i++) {
       send_wait(0, c_list, "dob_by_index", "DEFAULT", i, i);
       c_dob = msg[0];
    
     send_wait(0, c_dob, "call_attr", "description", "set_val", description, "SURE_SET");
     if ( msg_error() ) {
      logf(ERROR, "Propogating: %s, ticket %s", msg[0], c_dob.chg_ref_num);
     } 
     }
     }
    

     

     

    Of course you need to tune it to your requirements, but it is just to give you an idea



  • 3.  Re: How to Copy Contents of Parent CO to Children?

    Posted 06-12-2015 02:36 AM

    Yes I totally agree with you. What I suggest to do is to show parent order description and other fields as additional read only fields if parent is present.

    <PDM_IF '$args.parent' != ''>
    <PDM_MACRO name=dtlTextbox hdr="Parent Description" attr=parent.description colspan=4 keeplinks=yes rows=4 size=120 spellchk=yes>
    <PDM_MACRO name=dtlStartRow>
    </PDM_IF>
    

    If you still want to stick to old scenario I would suggest to show parent description and other needed fields instead of change orders fields

    <PDM_IF '$args.parent' != ''>
    <PDM_MACRO name=dtlTextbox hdr="Parent Description" attr=parent.description colspan=4 keeplinks=yes rows=4 size=120 spellchk=yes>
    <PDM_MACRO name=dtlStartRow>
    </PDM_ELSE>
    <PDM_MACRO name=dtlTextbox hdr="Order Description" attr=description colspan=4 keeplinks=yes rows=4 size=120 spellchk=yes>
    <PDM_MACRO name=dtlStartRow>
    </PDM_IF>
    


  • 4.  Re: How to Copy Contents of Parent CO to Children?

    Posted 06-11-2015 05:25 PM

    I am having difficulty imagining the business case where you would want the child Change Orders to have exactly the same Summary and Description as the parent. Isn't each child Change Order to modify something different and the parent is the overarching ticket used to group the children?