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:
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.
Limitation
Conditional field editability is not supported for Groovy scripts of type “Organize Line Item Structure.”
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.iss.groovy.salesitem.SalesItemsTree
import com.imc.vocabulary.Schema
final String EXT_SCHEMA =
'http://www.inmindcloud.com/application/application-schema-ext.owl#'
final String CUSTOM_SCHEMA =
'http://www.inmindcloud.com/application/custom-schema#'
BusinessObject salesItemBO =
BusinessObject.create(currentSalesItemNode.getSalesItemURI())
Object optionalValue =
currentSalesItemNode.getSalesItemDataAttributeValue(
Schema.salesItemOptional.getUriAsString()
)
if (optionalValue != null && optionalValue) {
// Hide salesItemETOen
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.hidden,
BusinessDataAttribute.create(
EXT_SCHEMA + 'salesItemETOen'
),
true
)
// Make requireApproval read-only
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.readOnly,
BusinessDataAttribute.create(
CUSTOM_SCHEMA + 'requireApproval'
),
true
)
// Make noteForApprover read-only
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.readOnly,
BusinessDataAttribute.create(
CUSTOM_SCHEMA + 'noteForApprover'
),
true
)
// Make salesItemETOText2 read-only
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.readOnly,
BusinessDataAttribute.create(
EXT_SCHEMA + 'salesItemETOText2'
),
true
)
} else {
// Show salesItemETOen
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.hidden,
BusinessDataAttribute.create(
EXT_SCHEMA + 'salesItemETOen'
),
false
)
// Make requireApproval editable
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.readOnly,
BusinessDataAttribute.create(
CUSTOM_SCHEMA + 'requireApproval'
),
false
)
// Make noteForApprover editable
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.readOnly,
BusinessDataAttribute.create(
CUSTOM_SCHEMA + 'noteForApprover'
),
false
)
// Make salesItemETOText2 editable
groovyCtxUtil.setMetaAttribute(
salesItemBO,
Schema.readOnly,
BusinessDataAttribute.create(
EXT_SCHEMA + 'salesItemETOText2'
),
false
)
}
return salesItemsTreeExample IMCScript
var salesItemETOen =
"http://www.inmindcloud.com/application/application-schema-ext.owl#salesItemETOen";
var requireApproval =
"http://www.inmindcloud.com/application/custom-schema#requireApproval";
var noteForApprover =
"http://www.inmindcloud.com/application/custom-schema#noteForApprover";
var salesItemETOText2 =
"http://www.inmindcloud.com/application/application-schema-ext.owl#salesItemETOText2";
var optionalValue = SalesItem().salesItemOptional[0];
System.log(optionalValue, "INFO");
if (optionalValue != null && optionalValue) {
//Hide containsOwner
Quote().setDAReadOnly("containsOwner", true);
// Hide salesItemETOen
SalesItem().setDAHidden(
salesItemETOen,
true
);
// Make requireApproval read-only
SalesItem().setDAReadOnly(
requireApproval,
true
);
// Make noteForApprover read-only
SalesItem().setDAReadOnly(
noteForApprover,
true
);
// Make salesItemETOText2 read-only
SalesItem().setDAReadOnly(
salesItemETOText2,
true
);
System.push("Optional item - metadata set", "INFO");
}
else {
//Show containsOwner
Quote().setDAReadOnly("containsOwner", false);
// Show salesItemETOen
SalesItem().setDAHidden(
salesItemETOen,
false
);
// Make requireApproval editable
SalesItem().setDAReadOnly(
requireApproval,
false
);
// Make noteForApprover editable
SalesItem().setDAReadOnly(
noteForApprover,
false
);
// Make salesItemETOText2 editable
SalesItem().setDAReadOnly(
salesItemETOText2,
false
);
System.push("Non-optional item - metadata unset", "INFO");
}
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:
From the application left navigation area, select Settings > Schema Extensibility.
From the top navigation bar, select an object where your attribute exists.
On the leftmost panel, locate your attribute and select it.
On the rightmost panel, in the Groovy Script on Update field, select your script.
Select Save.