Two list of accounts

Hello all,
I have two solutions has the same CompanyID

i want to do a job where is reference is always CompanyID + account id,

im having issue how to couple them

for example
company A
solution 1
has

Accounts: [ { “AccountTypeId”: , 5"AccountType": “Fiduciary Account”, “Currency”: “EUR”, “SafeGuard”: false }, { “AccountTypeId”: 5, “AccountType”: “Fiduciary Account”, “Currency”: “USD”, “SafeGuard”: false } ]

and
solution 2
Accounts: [ { “AccountTypeId”: , 10"AccountType": “settlement Account”, “Currency”: “EUR”, “SafeGuard”: false }, { “AccountTypeId”: 10, “AccountType”: “settlement Account”, “Currency”: “USD”, “SafeGuard”: false } ]

they only share the same company ID ,
i want to couple them first Fiduciary account with first Settlement account to do a job,

i was trying to Get all and go through them one by one but will not work if the bot break down in the middle!

any idea how to deal with this!
thanks in advance

Hi @Hazem_Saleh

Use queues and provide a reference for queue items as “company id_account id”

If you are only trying to attach few fights from those account then you would have use substring function to fetch required of that account and then concatenate with company id.

Hi
yes but if i do that will not couple them

if the company id =A1 and the account Fiduciary account 123 …A1123
and settlement is 456 then its A1456

my issue how to couple them !

i was try to get all queue item start with A1
which is works but have two issue

  1. if its break down in the middle ill not know which accounts are done
    2.which account has being picked up .

Hi

If you got the logic, and have issue when robot is breaking down. Would it be possible for you to save the couple somewhere when it has been couple? Then use a tryCatch in the for each (or what you are using), the it will continue if it breaks. In the catch you could log what it failed on.

If it breaks, now you have a list of what went well and can either filter it out or create an if in the loop to quickly skip the current couple.

Hope it makes sense and helps :slight_smile:

Hi @Hazem_Saleh

Use a two-phase queue-based approach to ensure reliable pairing and processing. First, extract and sort Fiduciary and Settlement accounts by CompanyID and Currency to maintain deterministic pairing. Create one pair per queue item and assign a unique reference using: CompanyID_FiduciaryAccount_SettlementAccount. Store full details in JSON.

The processing workflow simply retrieves queue items, executes logic per pair, and marks items as Successful or Business/ System Exception. Built-in retry logic and queue status ensure no duplication and safe restart if the bot stops mid-run. Logging and exception handling ensure traceability, making the design scalable and fault-tolerant.