How to relate the existing record through the controller file like(record.js,create-action.js) in sugarCRM 7.* ?

Hey Guys,

I need to relate my Account module record to my custom module existing record base on conditions using controller files.

Any advise or guidance would be greatly appreciated..!!

Thanks.