Dovico.TrackITAPI.CCustomTemplate.Save(System.String,Dovico.TrackITAPI.CStateInfo)
Function Overview:
Responsible for saving custom field template information to the database in the format customtemplate.xsd.
Parameter List:
sXml - string - string of xml in the format
siState - CStateInfo - State information needed to process the transaction
Returns
A string of xml containing the IDs of inserted and updated items
Example:
// initialize a string of xml containing information to send
// Notes:
// 1) TYPE is the type of custom field control: (X - Exclusive Choice,
// M - Multiple choice, A - Alphanumeric, N - Numeric, D - Date)
//
// 2) LINKTYPE is the type of object this refers too.
//
// 3) ASSIGNEDITEMS tag: For Templates linked to Time Entries ('M')
// and Expenses ('X') You can assign them to specific Tasks for
// Time Entries, or specific Expense Categories for Expenses.
// These are done through the ASSIGNEDITEMS section of the xml.
//
// 4)VALUES tag: Add default values for single value types (A,N,D).
// For X and M types, you can add several values. For X types
// only one can be a default, but for M any number can also be
// default
string sXml = "<CustomTemplate:CUSTOMTEMPLATES xmlns:CustomTemplate=\"http://www.dovico.com/schemas/customtemplate.xsd\">";
sXml += "<CUSTOMTEMPLATE ID=\"-1\" LINKTYPE=\"X\" TYPE=\"M\" NAME=\"TEST_TEMPLATE\" REQUIRED=\"F\" DESC=\"DESCRIPTION\" HIDE=\"F\">";
sXml += "<ASSIGNEDITEMS><ID>100</ID><ID>101</ID><ID>102</ID></ASSIGNEDITEMS>";
sXml += "<VALUES><VALUE ID=\"-1\" VALUE=\"TEST\" DEFAULT=\"F\"/>";
sXml += "<VALUE ID=\"-1\" VALUE=\"TEST2\" DEFAULT=\"F\"/>";
sXml += "<VALUE ID=\"-1\" VALUE=\"TEST3\" DEFAULT=\"F\" /></VALUES></CUSTOMTEMPLATE>";
sXml += "</CustomTemplate:CUSTOMTEMPLATES>";
//call the method to save the Custom Template:
wsapi.MethodInvoke("CustomTemplateSave", sXml, stToken);