CA Service Management

  • 1.  Reg. attribute update from spel method and htmpl form field behaviour

    Posted Oct 31, 2017 12:45 PM

    I have a POST_VALIDATE trigger on "cr" object and the spel method is written to assign a value to an attribute.
    However, the assigned value is not reflecting on saving of the ticket instead the value is reflecting on the refresh of the ticket page. is this behaviour is expected? how to make the assigned attribute value to reflect on the ticket page on saving?

     

    Thanks
    Venkat



  • 2.  Re: Reg. attribute update from spel method and htmpl form field behaviour

    Posted Oct 31, 2017 03:15 PM

    In more detail to the above requirement, how to make the web form field (ex. request ticket ) value to reflect on the web page on save and without refreshing the webpage when a attribute value is getting updating from spel method.



  • 3.  Re: Reg. attribute update from spel method and htmpl form field behaviour

    Posted Oct 31, 2017 07:35 PM

    Hi Codegeek,

     

    Are you able to share your code? Post validate should update the value during save and not require an additional refresh. 



  • 4.  Re: Reg. attribute update from spel method and htmpl form field behaviour

    Posted Nov 01, 2017 03:55 AM

    Below is the code.

    MODIFY chg POST_VALIDATE zUpdateChangetype_OnRiskChange() 660 FILTER(risk{});

     

    chg::zUpdateChangetype_OnRiskChange(...)
    {
         string isStandCat;
         int catLength;
         if (!is_null(category)) {
              catLength = strlen(category.sym);
              isStandCat = substr(category.sym,catLength-3,catLength);
              if (isStandCat == "STD"){
                   logf(SIGNIFICANT,"zUpdateChangetype_OnRiskChange:category %s and isStandCat %s",category.sym,isStandCat);
                   if (chgtype.sym == "Standard") {
                        if ( is_null(chgtype) || chgtype != 100)
                        send_wait(0,this,"call_attr","chgtype","set_val","100","SURE_SET");
                   }
                   
              }
              
              else {
                   
                   if (risk.sym == "Critical" && priority.sym == "1"){
                        if (is_null(chgtype) || chgtype != 300) {
                             send_wait(0,this,"call_attr","chgtype","set_val","300","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Critical" && priority.sym == "2"){
                        if (is_null(chgtype) || chgtype != 200){
                             send_wait(0,this,"call_attr","chgtype","set_val","200","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Critical" && priority.sym == "3") {
                        if (is_null(chgtype) || chgtype != 200) {
                             send_wait(0,this,"call_attr","chgtype","set_val","200","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Major" && priority.sym == "1") {
                        if (is_null(chgtype) || chgtype != 200) {
                             send_wait(0,this,"call_attr","chgtype","set_val","200","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Major" && priority.sym == "2") {
                        if (is_null(chgtype) || chgtype != 200) {
                             send_wait(0,this,"call_attr","chgtype","set_val","200","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Major" && priority.sym == "3") {
                        if (is_null(chgtype) || chgtype != 100) {
                             send_wait(0,this,"call_attr","chgtype","set_val","100","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Minor" && priority.sym == "1") {
                        if (is_null(chgtype) || chgtype != 200)  {
                             send_wait(0,this,"call_attr","chgtype","set_val","200","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Minor" && priority.sym == "2") {
                        if (is_null(chgtype) || chgtype != 100) {
                             send_wait(0,this,"call_attr","chgtype","set_val","100","SURE_SET");
                        }
                   }
                   else if (risk.sym == "Minor" && priority.sym == "3"){
                        if (is_null(chgtype) || chgtype != 100) {
                             send_wait(0,this,"call_attr","chgtype","set_val","100","SURE_SET");
                        }
                   }
              }
         }
    }


  • 5.  Re: Reg. attribute update from spel method and htmpl form field behaviour
    Best Answer

    Posted Nov 01, 2017 04:07 AM

    hi Venkat,

    seems you have messed with data types, as chgtype is integer, it should be set in this way:

    send_wait(0, this, "call_attr", "chgtype", "set_val", 100, "SURE_SET");

    also I suggest to compare ids not syms where it's possbile and clear enough, for priority you can use enum (where 5 is highest) attr:

    example:

    // else if (risk.sym == "Minor" && priority.sym == "1") {
    else if (risk.sym == "Minor" && priority.enum == 5) {

     

    last suggestion: as set_val is regular send_wait method, you can check it for errors after calling.

     

    Regadrs, cdtj



  • 6.  Re: Reg. attribute update from spel method and htmpl form field behaviour

    Posted Nov 01, 2017 08:53 AM

    Thanks cdtj !

    @CodeGeek - are you good to go on this one with the info provided by Timur?

    Let us know!

    Thanks,

    Jon



  • 7.  Re: Reg. attribute update from spel method and htmpl form field behaviour

    Broadcom Employee
    Posted Nov 02, 2017 03:41 PM

    Venkat, you can use preSaveTrigger2 js function for this purpose(if you love js lol). Take a look at

    PreSaveTrigger - Type and Rootcause 

    Thanks _Chi