Property name changes from TRIM version 6 to 7
All TRIM objects have properties, and pretty much all of them are accessible in two ways:
- Directly:
string rectitle = record.Title; - Through a property id:
string rectitle = (string)record.GetProperty(3); //where 3 == recTitle
To find out all the Property IDs for a TRIM object type, you can use the following code in C#:
using System;
using TRIMSDK;
namespace ComTrimTests
{
class Program
{
static void Main(string[] args)
{
PropertyDefs recproperties = new PropertyDefs();
recproperties.SelectAll(btyBaseObjectTypes.btyRecord);
foreach (PropertyDef pd in recproperties)
{
Console.WriteLine("{0}: {1}", pd.InternalName, pd.Id);
}
Console.ReadLine();
}
}
}It’s generally good programming practice to avoid accessing enumerations by their internal number, but as the GetProperty method expects an Int, it’s really easy to do just that, and then get into trouble when the numbers change in a new version of the SDK. Say for instance going from TRIM 6.* to TRIM 7. The issue I had was that the recDateUpdated property ID number changed breaking a TRIM 6 application that we tried on TRIM 7.
“Why would you ever use GetProperty when you can just use the ‘proper’ property?” I hear you ask. Well, when you have an application that allows a user to configure what metadata they want to display for instance. You might define each column in a table with a caption and a TRIM Property Id.
“Then don’t use numbers, use the name, you fool!”
OK, so you could reverse things, do something like:
PropertyDefs recproperties = new PropertyDefs();
recproperties.SelectAll(btyBaseObjectTypes.btyRecord);
Dictionary recprops = new Dictionary();
foreach (PropertyDef pd in recproperties)
{
recprops.Add(pd.InternalName, pd);
}
string rectitle = (string)record.GetProperty(recprops["recTitle"].Id);That seems much cleaner. Use the InternalName as your lookup, don’t rely on numbers. But would you believe some names changed too?
So, if you’ve encountered the same issue, or are about to, below is a list of Record Properties that are different in TRIM 7. I haven’t compiled a list for the other TRIM object types, but using code similar to what I’ve used above, you can run it on different environments and compare the lists.
The table shows the differences in Internal Names, but the rows in bold are the ones where the Id number changed too (but there were only the two occurrences of that).
| TRIM 7 | TRIM 6 | ||
|---|---|---|---|
| Id | InternalName | Id | InternalName |
| 11 | recAccessionNumber | 11 | recAccessionNbr |
| 37 | dateLastUpdated | 35 | recDateUpdated |
| 136 | recAddressee | 136 | recAddresseeLoc |
| 417 | recAlternativeContainer | 417 | recAltContainer |
| 140 | recAlternativeContainers | 140 | recAltContainers |
| 180 | recAlternativeContents | 180 | recAltContents |
| 52 | recAssignee | 52 | recCurrentLoc |
| 147 | recAssigneeStatus | 147 | recCurrentLocationStatus |
| 139 | recAttachedKeywords | 139 | recTerms |
| 135 | recAuthor | 135 | recAuthorLoc |
| 24 | recClassOfRecord | 24 | recRcClass |
| 58 | recClient | 58 | recClientLoc |
| 55 | recCreator | 55 | recCreatorLoc |
| 6 | recDateRegistered | 6 | recDateReg |
| 23 | recDisposition | 23 | recCurrDisp |
| 167 | recDispositionSchedule | 167 | recPendingDispEvents |
| 62 | recDocumentDetails | 62 | recEDetails |
| 61 | recDocumentStatus | 61 | recEStatus |
| 12 | recExternalReference | 12 | recExternalId |
| 20 | recFilePath | 20 | recDOSfile |
| 18 | recHasLinkedDocuments | 18 | recHasLinks |
| 54 | recHomeLocation | 54 | recHomeLoc |
| 420 | recInitiateTemplate | 420 | recTemplate |
| 57 | recIsEnclosed | 57 | recEnclosed |
| 14 | recIsInPartSeries | 14 | recIsPart |
| 15 | recIsRootOfPartSeries | 15 | recIsRoot |
| 122 | recManualDestructionDate | 117 | recDestructionDate |
| 112 | recNewPartCreationRule | 112 | recAutoPartRule |
| 138 | recOtherContact | 138 | recOtherLoc |
| 53 | recOwnerLocation | 53 | recOwnerLoc |
| 56 | recPrimaryContact | 56 | recPrimaryContactLoc |
| 81 | recRenditionCount | 81 | recNumberRenditions |
| 137 | recRepresentative | 137 | recRepresentLoc |
| 101 | recRetentionSchedule | 101 | recRetSchedule |
| 144 | recTopLevelActions | 144 | recTopActions |
I assume the names were changed to be a bit more human readable - perhaps to make it easier when configuring the TRIM SharePoint integration. But in applications where I don’t want to maintain a different TRIM 6 or TRIM 7 version (and where I rely on Properties), I’ve used a TRIM6 and TRIM7 Resource tables in my C# projects, and use one or the other by querying the TRIMSDK.Database.SdkVersion property.
And you can to!
Matt.