CRM Desktop - How to Dynamically Add / Remove Mandatory Rule on a Field ? (Doc ID 2048424.1)

Last updated on AUGUST 26, 2015

Applies to:

Siebel CRM Desktop - Version 8.1.1.14 [IP2014] and later
Information in this document applies to any platform.

Goal

How to dynamically disable add or remove a mandatory rule on a field based on the value of an other field?

Example :

Field named [Sales Stages] and a Field named [Bid Governance].

Rules are :

  - If [Sales Stages] == "Prospect" || [Sales Stages] == "Capture" then
  I add the mandatory rule on the field [Bid Governance]

  - When the value of [Sales Stages] is changed I call my "If condition" to enable or disable the mandatory rule on the field [Bid Governance]

Added the following instructions in the file forms.js in order to do how can users disable the mandatory rule?

// OPPORTUNITY FORM SCRIPTS //

// BEGIN

if( ctx.form.item.snapshot["Sales Stage"] == "Prospect" || ctx.form.item.snapshot["Sales Stage"] == "Capture" ) {
ctx.validator.add_custom(sb_helpers.validate_field_for_empty_trim("Bid Governance", ctx, "bid_governance", true), ["bid_governance"], "msg_bid_governance_validation");
}

function big_govervance_mandatory()
{
if( ctx.form.item.snapshot["Sales Stage"] == "Prospect" || ctx.form.item.snapshot["Sales Stage"] == "Capture" ) {
ctx.validator.add_custom(sb_helpers.validate_field_for_empty_trim("Bid Governance", ctx, "bid_governance", true), ["bid_governance"], "msg_bid_governance_validation");
} else {
// Disable the mandatory rule
}
}

ctx.events.connect(ctx.form["sales_stage"],"changed",big_govervance_mandatory);

// END

 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms