Using / Calling a function to create a global variable to collect a list of records
I have a registration application where I collect Account registrations and each registration has a reseller. So there are many accounts per reseller.
I am building another application where when I select a Reseller from a multi-select lookup, I want it to automatically select all accounts in another multi-select lookup associated with it.
I created a function in the first application
- string sample.getAccounts(string getaccounts)
- {
- if (count(Add_Registration[Reseller == input.getaccounts]) > 0)
- {
- col = Add_Registration [Reseller == input.getaccounts];
- return col.Account_Name;
- }
- else
- {
- return "";
- }
- }
This is supposed to create a global variable called getAccounts that will collect all records that show an account tied to the reseller key
In my other application i wrote a script on the "on user input" of the reseller multiselect field (or the key)
Accounts:ui.select(registration.sample.getAccounts(input.Reseller));
This is supposed to select all the accounts in that lookup (same accounts as in registration app) associated with the global variable reseller.
I am getting this error
Error at lineNumber:1
Argument Type Mismatch calling function:registration.sample.getAccounts
Argument 1 should be : string
registration.sample.getAccounts(string) cannot be applied to registration.sample.getAccounts(list)
So clearly I have a problem with a list vs string. I tried playing around with my function having it collect a list vs a sting but I am not advanced enough to make it work correctly. Please help me edit or provide some code to make this work. Thanks