Skip to main contentCarbon Design System

YNC interactions using scripting

YNC interactions using scripting

YNC or Yes, No, Cancel interactions can now be designed using automation scripts. You must do some preparatory work before writing the script. First, you should define a message that Supports the YNC interaction. This is similar to defining the warning message group and key. Make sure you have the message as informational (I) and support the Yes and No buttons.

The following use case launches a yes/no dialog when the priority is set to 1. It asks users if they want to set a default vendor. If the user selects “yes”, the script will set the default vendor A0001 and will mark the vendor field as required. If the user selects “no”, vendor is marked as not required.

The following script associates the var v with vendor and is added as an Attribute Launch point script with “action” event. “assetpr” has been defined in the “asset” group as an informational message with buttons Y and N enabled.

def yes():
global v,v_required
v = "A0001"
v_required = True
def no():
global v,v_required
v_required = False;