CA Service Management

  • 1.  External Ticket Information x External Supplier

    Posted Mar 18, 2019 08:21 AM

    Hi guys,

     

    I would like that when an analyst selects a particular external supplier, it is mandatory to fill in the external ticket field information.

     

    We have several suppliers, but not all are required to fill this field. 

    How do I make it mandatory once I select a particular supplier?

    Any idea?

     

    Thanks.



  • 2.  Re: External Ticket Information x External Supplier

    Posted Mar 20, 2019 05:31 AM

    I believe you will need to make your business logic in a spel codeand trigger it on a post_validate.

    pseudo code below:

     

    POST_VALIDATE z_make_required() 10;

    cr::z_make_required(...) {

       string zmsg;
       if((z_supplier == "Y") && (is_null(my_required_field)||my_required_field =="")) {
          zmsg=format("This field is required!");
          set_error(1);
          set_return_data(zmsg);
          return;
       }
       return;
    };

    Hope this help.

    \J



  • 3.  Re: External Ticket Information x External Supplier
    Best Answer

    Posted Mar 27, 2019 02:26 PM

    Guys, to make a field required I've created this function below.

     

    function zMakeReqEST(value) {
    if (value == "400006" || value == "400001" || value == "400004" || value == "400011" || value == "400008") {
    // make required
    detailMakeReq("external_system_ticket", false);
    } else {
    detailMakeReq("external_system_ticket", true);
    }
    }

     

    On the field Supplier I put a new event, just like below:

     

    <PDM_MACRO name=dtlDropdown hdr="Fornecedor" attr="zfornecedores_id" evt="onchange='zMakeReqEST(this.value);'" factory="$args.FACTORY_&{attr}" lookup="no" make_required=no>

     

    This one works for me... I had the help of cdtj to make this work.

    Thanks my friend.