Example of a Server Script

In this example, the server script opens the Create a Contact task UI:

function WebApplet_PreInvokeMethod (MethodName)
{
   var returnValue = ContinueOperation;
    try
    {
        if (MethodName == "Test")
        {
            var inputPropSet;
            var outputPropSet;
            var taskUIsvc;

            inputPropSet = TheApplication().NewPropertySet();

            outputPropSet = TheApplication().NewPropertySet();

            taskUIsvc = TheApplication().GetService("Task UI Service (SWE)");

            inputPropSet.SetProperty("TaskName","Create a Contact");

            <!-- Note: Because taskUIsvc.Invokemethod() is required to pass outputPropSet, 
            the outputPropSet is created. outputPropSet is not used to send results back 
            to this script --!> 

            taskUIsvc.InvokeMethod("LaunchTaskFromScript",inputPropSet,outputPropSet);

            returnValue = CancelOperation;
        }
    }
    finally
    {
        inputPropSet = null;  
        outputPropSet = null;
        taskUIsvc = null;
    }
    return(returnValue);
}