how to get contactId associated with a dealId in function ?

how to get contactId associated with a dealId in function ?

when executing function from a Deal Form I need to know the contact related to the deal 
how is it possible in deluge ?
thanks