Example of a Client Script

In this example, the browser script locates the Create a Contact task UI, and then starts the task:

function Applet_PreInvokeMethod (name, inputPropSet)
{
   var returnValue = "ContinueOperation";
   try
    {
        if (name == "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 --!> 

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

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