Business Rule to make the "supplier company" field empty on the basis of conditions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 12:51 AM
Hi Everyone,
Need to create a Business Rule to make the "supplier company" field empty upon the condition if "employee type" field changes and "supplier company" field is not changed in both UI and LDAP.
Thanks!
Chhavi Agnihotri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2025 12:57 AM
Before BR, update should be checked.
function executeRule(current, previous /*null when async*/) {
// Check if 'employee type' has changed
if (current.employee_type.changes()) {
// Check if 'supplier company' has NOT changed in UI
var supplierUnchangedInUI = !current.supplier_company.changes();
// Check if value has not changed from LDAP (i.e., previous value remains)
var supplierUnchangedFromLDAP = current.supplier_company == previous.supplier_company;
if (supplierUnchangedInUI && supplierUnchangedFromLDAP) {
current.supplier_company = ''; // Clear the field
}
}