Flow designer - Set assignment group based on the field value contains sql or ora

ChallaS
Kilo Contributor

In a flow designer, For change task i need to set assignment group. I have written a script in flow designer for assignement group field. its not working

 

 

if a  source_mssql_db_oracle_schema contains sql   assugnment group should be AH_AHSAD_CHG_APP-DBA-SQL_L2

if a source_mssql_db_oracle_schema contains ora  assugnment group should be 

AH_AHSAD_CHG_APP-DBA-ORA_L2
 

 

/*
**Access Flow/Action data using the fd_data object. Script must return a value. 
**Order number is offset by +1 in Error Handling Section.
**Available options display upon pressing "." after fd_data
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/

var source = fd_data.trigger.current.variables.source_mssql_db_oracle_schema.toString()
var assign = "";
gs.log("sunil source" + source);
var r = source.indexOf("ora");
var s= source.indexOf("sql");
var assgnsql=gs.getProperty("AH_AHSAD_CHG_APP-DBA-SQL_L2");
var orc=gs.getProperty("AH_AHSAD_CHG_APP-DBA-ORA_L2");

//gs.log("sunil source"+ r);
if (s >-1) {
    gs.log("sunil sou s"+s);
     assign="assgnsql";
    }
    // Check if the field contains 'Oracle'
    if (r>-1) {
    gs.log("sunil sou r"+r);
        // Assign to the Oracle group
        assign="orc";
    }
    return assign;

 

 

ChallaS_0-1713272397024.png

 

 

3 REPLIES 3

Jon23
Mega Sage

Hi @ChallaS 

Do you get any value returned from your log statement?

Are your sys_property values sysIds of the assignment group?

 

Try getting the variables from Step1 (Get Catalog Variables) instead of the trigger record for line:

var source = fd_data.trigger.current.variables.source_mssql_db_oracle_schema.toString()

 

Hi @Jon23 

Thanks for the response

 

Logs are updating...  But the assignment groups are not coming to the tasks

 

Are your sys_property values sysIds of the assignment group?    yes

Hi

Just looking at your script again and the issue is you are setting the 'assign' variable with a string and not the variable.

Try changing:

assign="assgnsql" to assign=assgnsql;

assign="orc" to assign=orc;

if (s >-1) {
    gs.log("sunil sou s"+s);
     assign = assgnsql;
    }
    // Check if the field contains 'Oracle'
    if (r>-1) {
    gs.log("sunil sou r"+r);
        // Assign to the Oracle group
        assign = orc;
    }
    return assign;