As in any database system, Salesforce need records to have an identifying key (as known as ID in general conversation.) Here are the basics:
- Salesforce uses its own ID for all records regardless of what object it is. The format is a 15-character alphanumeric string - (eg. a0s11000001L2KD)
- That however is usually not very helpful to a human being reading it, so Salesforce also allows you to tag each record with have a Record Name. (You can change the label to anything such as Village ID, SKU #, Well Name)
- Record Names can be up to 80 character long OR an autonumber (for example you can have Village-001 and it counts up one at a time.)
- Salesforce in general permits multiple records to have the same Record Name - for example you can have two Villages with the same name.
TaroWorks and record IDs
When using TaroWorks, you often need to specific a record ID especially if you wish to edit it or attach a child record to it. Please see the field mapping guide for more information.
- For this reason, allowing your records to have the same name is usually not a good idea because if you try to edit a record or add a child record it may change the wrong file.
- Other than the record name, TaroWorks can use two other types of field to use as IDs - a text field marked as Unique or External ID, as well as any other autonumber field you have added to the object.
Factors to consider when choosing IDs
There are a number of practical factors to consider when you decide on which field to set as ID and what format it should be in:
- Who needs to read it? If it is for someone working in the back office to check transactions then maybe Invoice #1230 will work fine, but if the field officer use it in the Drill-down (see Building New Jobs) to find a village then Village #1230 would be troublesome as the field officer need to remember what the number stands for.
- Is language an issue? In areas that does not use the Latin Alphabets or areas with low literacy, it is often a problem for names and places to be transliterated into differently. (Phong, Fong, Phnong, etc.) Not only is this a problem if entering with the keyboard but even for choosing in the drill down it may have issues.
- Will the ID need to decode into something meaningful? Perhaps internally your organization have agreed on a system such as a Doctor Visit Code where 14/03/13-Nick could mean Dr Nick visit for 2014 March 13th. This is also called an Algorithmic ID or Compound ID.
- If it is a code of some sort, how can the field read it and record it? For example, if you can reasonably expect your members to carry membership cards at all times, you can put the code there, or you can tag objects with barcodes or QR codes - this is good when there is a large number of items.
- There might be scenario where you have one object (ie. House) and you want it to count up by an attribute (ie. City) such as Kiberu-1, Nakuru-1, Kiberu-2, etc. If you have advanced skill in salesforce, you can build such as record ID system. You may wish to contract out this service to a professional if you have this need.
Choosing intelligent IDs
Here are some common scenarios, you would have to pick the best approach for your use case:
- If you know using plain words as the ID would be short, simple, clear and most importantly unique, then that's a good way to go. (However the scope of a successful project might mean you have scalability issues later.)
- If a simple count is fine, and there is no need for the field officer to remember, then Autonumber is the best choice.
- A compound ID is ideal when you need something that is guaranteed to be unique, while coding for something that can be read by the field staff during drill down. The exact steps for this depends on your formula and requires a deeper understanding of Salesforce, but generally you would take different fields and concatenate them together into a text string.
- For example if you have the following format for a village: DIS/SUB-###-Name, where:
- DIS is a 3 character code for a District (up to you how this is set)
- SUB is a 3 character code for a Sub-district
- ### is the number of village in the given sub-district
- Name is the common name spelt out for the field officer to read
- You can use a salesforce workflow and a formula to take the information form these four fields and concatenate it together and store it in a separate text field (with the unique constraint on.)
- You can now display this name in the drill down and use it as record ID.