chicks / sugarcrm

A ruby based REST Client for SugarCRM
MIT License
90 stars 64 forks source link

How to call custom module methods #80

Closed kevinsdooapp closed 12 years ago

kevinsdooapp commented 12 years ago

Hi!

First, thanks for the good job that you did!

I have a question on how to call methods on custom modules.

Exemple: I defined a Software custom module into sugarcrm.

How do I create a new Software?

I tryied SugarCRM::Software.new but I got this error : NameError: uninitialized constant SugarCRM::Software

I tried to look for an example on the documentation but without success.

Thanks in advance!

Kévin

chicks commented 12 years ago

Kevin,

The module is probably named a bit differently, since custom modules are prefixed with a package "key". You can get the list of available modules like this:

SugarCRM.modules

Hope that helps!

kevinsdooapp commented 12 years ago

Hi chicks!

Thanks for your quick answer but SugarCRM.modules gives me this name DOOAP_Softwares and its exactly what i used

SugarCRM::DOOAP_Softwares.new

NameError: uninitialized constant SugarCRM::DOOAP_Softwares

Any idea?

chicks commented 12 years ago

Oh... This might be a bug, try removing the underscore.

chicks commented 12 years ago

Or using the singular form...

s = SugarCRM::DOOAP_Software.new
kevinsdooapp commented 12 years ago

Both doesn't work...but I got it!

We should use KEY followed by the module name without underscore and with the singular form...

SugarCRM::DOOAPSoftware.new for the DOOAP_Softwares module

Could be nice to add it to the documentation ;-)