Relate based vardef snippet

- Creates database insert statements to bypass a SugarCRM bug at the moment
- We shouldn't need the db inserts