Frappe Cloud Support Partners Foundation Frappe School

Doctype link self-awareness


Is there any easy way for a doctype to be notified once it is being linked in another doctype. Lets say we have a field in doctype A which is a link to doctype B. When I add a new record in doctype A and select a record from doctype B in that field and save. Is there any possibility that doctype B knows that it is being linked. Something like a hook “on_being_linked” ?

what is your use case?

To fast filter out docs which are linked or not linked by other docs.

I had another similar use case: one equipment can be linked(used) only by one active job card. the proposed solution is to use set_query for the equipment link field, in the python method called by set_query, filter out equipment already linked in active job card.