CA Service Management

  • 1.  Different prefix for change orders

    Posted Oct 17, 2018 08:14 AM

    Hi everyone;

     

    I have "CH" prefix for all my change orders; defined in configuration. I also have a custom INT attribute - let's call it ztype -, which I set to 1,2 or 3 by creating a new Change Order - in the htmpl file.

     

    What I want to achieve is to set different prefixes for change orders with ztype 2 or 3.

     

    ztype = 1   -> CH

    ztype = 2   -> CR

    ztype = 3   -> CO

     

    I can set the value with spl codes via pre_validate or post_validate operators. But I also want to see the CR or CO before saving the change order. I want to modify the "$args.chg_ref_num" value.

     

    Is that possible?

     

    BR

    Utku



  • 2.  Re: Different prefix for change orders

    Posted Oct 17, 2018 08:22 AM

    Hi,

     

    So the prefix isn’t set until ztype is selected? Does the user select this field or does it happen in the background? If the user is selecting it you’ll need to manipulate the dom, otherwise a pre_validate trigger will work.



  • 3.  Re: Different prefix for change orders

    Posted Oct 17, 2018 10:04 AM

    Hi gbruneau;

     

    Actually I set the ztype value on popup URL like "PRESET=ztype:2"

    user doesn't select anything

    up to this value I show / hide some fields on detail_chg.htmpl

     

    But as you know, change number is visible even we don't save. So I want to modify it if it's possible.

     

    BR

    Utku



  • 4.  Re: Different prefix for change orders
    Best Answer

    Posted Oct 17, 2018 03:48 PM

    Not sure how well this will work, but try it out. Put this next to the PDM_SET macro.

     

    You can change the "CHG" test to your desired prefix, it will only be displayed on the initial change order form.

    //Change Order not yet initially saved
    if(argID == 0 && document.getElementsByTagName('h2')[0].innerText.indexOf("Create New Change Order") == 0){
      document.getElementsByTagName('h2')[0].innerText = 'Create New Change Order CHG' + argChgRefNum;
    }


  • 5.  Re: Different prefix for change orders

    Posted Oct 18, 2018 08:38 AM

    Dear gbruneau;

     

    Thank you for your advice. Referring your code; I tried the replacement below and it worked for me. 

    Of course; I also have a pre_validate operation for setting the chg_ref_num by saving the record.

     

    if(argID == 0 && argzType== 1)
    {
    document.getElementsByTagName('h2')[0].innerText = 'Create Request ' + argChgRefNum.replace('CH','ER');
    }



  • 6.  Re: Different prefix for change orders

    Posted Oct 18, 2018 09:57 AM

    You're welcome! Glad that worked out.