Check for the flexible & generic javascript solution for iterating and calling custom functions for each record while working in Adobe Campaign workflows
Read this post on technowide.net