Object: 17. Click here for more information.  
  DataReturn Text A comma delimited list of advanced search fields to be returned after a successful save
  Id Numeric  
  Remove Numeric Pass '1' to remove the item
  BillingStatus Numeric Id of the billing status. 1=Billable,2=Non-Billable,3=Don't Know,4=Approved For Billing,5=Has Been Billed
  By Numeric Person / User Id who is meant to do / did the action
  Completed Date Date action was completed
  CompletedTimeZone Numeric  
  ContactBusiness Numeric  
  ContactPerson Numeric  
  Description Text (6000)  
  DueDate Date Due date of the action.  Format: dd MMM yyyy hh:mm [am/pm].  Format mask: "dd MMM yyyy hh:mm tt"
  DueDateTimeZone Numeric  
  Lock Text (1) Y/N. Up to the interface to implement the locking.
  Object Numeric What kind of object the action is linked to. Click here to see valid values
  ObjectContext Numeric Id of the linked object
  Priority Numeric Id of the priority. 1=Low,2=Medium,3=High,4=Critical
  Private Text (1) Y/N. If Y, only the actionby person can see the action
  Reference Text (800)  
  ReferenceMask Text (50) Alternatively, you can pass a mask to generate the Reference. It should have question mark(s) where the number is meant to go. For example with the next number of 123, "REF_??????" would generate "REF_000123". "REF?" would generate "REF123", "REF??????abc" would generate "REF000123abc". Note: The reference has to be blank for this to take effect
  SourceAction Numeric Id of a parent action. Can be used for recurring actions etc
  Status Numeric Id of the action status. 1=Completed,2=Not Started,3=Cancelled,4=In Progress
  Text Text (Large) Extended, essentially limitless, text
  TotalTimeHrs Numeric  
  TotalTimeMin Numeric  
  Type Numeric AKA 'type'. Id of the action type. You can define your own, plus there are standard ones. eg 1=Phone Call,2=Site Visit,3=Meeting
  var sParam = '/ondemand/action/?rf=JSON&method=ACTION_MANAGE';
var sData = '';
var bAsync = true;
var dToday = new Date();
dToday = dToday.format('yyyy-mm-dd');

if (aParam.object == undefined) {aParam.object = giObject}
if (aParam.objectContext == undefined) {aParam.objectContext = glObjectContext}

if (aParam != undefined)
if (aParam.async != undefined) {bAsync = aParam.async}

if ((aParam.object == '12' && aParam.objectContext != undefined && aParam.contactBusiness == undefined)
|| (aParam.contactBusiness != undefined))
{ // This is a business - set contbusinessid accordingly
aParam.otherData = (aParam.otherData == undefined)? '': aParam.otherData;
aParam.otherData += '&contactbusiness=';

if (aParam.contactBusiness != undefined)
{ aParam.otherData += FormatSave(aParam.contactBusiness); }
{ aParam.otherData += FormatSave(aParam.objectContext); }
if ((aParam.object == '32' && aParam.objectContext != undefined && aParam.contactPerson == undefined)
|| (aParam.contactPerson != undefined))
{ // This is a person - set contpersonid accordingly
aParam.otherData = (aParam.otherData == undefined)? '': aParam.otherData;
aParam.otherData += '&contactPerson=';

if (aParam.contactPerson != undefined)
{ aParam.otherData += FormatSave(aParam.contactPerson); }
{ aParam.otherData += FormatSave(aParam.objectContext); }
sData += 'object=' + aParam.object;
sData += '&objectcontext=' + aParam.objectContext;
sData += '&subject=' + FormatSave((aParam.title==undefined?'':aParam.title));
sData += '&description=' + FormatSave((aParam.description==undefined?'':aParam.description));
sData += '&priority=' + FormatSave((aParam.priority==undefined?'':aParam.priority));
sData += '&status=' + FormatSave((aParam.status==undefined?'':aParam.status));
sData += '&type=' + FormatSave((aParam.type==undefined?'':aParam.type));
sData += '&date=' + FormatSave((;
sData += '&actionby=' + FormatSave((aParam.actionby==undefined?gsUserID:aParam.actionby));
sData += (aParam.otherData==undefined?'':aParam.otherData);

type: 'POST',
url: sParam,
data: sData,
dataType: 'json',
async: bAsync,
success: function(data) {interfaceMasterStatus('Action saved');}