Set assignment group for change task based on the variable field filled... Change Record producer

sunil kumar11
Tera Expert

 

How do we write a script in assignment rule. If a variable field "source_mssql_db_oracle_schema" contains SQL it should assign to AH_AHSAD_CHG_APP-DBA-SQL_L2 this group and if Oracle contains it should assign to AH_AHSAD_CHG_APP-DBA-ORA_L2 this group
 
Please correct me to achieve this requirement

 

(function() {
    // Check if the field contains 'SQL'
    if (current.source_mssql_db_oracle_schema.indexOf('SQL') !== -1) {
        // Assign to the SQL group
        current.assignment_group.setDisplayValue('AH_AHSAD_CHG_APP-DBA-SQL_L2');
    }
    // Check if the field contains 'Oracle'
    else if (current.source_mssql_db_oracle_schema.indexOf('Oracle') !== -1) {
        // Assign to the Oracle group
        current.assignment_group.setDisplayValue('AH_AHSAD_CHG_APP-DBA-ORA_L2');
    }
})();

 

 

 

 

@shyamkumar VK

 

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@sunil kumar11 

 

Please try the following

(function() {
    // Check if the field contains 'SQL'
    if (current.variables.source_mssql_db_oracle_schema.indexOf('SQL') != -1) {
        // Assign to the SQL group
        current.assignment_group.setDisplayValue('AH_AHSAD_CHG_APP-DBA-SQL_L2');
    }
    // Check if the field contains 'Oracle'
    else if (current.variables.source_mssql_db_oracle_schema.indexOf('Oracle') != -1) {
        // Assign to the Oracle group
        current.assignment_group.setDisplayValue('AH_AHSAD_CHG_APP-DBA-ORA_L2');
    }
})();

Hope this helps.