Documentation Index

Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt

Use this file to discover all available pages before exploring further.

Configure conditional field editability

Prev Next

Use conditional editability to dynamically control whether quote and agreement fields are editable, read-only, visible, or hidden.

Unlike static field restrictions, conditional restrictions respond to field values at runtime. When a user changes the value of a controlling field, a Groovy or IMC script evaluates the configured conditions and updates the state of other fields.

For example, when a user marks a line item as optional, you can make the Approval Needed field read-only.

The updated field state appears immediately, helping users enter the correct information before saving or submitting a quote or agreement.

You can apply conditional editability to fields at the header and line item levels in both quotes and agreements, including:

  • Line item tables

  • Quote and agreement negotiation overview pages

  • Line item details in the classic view

  • Line item details in the new UI

  • Line item detail drawers

Conditional editability helps you guide users toward valid data entry while they work and prevent input in attributes that are not applicable to the current business condition.

To configure conditional field editability, follow these steps:

  1. Complete prerequisites.

  2. Create a script.

  3. Upload the script.

  4. Connect the script to an attribute.

Prerequisites

Before configuring conditional editability:

  • Verify that you have the ADMIN PERMISSION. For details on assigning permissions, read Role management.

  • Identify the attribute that triggers the conditional behavior.

  • Identify the attributes whose states should change.

  • Define the business conditions for each possible state.

Create a script

Create a Groovy or IMC script that:

  • Reads the current value of the controlling attribute.

  • Evaluates the applicable business condition.

  • Sets the affected attributes to the required states.

  • Restores the attributes when the condition is reversed.

The script can control the following attribute states:

  • Read-only—The attribute and its current value remain visible, but users cannot modify the value.

  • Editable—Users can enter or change the value.

  • Hidden—The attribute does not appear in the UI.

  • Visible—The attribute appears in the UI and follows its configured editability state.

For details on scripts, read:

Example Groovy script

import com.imc.datamodel.BusinessDataAttribute
import com.imc.datamodel.BusinessObject
import com.imc.iss.groovy.salesitem.SalesItemNode
import com.imc.vocabulary.Schema
import com.imc.iss.groovy.salesitem.SalesItemNode
import com.imc.iss.groovy.salesitem.SalesItemsTree


final String EXT_SCHEMA = 'http://www.inmindcloud.com/application/application-schema-ext.owl#'
final String CUSTOM_SCHEMA = 'http://www.inmindcloud.com/application/custom-schema#'

def extAttribute = { String localName ->
  BusinessDataAttribute.create("${EXT_SCHEMA}${localName}")
}

def customAttribute = { String localName ->
  BusinessDataAttribute.create("${CUSTOM_SCHEMA}${localName}")
}

def hideAttributes = { BusinessObject salesItemBO, Collection attributes -> 
  groovyCtxUtil.setMetaAttribute(salesItemBO, Schema.hidden, attributes, true)
}

def unHideAttributes = { BusinessObject salesItemBO, Collection attributes -> 
  groovyCtxUtil.setMetaAttribute(salesItemBO, Schema.hidden, attributes, false)
}

def disableAttributes = { BusinessObject salesItemBO, Collection attributes -> 
  groovyCtxUtil.setMetaAttribute(salesItemBO, Schema.readOnly, attributes, true)
}

def enableAttributes = { BusinessObject salesItemBO, Collection attributes -> 
  groovyCtxUtil.setMetaAttribute(salesItemBO, Schema.readOnly, attributes, false)
}

Object optionalValue = currentSalesItemNode.getSalesItemDataAttributeValue(Schema.salesItemOptional.getUriAsString())
BusinessObject salesItemBO = BusinessObject.create(currentSalesItemNode.getSalesItemURI())
if(optionalValue != null && optionalValue) {
  hideAttributes(salesItemBO, [extAttribute('salesItemETOen')]);
  disableAttributes(salesItemBO, [customAttribute('requireApproval'), customAttribute('noteForApprover'), extAttribute('salesItemETOText2')]);
} else {
  unHideAttributes(salesItemBO, [extAttribute('salesItemETOen')]);
  enableAttributes(salesItemBO, [customAttribute('requireApproval'), customAttribute('noteForApprover'), extAttribute('salesItemETOText2')]);
}

Example IMCScript

var EXT_SCHEMA = "http://www.inmindcloud.com/application/application-schema-ext.owl#";

for(var salesItem:Quote().includesSalesItem_)
{
	salesItem.setDAHidden(EXT_SCHEMA + "salesItemETO", true);
	salesItem.setDAHidden("hasCurrency", true);
	salesItem.setDAHidden("salesItemAttribute1", true);

	salesItem.setDAReadOnly(EXT_SCHEMA + "salesItemCTO", true);
	salesItem.setDAReadOnly("hasUnitofMeasure", true);
	salesItem.setDAReadOnly(EXT_SCHEMA + "salesItemDescription", true);
	salesItem.setDAReadOnly("itemHeaderQuantity", true);

	for(var dynamicAttributeUri:salesItem.getDA())
	{
		salesItem.setDAReadOnly(dynamicAttributeUri.toString(), true);
	}

	if (salesItem.includesConfigItem.size() > 0)
	{
		for(var dynamicAttributeName:salesItem.getDAName())
		{
			salesItem.setDAHidden(dynamicAttributeName.toString(), true);
			salesItem.setDAReadOnly(dynamicAttributeName.toString(), true);
		}
	}
}

Quote().setDAReadOnly("objectName", true);
Quote().setDAReadOnly("containsOwner", true);
Quote().setDAReadOnly("salesDocumentDateOfExpiry", true);
Quote().setDAHidden(EXT_SCHEMA + "quoteExtra", true);

return Quote();

Upload the script

Upload the Groovy script

Create a Groovy script in Zilliant CPQ and upload your script file. For details about creating and configuring Groovy scripts, read Upload a Groovy script.

Upload the IMCScript

Create an IMCScript in Zilliant CPQ and upload your script file. For details about creating and configuring IMCScripts, read Manage scripts.

Connect the script to an attribute.

After creating the script, connect it to the attribute that should trigger the conditional behavior:

  1. From the application left navigation area, select Settings > Schema Extensibility.

  2. From the top navigation bar, select an object where your attribute exists.

  3. On the leftmost panel, locate your attribute and select it.

  4. On the rightmost panel, in the Groovy Script on Update field, select your script.

  5. Select Save.