How To Set Field Values

// Create object
var lookupValue = new Array();
lookupValue[0] = new Object();
lookupValue[0].id = "80AC35A0-01AF-EA11-A812-000D3A8B3EC6"; 
lookupValue[0].entityType = "contact";
lookupValue[0].name = "Tester" 

// executionContext is passed as function parameter
var formContext = executionContext.getFormContext();

// Set lookup value
formContext.getAttribute("customerid").setValue(lookupValue);

// Set choices values
formContext.getAttribute("multichoice").setValue([1,2,3]);

// Set text value
formContext.getAttribute("textfield").setValue("foo@bar.com");

// Set number value
formContext.getAttribute("numberfield").setValue(10);

Source: setValue (Client API reference)