- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 05:58 AM
> What are major difference between these fields.?
> Are there any scenarios where we can prefer document id over reference field?
> What should i consider if i decide to change the datatype of a field?
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 06:01 AM
Hi Prasanna,
> What are major difference between these fields.?
A reference field uses a related table field to point to a specific record in the prescribed table. E.g. caller is a reference to sys_user.
A document_id field can point to any record on any table. It includes the table as well as the record reference (e.g. Incdient: INC0010013)
> Are there any scenarios where we can prefer document id over reference field?
I generally don't use document_ids in my apps as I don't want to give the user the ability to point to any record on any table. I like to keep control on what is being used so I know what fields I have access to on the target record.
Document_ids are useful for things such as logging where you may not know the table the record points to.
> What should i consider if i decide to change the datatype of a field?
Be aware that changing a data type on a field can lose all data in that field (the column is effectively blanked out.) Always backup your entire table and test first!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 06:01 AM
Hi Prasanna,
> What are major difference between these fields.?
A reference field uses a related table field to point to a specific record in the prescribed table. E.g. caller is a reference to sys_user.
A document_id field can point to any record on any table. It includes the table as well as the record reference (e.g. Incdient: INC0010013)
> Are there any scenarios where we can prefer document id over reference field?
I generally don't use document_ids in my apps as I don't want to give the user the ability to point to any record on any table. I like to keep control on what is being used so I know what fields I have access to on the target record.
Document_ids are useful for things such as logging where you may not know the table the record points to.
> What should i consider if i decide to change the datatype of a field?
Be aware that changing a data type on a field can lose all data in that field (the column is effectively blanked out.) Always backup your entire table and test first!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2018 01:35 PM
Hi Chuck,
Do you see any threat about using a reference field that refers directly to task (core) table ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2018 04:37 AM
Hi Goulart,
If you need to point to the task table to reference any task record (e.g. problem, incident, pm_task, sc_req_item, sc_task, etc) then that's fine. Just make sure it's what you need to fulfill your requirement(s).
It might help to know a little bit more about what your requirement is and what you are trying to accomplish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-26-2018 05:30 AM
Correct me if I'm wrong, but you can't "dot-walk" through a document_id field. For that you will need a reference field to make it work. That would be a big thing and you need to think this through IF you choose to use a document_id field.
If you look at sysapproval_approver, they actually solved this with two fields which is kind of Icky... the "Approving" is the document ID and put is all the correct info. But then they have "approving For" which is a reference field for task table. This works almost the whole time, besides when it e.g. comes to knowledge articles, since that table isn't extended from task.