V8: How to fetch primary contact & address?

{% set links = frappe.get_all(‘Dynamic Link’, filters={‘link_doctype’: ‘Company’, ‘link_name’: doc.company, ‘parenttype’: ‘Address’}, fields=[‘parent’]) %}
{% if links %}
{{frappe.db.get_value(“Address”, links[0].parent, “address_line1”)}}
{% endif %}`

its working

1 Like