When CRM Client:Products related list is updated, update same in Desk

When CRM Client:Products related list is updated, update same in Desk

My use-case is that when a user updates a Client(Account) in CRM (specifically when the associate and disassociate Products with that Client/Account) we want to see what related Products were added or removed. Then in Zoho Desk, we want to associate and disassociate those same Products from the same Client in Desk.

My thought is that when a Client is edited in CRM (the Trigger for my Flow) the first step is that the Flow needs to fetch a list of the related Product records. Here the function I am trying to build to do that, which is not working for me. Any help is appreciated:


list relatedRecords(string moduleName, string relatedModuleName, int record_id)
{
// Initialize a connection to Zoho CRM
authToken = "REDACTED";
orgId = "REDACTED";
zoho.crm.initialize(authToken, orgId);

// Get the module ID for the Zoho module
moduleInfo = zoho.crm.getFields(moduleName);
moduleId = moduleInfo.get("module_id");

// Get the module ID for the related module
relatedModuleInfo = zoho.crm.getFields(relatedModuleName);
relatedModuleId = relatedModuleInfo.get("module_id");

// Get the related items for the Zoho module
relatedItems = zoho.crm.getRelatedRecords(moduleName, moduleId, relatedModuleName, relatedModuleId);

// Initialize a list variable to store the related items
relatedItemList = List();

// Loop through the related items and add them to the list variable
for each relatedItem in relatedItems {
    relatedItemList.add(relatedItem);
}

// Output the list variable to a custom function or to Zoho Flow's output
info relatedItemList;
}


The error I am getting when I try to execute this function is: 
"Not able to find 'initialize' function at line number 6."

Any help is appreciated!