How does link field work..?

Hello everyone,

I wanted to know how does linking of two doctype work?
What fields are involve in linking two doctype…?

when you link a field to another doctype, it actually fetches whole document with that name to your current doc

you can access any field from the linked doc by simply using fieldname_in_cur_doc.fieldname_in_linked_doc


according to me, when you get any link field on current doctype, you need to specify the other doctype whose link field we need to add. As a link field we get all primary keys of the linked doctypes to get selected. Thus , we get primary key of the doctype and we can render to the same doctype using this link field.

I hope this helps.

Thank @PratikM34 for you reply.
I got the answer.

Also wanted to mention in detail,
That the field ‘parent’ in child table or child doctype holds the value of Parent doctype ‘name’ field.
So the ‘name’ field of parent doctype get saves in child doctype ‘parent’ field in database and thus,
on parent record load the child table record get load on basis on this field.

Thanks @neerajvkn for your reply

Thanks for the details

You are welcome