Attribute Access Level control via Iron Python


This feature introduces a new property “Access” on attributes and defines the access level (how the attribute should be displayed in the configurator). This property can have one of three “states” listed below:

  • Read only – attribute is disabled but it is possible to set or change attribute value through Iron Python and regular rules. In other words, the attribute behaves just as if it was editable/in its default state, except that the end user can’t interact with the attribute on the UI.
  • Editable – attribute is enabled. This is default state of each attribute
  • Hidden – attribute is not displayed in the Configurator


This allows administrators to have attributes appear differently to various user types, or become read-only once the Quote reaches a certain status, or have a set of attributes that are read-only for certain user-types, etc.

Please note that the Hidden option in Iron Python is an extension and override of Attribute Visibility Restrictions that you can define in setup. Whatever you configure there will be reflected on the Hidden property of the attribute, with the ability to be overridden by an Iron Python script.


Example 1


This example demonstrates how an Iron Python script can be used to check whether the particular attribute(s) should be made read-only based on the user-type. The script triggers when the configurator is entered to configure the product “CallidusCloud e-car 2017”.

Script:

if User.UserType.Name == 'Customer':
 Product.Attr("Interior Color").Access = AttributeAccess.ReadOnly 
 Product.Attr("Exterior Color").Access = AttributeAccess.ReadOnly


This script checks if CPQ is being accessed by a user that belongs to the user type “Customer”. If this is true, attributes “Interior Color” and “Exterior Color” will be made read-only (See Figure 1).

Figure 1 - “Interior Color” and “Exterior Color” attributes are disabled for “Customer” user-type


However, if the user does not belong to the “Customer” user-type, then all the attributes are enabled (See Figure 2).

Figure 2 - All attributes are enabled. Script didn't get executed


Example 2


In this example the Iron Python script disables two attributes – “Interior Color” and “Exterior Color” only if the quote status is “Negotiation”. The script triggers when the configurator is used to configure the product “CallidusCloud e-car 2017”.

Script:

if Quote is not None:
 if Quote.OrderStatus.Name == "Negotiation":
    Product.Attr("Interior Color").Access = AttributeAccess.ReadOnly
    Product.Attr("Exterior Color").Access = AttributeAccess.ReadOnly


At first, quote-status is “Open” and all product attributes are enabled (See Figure 3).

Figure 3 - All attributes are enabled in “Open” quote status


However when the quote gets its status changed to “Negotiation”, two attributes get disabled (See Figure 4).

Figure 4 - Attributes are disabled when the quote is in status “Negotiation”


Example 3


This example demonstrates how administrators are able to update the attribute value even if the attribute is marked as read-only. The underlying Iron Python script of the “Update value” button is as follows:

Product.Attr("Interior Color").Access = AttributeAccess.ReadOnly
Product.Attr("Exterior Color").Access = AttributeAccess.ReadOnly
myAttribute = Product.Attr("Exterior Color")
myAttribute.SelectValue("gray")


Clicking the button updates the attribute-value through scripting even though the attribute is read-only (See Figure 5).

Figure 5 - Values get updated
You are here: CallidusCloud CPQ Online HelpAdmin Page HelpProduct AdministrationAttributesAttribute Access Level control via Iron Python