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

deeps
Giga Contributor

Hi Raju ,


                          To Hide "Add to Cart " & "Order Now " Button using client script


Harish KM
Kilo Patron
Kilo Patron

This shud help


Remove OrderNow button


Regards
Harish

nayanawadhiya1
Kilo Sage

Hello Raju,




Use DOM Object Instead of JQuery -


document.getElementById('oi_order_now_button').hide();


I tried this but it doesn't work.. Please see the script I used now..



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();
      document.getElementById('oi_order_now_button').hide();
  }
}
}