How to Hide the button Request from Catalog in Service portal based on checkbox selection?

Roshan Poduval3
Kilo Expert

I'm trying to hide the button "Request" with in the catalog item in Service Portal.

While I was able to hide Submit/ Order button, still unable to do the same for Request button.

All I'm trying to achieve, for example :

If checkbox - RAM - 32GB is selected, Hide Request button below.

Any help is deeply appreciated.


find_real_file.png

1 ACCEPTED SOLUTION

Roshan Poduval3
Kilo Expert

Thank you,

I was able to figure this out with using below UI script to the theme of the service portal within JS include, all I forgot to do is to set the UI type to All.

& call the function hideSubmitButton(); to client script.

//To hide submit button in catalog items.
function hideSubmitButton() {
$('button[name="submit"]').hide();
}

 

To show if unchecked the checkbox, then below code-

showSubmitButton(); // calling in client script directly

//To hide submit button in catalog items.
function showSubmitButton() {
$('button[name="submit"]').show();
}

 

Strange, but this works for me now great on both button types Submit & Request

View solution in original post

2 REPLIES 2

Megh
Tera Contributor

Solution 1: You can edit the Catalog item Widget to hide it based on the condition mentioned above.

I would say Since Catlog Item Widget is Common for displayng Catalog item in Service Portal. It will not be a good practice to do so. 

Solution 2: Do a OnSubmit Client Script, Erroring out the submission for the above condition. In that way even if that button is visible End User will not be able to submit the request.

 

Mark Helpful if it helps! 

Roshan Poduval3
Kilo Expert

Thank you,

I was able to figure this out with using below UI script to the theme of the service portal within JS include, all I forgot to do is to set the UI type to All.

& call the function hideSubmitButton(); to client script.

//To hide submit button in catalog items.
function hideSubmitButton() {
$('button[name="submit"]').hide();
}

 

To show if unchecked the checkbox, then below code-

showSubmitButton(); // calling in client script directly

//To hide submit button in catalog items.
function showSubmitButton() {
$('button[name="submit"]').show();
}

 

Strange, but this works for me now great on both button types Submit & Request