Technical Blog Post
Make Attribute as Required in Service Offerings
Make an offering field mandatory depending on the value in some other field.
Lets take two attributes ALNVALUE1 and ALNVALUE2 used in an offering
ALNVALUE1 has an ALN Domain (LOOKUP) associated with it. The domain LOOKUP has values ‘Yes’ and ‘No’
ALNVALUE2 should be mandatory when ALNVALUE1 is set to 'Yes'. If ALNVALUE1 is set to 'No' then field ALNVALUE2 should not be mandatory.
Associate a validation script to the offering attribute.
In 'System Configuration -> Platform Configuration-> Automation Scripts', click on action Create -> Script from ‘More Actions’.
The script is created with the following details:
- Script: MAKEFIELDREQUIRED
- Description: Make a field Required
- Log Level: ERROR
- Active: Selected
- Script Language: jython
- Source Code:
from psdi.mbo import MboConstants
from psdi.util import MXApplicationException
from psdi.mbo import MboConstants;
from psdi.mbo import Mbo;
from java.lang import String;
if (val1 == 'Yes') :
rc = 1
The automation script is created as shown below:
As you can see from the above screen shot the validation script is attached to INPUT1 and the attribute INPUT2 becomes mandatory when the attribute value of INPUT1 is set to 'Yes'.