Here’s a fun request I saw a while back on the forums…
It would be great if you could export contacts while filtering on other object criteria. A simple example would be, if I wanted to export all contacts that are associated to accounts of type “Customer”. It is simple, but a huge help so I don’t have to chase this data down directly from the database.
I’d be lying if it’s the first time I’ve seen a request like this, and often it requires you doing some oddball code level changes in the SearchFields definitions which can be a bit daunting to say the least. Luckily with Sugar Logic in Sugar 6.3 and later you can have a calculated field that can grab a value from a related record, making this much easier to do.
So to do what the poster is asking, try these steps:
- Go into Studio, and add a new TextField in the Contacts module named ‘account_type’
- In the field definition, checkbox ‘Calculated Field’ and put in the formula
into Formula Builder.
- Save the field
- Add the field in the layout of the ListView and the Search ( either Advanced or Basic, depending upon your preferences ) for the Contacts module.
- Go to the Contact ListView, and do a search for “Customer”
- Click the checkbox down arrow and choose ‘Select All’
- Click ‘Actions’ and then ‘Export’ to export the records.