In a Record Producer, where is the coding for the submit button - I need to hide it for a specific response?

Tony98
Mega Expert

I need to hide the SUBMIT button when a Record Producer Variable field response is NO.

Where do i start hiding the button?

find_real_file.png

thanks

1 ACCEPTED SOLUTION

Michael Fry1
Kilo Patron

Not sure about hiding it, but in the script field on the record producer, you add something to block the submission if the variable is No. Something like:



if (producer.varable == 'No')


    current.setAbortAction(true);

View solution in original post

6 REPLIES 6

Michael Fry1
Kilo Patron

Not sure about hiding it, but in the script field on the record producer, you add something to block the submission if the variable is No. Something like:



if (producer.varable == 'No')


    current.setAbortAction(true);

I wasn't able to do what I wanted, but based on Michaels comment was able to go one step better . . .



When the user hits SUBMIT, a green message appears at the top sending them a message. It works great.


find_real_file.png



I went in the Record Producer and added a Catalog Client Script:


find_real_file.png



OnSubmit script:


find_real_file.png



=====================================================================================================================


function onSubmit() {


      if(g_form.getValue('u_category') == '34' && g_form.getValue('pb_and_hh_update') == 'No')


              {


              g_form.addInfoMessage('Please do a Pricebook update and update the handheld before submitting your ticket, if you have already done so change response to Yes to proceed with Retail Support ticket.');


              return false;


      }


      else


              return true;


}


====================================================================================================================


akshaykumar1
ServiceNow Employee
ServiceNow Employee

Hey Anthony,


You can hide the submit button with the help of an onChange Client Script on the field. Try running the below client script on the field.



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


    if (oldValue || newValue == 'No') {


              gel("submit_button").style.display = "none";


              return;


    }


}


In the Record Producer - a Catalog Client Script - I get:


Missing function declaration for onSubmit



find_real_file.png