How Do I Create a Function that Is Available for the Current Task Only? (Magic xpa 2.x)
The availability of a given function is determined by the Scope property. If the Scope is Task, then the function will only be visible to this task.

-
Go to your function.
-
Click on the field after Scope: (or tab to it).
-
Choose Task from the selection list.
Now the function will only be visible within this task.
How Do I Create a Function? for details on the basics of creating a function.
The Online and Rich Client Samples projects (program LG04 and RLG04)