-
Notifications
You must be signed in to change notification settings - Fork 32
Manipulating Entries
Get entry list is used to get a list of entries from the sugarcrm database. The function itself can be found here and it looks like this:
def get_entry_list(self, module_name, query ="", order_by ="", offset = 0, select_fields = [], link_name_to_fields_array = []):
We have already discussed how modules work and you will put that into the module_name parameter. We will be using Accounts for these examples. Now if you just put in a module name and leave everything else blank, as such:
entry_list = session.get_entry_list('Accounts',"","","",[],[])
You will get a really long list of every entry in the Accounts module. So it's important to specify a bit with what you are looking for. Let's use a specific industry type to focus our search a bit. We will use the query field to do this.
entry_list = session.get_entry_list('Accounts', "accounts.industry = 'retail'", "","",[],[])
or
entry_list = session.get_entry_list('Accounts', "accounts.billing_address_state = 'CA'","","",[],[])
Adding queries like this will help limit your search a bit, but it will still come back with way more information then we need. So we need to be a little bit more specific with our searches. Now we will add information to the select fields parameter.
entry_list = session.get_entry_list('Accounts', "accounts.industry = 'retail'", "","",['id','sic_code'][])
You get much shorter output and closer to what we want, which looks like this:

##Get Entry Count
We can find out how many entries exist in a specific query. The get_entries_count() function can be found here We use the following example to demonstrate how get_entries_count() works.
entries_count = session.get_entries_count('Accounts', "accounts.industry = 'retail'")
Which will give us the following output:

This outputs the number of entry fields in any given field, with a field specification.
set_entry()
set_entries()