CA Service Management

  • 1.  onSubmit event in Service Calalog

    Posted Aug 09, 2018 09:09 AM

    Hi,

    I simply want to run a validation when you click the submit button on a service request. Can anyone provide me the correct syntax. I would be happy with a running example that opens a messagebox when you click the submit button.

     

    Thanks and best regards,

    Markus



  • 2.  Re: onSubmit event in Service Calalog
    Best Answer

    Broadcom Employee
    Posted Aug 09, 2018 09:52 AM

    Good Afternoon Markus.

    As a starting point for you to further exploit on this, please check the below information which gives you a start in 'scripting' SC-form(s).
    https://docops.ca.com/ca-service-management/14-1/en/using/service-catalog-management/manage-forms/perform-automated-tasks-in-form-fields/use-javascript-functions-in-fields

    Typically, you specify a custom JavaScript function in one of the following:
    -The onSubmit or onLoad attribute of the form attributes
    -The onChange or onValidate attributes of applicable fields

    E.G. To stop unsaved table rows from submitting the request.
    onSubmit script:
    submit : function() {
    if(ca_fdGetSavedNonEmptyTableRowCount(ca_fd.formId, 'tblRecursos2') < 1){ alert('Table must have at least 1 entry');
    return false;
    }
    else
    return true;
    }

    Or

    In OnSubmit attribute of a form, you can put any js function there.
    It will invoke it at the submit point.
    If that function returns true, the request will be submitted.
    If it returns false, it will not be submitted.

    Or

    alertSelect:function(){
    alert('alertSelect() invoked');
    var selected = ca_fdGetSelectedOptionValues(ca_fd.formId,'users2');
    if (selected =='spadmin'){
    alert('Selected value match: '+selected);
    }
    else {
    alert('Selected value mismatch: '+selected);
    }
    }

    Thanks and kind regards, Louis van Amelsfort.



  • 3.  Re: onSubmit event in Service Calalog

    Posted Aug 10, 2018 06:04 AM
      |   view attached

    Hi Louis,

     

    Thanks for this, you helped me back on the track again!

     

    Cheers,

    Markus