How to Hide, Disable or Make Required Fields/Buttons

Since the Cuba Libre version, you can:

  • Manage visibility and editability of quote/contract/agreement header fields.
  • Hide the Submit and Save buttons.

Fields

To modify the visibility or editability of header fields, use the qp.clearRenderInfo("fieldname") or qp.setRenderInfo("fieldname","key","value") methods.

Header Logic Snippet
def qp = quoteProcessor
if (qp.isPrePhase()){
 qp.setRenderInfo("userGroupEdit","hide",true)
 }

The qp.setRenderInfo method has three arguments:

  • Field name – All quote/contract/agreement fields shown in the header input portlet are currently supported. The field names correspond to the names in the JSON data structure.
  • Key –  Header fields support these three keys: hiderequireddisabled
  • Value – Value attribute of the boolean type


Running the code above generates a JSON sub-structure on the quote header looking like this:

"renderInfo" : {
	 "userGroupEdit" : {
	 "hide" : true
	 }
 },

The UI can now evaluate the instructions as it sees fit, i.e. the field names as well as the available key value pairs are not restricted/enforced by the backend.

Buttons

You can hide a button using the qp.setRenderInfo("buttonname","key","value") method.

  • Button name – Only the following buttons are supported: saveButtonsubmitButtondeleteButton, duplicateButtonemailCalculableButton, importExportButtoncreationWorkflowSubmitAndNext and creationWorkflowBack.
  • Key –  Only one key is supported: hide
  • Value – Value attribute of the boolean type
Header Logic Snippet
def qp = quoteProcessor
if (qp.isPrePhase()){
 qp.setRenderInfo("submitButton","hide",true)
 }