Copy Field Contents from sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2013 02:32 AM
I have a user field that I've created which I use to give each user record a unique ID as I have a lot of cleaning up to do to ensure to integrity of our user database - imported from our previous incident management application.
Up to now I have been running a background script to populate this field with the sys_id of the user record from SN as that uniquely identifies each record. Rather than having to manually update this I would like it to be automatic so I have tried creating the new field as a reference field to sys_id however because of the nature of that field's attributes it becomes hidden from view.
Does anyone have any suggestions as to how I might get this automated and visible.
TIA
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2013 06:49 PM
Try this:
1. create a new string field called Unique ID (default length of 40 is OK) on the User table
2. select Personalize Dictionary to check the Read only field (might have to add it to the form)
3. create a new Before Insert Business Rule with the following script:
u_populateUniqueId();
function u_populateUniqueId() {
current.u_unique_id = current.sys_id.toString();
}
4. run your script on the records one last time to populate the new field for existing records.
The field will be auto-populated from now on whenever a new record is added. You can see it running on demo018 at the moment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2013 01:09 PM
Another way of doing it would be to skip the Business Rule and set the Default value for the new field to
javascript:current.sys_id.toString();
Setting the value of the field and protecting it from edits is now all self-contained within the Dictionary Entry. Might be cleaner this way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2013 08:40 AM
I will also give this a try now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2013 12:26 AM
Much appreciated Jim, I have created the new business rule and will test during today.