The CreatorCon Call for Content is officially open! Get started here.

when to use document id field over reference field?

prasanna11
Giga Guru

> 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?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

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!


View solution in original post

8 REPLIES 8

Hello Chuck, I am really new to SNOW and curious to know, can we use Document ID in the change ticket when the change is being created to fix specific Incident? This way the user can add the incident number in the document if field.

I would need to know more about your use case. If there's already a reference field (or related list) to incident, then I recommend using that.

Good timing on this response, I'm doing an episode of NowCommunity Live Stream on document IDs today. Here's the YouTube link, I'll post the community link after I finish broadcasting/recording. 

Here is the community link with the video from this morning.

Hello Chuck, I am really new to SNOW and curious to know, can we use Document ID in the change ticket when the change is being created to fix specific Incident? This way the user can add the incident number in the document if field.