Account Reference

Hello All,

Is there a way to select the account reference dynamically based on the criteria?
image

For example, If I pass “Goods ODBC” as a parameter can snaplogic automatically select the specified account reference?

Hi skodali,

If you enable the equal toggle sign you can write JavaScript expressions. Please see screenshot bellow:


I believe in your case, you can specify pipeline parameter (ex. account_reference) in which you can pass the values (ex: “Goods ODBC”). The expression would be:
_account_reference == “Goods ODBC” ? “…shared/Goods ODBC” : “other account”.
If the expression evaluates true it will dynamically select the “…shared/Goods ODBC” account.

Please let me know if this helped you or if you need additional information.

Regards, Jovan.

Hello Jovan,

Thanks for the prompt response.
If I enabled the equal toggle sign I can only see the pipeline parameters and not the input schema from the mapper. Is there any way to get the Input Schema values into the Account Reference?

It works when I use the pipeline parameters for the condition like
_a == 1 ? “shared/INT”: “Other”
How can I write the condition in the account reference if I have more than One if condition?

if (_a == 1) {
return “shared/INT”;
} else if (_a == 2) {
return “shared/Goods”;
} else if (_a == 3)
return “shared/NAM”;
} return “OtherAcct”

Hi skodali,

In the account reference you can use pipeline parameters. Please check the link for more details.

To write multiple conditions you can use the ternary operator.
The expression which you have specified can be replaced with ternary operator as following:
_a ==1 ? “shared/INT” ?(_a ==2 ? “shared/Goods” ? (_a ==3 ? “shared/NAM” : “OtherAcct”): “OtherAcct”) : “OtherAcct”
Or additionally you can use the match control operator, with this operator you can get:
match _a {
1 => ‘shared/INT’,
2 => ‘shared/Goods’,
3 => ‘shared/NAM’,
_ => ‘OtherAcct’
}

Regards, Jovan.

1 Like

Thanks Jovan, this helps a lot.