Need to dynamically hide Order Now button in Service Catalog?

Raju Singh1
Tera Expert

I need to dynamically hide Order Now button in Service Catalog?

My script checks for the status of a field in the related table and if it finds the matching status, it should hide the Order Now button. Please help me to achieve this.

Here is my script along with the screen shot but it doesn't work.

Catalog Client Script Onchange

function onChange(control, oldValue, newValue, isLoading) {

var caller = g_form.getReference('nh_new_user', doAlert);

function doAlert(caller) {

  g_form.setValue('profile',caller.u_equipment_profile);
  if(caller.u_state == "Processing")
    {alert("Manager Checklist for this User has already been Submitted");
    $('order_now').hide();
  }
}
}

This doesn't work, I can hide it by directly going to the catalog item and check no order to true but that hides it permanently.. where as I want to dynamically hide it.

Please help

Regards,

Raju Singh

16 REPLIES 16

I dont get any value for this field.. alert(caller.u_state);


Write Callback Function outside the OnChange Function.


I m not sure how to do that Nayan,, could you help me here please..


function onChange(control, oldValue, newValue, isLoading) {


var caller = g_form.getReference('nh_new_user', doAlert);


}


function doAlert(caller) {


  g_form.setValue('profile',caller.u_equipment_profile);


alert(caller.u_state);
  if(caller.u_state == "Processing")
    {alert("Manager Checklist for this User has already been Submitted");
    $('order_now').hide();
  }
}


No. luck Nayan.. its still the same