Create a new Record version in the ServiceAPI

There is a sample for creating a new version of a Record in the ServiceAPI help, found here: /examples/RecordNewVersion in your ServiceAPI help. This sample uses a standard form post. The technique using the .Net wrapper classes is very similar.  The process is:

  1. identify the Record for which you want a new version,
  2. create a Record object using the original Record Uri,
  3. set the NewType property,
  4. update any properties you want to be different on the new version (for example: set the Notes to empty, then
  5. post the Record object as per usual.

Example

Record record = new Record();
record.Uri = 9000008003;
record.NewType = NewType.Version;
// this tells the request I want the Record Number property in the response.
record.Properties = new List<string>() { "RecordNumber" };

RecordsResponse response = trimClient.Post<RecordsResponse>(record);

foreach (Record responseRecord in response.Results)
{
     Console.WriteLine(responseRecord.Number);
}

Rationale

The technique of posting the original Record with the NewType flag allows us to create the new version and set properties (and also run ServiceActions) all in one POST from any of JSON/AJAX, HTTP form post, or the .Net wrapper.