Need help defining function for referencing fields from other apps

Need help defining function for referencing fields from other apps

What I am trying to do:
I need a form in my remote app to filter a lookup dropdown field based on the records from another master app. 
Ideally, it would work exactly as my on add and on edit scripts work in the master app. The current script used for that is:

if (count(Tour_League_Division_Conference[Series == input.Series])  ==  0)
{
    clear Tour_League_Division_Conference_Name;
}
else
{
    rec_TLDC  =  Tour_League_Division_Conference  [Series == input.Series] sort by  Name ;
    Tour_League_Division_Conference_Name:ui.add(rec_TLDC.Name.getall());
}

For this new script, Tour_League_Division_Conference and Series are both in a different application.

What I think needs to be done:
I've done some research and it sounds like I need to define a function in the master app that is used by the remote app to call up Tour_League_Division_Conference based on the Series that is selected in the master app. 

My problem:
I'm still new deluge scripting, particularly building and using functions. I've read your support page on Defining a Function and a few other posts, but I just can't seem to grasp enough about functions to be able to put this together.

Please assist.
Thanks,
Brent