-
Notifications
You must be signed in to change notification settings - Fork 32
Manipulating Modules
###Get available modules
The get_available_modules function retrieves the list of modules available to the current user logged into the system. You can take the result from the function call and view every modules in the field. You can view the get_available_module function here: get_available_modules()
Let's take our session object and make a call to get_available_modules and store them in a module variable.
modules = session.get_available_modules()
Outputting this will give you the entire list of modules as we stated above. It will look something similar to this:

###Get module fields
The get_module_fields function is a more specified way of accessing module information, except now you specify a module and a specify a field in that module. This method allows us to have more precise information about the users database. The get_module_fields function is here: get_module_fields(). The function call looks like this:
get_module_fields(self, module_name, fields = [])
As you can see, the function call takes two parameters, a module and field. In the module parameter we specify a module name and the fields is a specific field in the given module. First we will look at an individual module. We can do so by inputting a module parameter but not a field parameter.
module = 'Accounts'
module_info = session.get_module_fields(module)
The information stored in module_info will contain all of the fields that are in the 'Accounts' module. This is important, as it will help show us what fields exist inside each module.

Notice that in this example, it contains a giant list of fields which are contained in the Accounts module, the picture simply cuts off most of the them because it's way more information then we need and the picture helps example what the field data looks like in a given module. However, say we want to specify only to output certain fields instead of the entire list of fields in the module, this is where we find the importance of the fields parameter. Using the same module, we can make a new function call, adding a couple fields from that list. Something like this:
modules = session.get_entry_fields('Accounts', ['rating','billing_address_state', 'billing_address_city'])
Which will give us output that looks like this:

This is much easier to deal with, so you can easily find the names in each given field in a given module.
###Search by Module
The search_by_module function will return the ID, module name and fields for specified modules. Supported modules are Accounts, Bugs, Calls, Cases, Contacts, Leads, Opportunities, Projects, Project Tasks, and Quotes. You can take the result from the function call and view the search result in the entry list. You can view the search_by_module function here: search_by_module()