Closed mattstone closed 13 years ago
I think the main issue is that you need to use SugarCRM::TrannTrans
instead of SugarCRM::TRANN_Trans
. (You can list the module names used by the gem with SugarCRM.modules
.)
In other words, try doing SugarCRM::TrannTrans.find(...)
I have no idea as to how your SugarCRM environment is configured, so the suggestions below might need to be adapted to work. But in principle, this is what you need to do:
trans = SugarCRM::TrannTrans.create(...)
item = SugarCRM::TrannLineItem.create(...)
trans.associate!(item)
SugarCRM::Account.first(...).associate!(trans)
(P.S. the article on advanced gem use is up at http://davidsulc.com/blog/2011/04/05/ruby-gem-for-sugarcrm-advanced-use/)
Matt,
Just curious if David's answer solved your problem?
-Charles
Thanks for the response guys - really appreciate it.
I'm just giving this ago now.
Awesome, let us know!
Matt, gonna close this for now. Please re-open if it's not fixed!
Hello - thanks for the Gem - very useful indeed.
I can happily search through contacts & accounts. But am having a couple of problems when things get a bit more complex.
1, Unable to access certain Modules.
Sugar::Account.find.. => this works Sugar::TRANN_Trans.find.. => this does not work
SugarCRM.connection.get_fields("TRANN_Trans").inspect => this works
Both of which are returned as per SugarCRM.modules.
2, Just not getting how to use relationships.
I need to
I've read the documentation, I can see how to create records, but I'm a bit lost as how to traverse relationships,
Any chance of a couple of examples as per the above?
Thanks again for the Gem.