If you create an INT32 attribute on an object and set the persistance type of create identity it will automatically start to generate the next id for each new record created and saved. However, this will count for all records created not for just those specific to the parent object.
For example, if you create a new collection called "internal discussions" on the incident object and add a new id attribute with the create identity persistance type:
Add an incident and 5 "internal discussion" records to it. These will be numbered from 1 to 5 in the id.
Add another incident and add 5 "internal discussion" records to it. These will be numbered from 6 to 10 in the id.
If you want the count to be specific to each parent object created i.e. in the example above the second incident to have "internal discussion" records numbered 1 to 5 then you can do this from version 7.3 by creating a calculation. The counter or id will show as soon as the window has been saved.
The steps required are:
1. Create a new int32 attribute on the collection
2. Do NOT give it the persistence type of Create Identity.
3. Set the Calculation Type on the attribute to BeforeSave.
4. Set the Calculation formula to:
static def GetAttributeValue(_ObjectName):
For example if you wanted to have a counter on the With 3rd Party collection which is on the Incident object:
static def GetAttributeValue(_With3rdParty):
PLEASE NOTE: Case is important as parts of this is case sensative so if in doubt please drag the object in question onto the calculation.
5. Untick the auto-detect dependencies tickbox and then drag in the parent object. For example, on the example above the dependency will be _Incident.
6. Save the calculation attribute and add it to your collection window.
7. NOTE: This will only start to generate for new collection records created as the calculation fires only when a NEW record is created and saved for the first time.