CA Service Management

 View Only
  • 1.  SPL for writing custom attribute value

    Posted May 15, 2018 06:43 PM

    We have been given a task to set a custom Boolean attribute called "zunauth" in the chg table on save if another custom chg attribute called "zapprover" IS NULL, the actual_start_date < schedule_start_date, or the actual_end_date > schedule_end_date.

     

    I'm not accomplished in writing SPL code and was wondering if someone has done something similar or can make a recommendation on how to implement this functionality.  I didn't see anything comparable looking in $NX_ROOT\samples or in existing Action macros.  The SPL wiki documentation that exists is great but there are a lot of gaps in the methods and in practical examples.

     

     

    Derek~



  • 2.  Re: SPL for writing custom attribute value
    Best Answer

    Posted May 15, 2018 10:03 PM

    Here's an example.  I'm not 100% sure the trigger will work but give it a try.

     

    Trigger (example name, zCHG.mod)

    MODIFY chg POST_VALIDATE z_set_zunauth() 10050 FILTER(zapprover == NULL || actual_start_date < schedule_start_date || actual_start_date < schedule_start_date) && EVENT("UPDATE"));

     

    chg::z_set_zunauth(...) {
      string method;
      uuid who;
     
      method ="chg::z_set_zunauth";
      logf(MILESTONE, "%s started", method);
     
      send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
      if (msg_error()) {   
        logf(ERROR, "%s - %s", ref_num, msg[0]);
         return;
      }
      who=msg[0]; 
     
      send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, persistent_id, 0, "zunauth", 1); 
      if (msg_error()) {   
        logf(ERROR, "%s - %s", ref_num, msg[0]);
      }
      else{
        logf(MILESTONE, "Successfully updated zunauth attribute on %s", persistent_id);
      }
     
      logf(MILESTONE, "%s ended", method);
    }


  • 3.  Re: SPL for writing custom attribute value

    Broadcom Employee
    Posted May 16, 2018 11:34 AM

    Thanks once again Grant for sharing your expertise with the community!