Where is the account id field?

I created a custom module then added a relationship to accounts. I see the account name field was created as accounts_modulenamename but can’t figure out what the name of the account id field is! I have tried everything I know of accountsmodulename_id. The only way I can find it is if I don’t create the relationship at all and just create a relate datatype field for account which creates account_name_c field and the account_id_c field. This can’t be the only way to reference the account id when relating to another module customized or not.

If you inspect the html source of the page you will see a hidden Accounts id field just below the account name field. That is one way of getting it, you could also look in the relationship table in the database that was generated when you created the relationship.

I saw your suggestion and you were right I was able to find the account id field the funny thing is we still cant get the value back from it even though I see it has one and we reference it just as it is in the html page.

How are you trying to get the value?

If its in the php code it would just be something like: $bean->account_id;

Maybe this will be of some help to you: https://developer.sugarcrm.com/2012/03/23/howto-using-the-bean-instead-of-sql-all-the-time/