SugarCRM ZuckerReports Encoded Settings

I love the reports we get out of SugarCRM now but ZuckerReports sometimes does things that throw me off for a while and then make me kick myself when I understand them later. Today’s case in point I needed to add someone to an existing scheduled report. Zucker (at the moment) does not have any facility for this, you just delete the old one and set up a new one, but I was not having any of this and dived into the database.

Now in the interface and the database the scheduled reports settings are “encoded” and it would appear that adding an e-mail address should have been straight forward. An example :

a:7:{s:10:”FooCoUsers”;s:8:”j.smiths”;s:6:”format”;s:3:”PDF”;s:15:”parent_category”;s:0:””;s:13:”parent_module”;s:0:””;s:9:”parent_id”;s:0:””;s:10:”send_email”;s:38:”d.badgers@fooco.com,j.smiths@fooco.com”;s:6:”record”;s:36:”44989f47-f46e-f334-c287-4c45cb79ff98″;}

Pretty obvious where the email addresses are and they simply appear to be comma separated. So all you do is add the email address in after the last one prefaced with a comma? Not quite…

If you do this then the report will fail silently and will not run and you will be digging around trying to find out what happened! 🙂

The Reason aka why you are here

Breaking down the report setting encoding is simple (not sure what the a7 bit is) but then you have inside the curly braces a number of data values each separated by a semi colon ( ; ) the values are in “quote marks” and then they are prefaced by an s:$: value. This value is the a number of characters inside the data quotes for that entry eg s:6:”record” because the word record is 6 letters long. In the case of the e-mail address list it is everything (including the commas) between the quote marks. If you don’t change the s:$: value for a record and change the value (unless the new data is exactly the same length) it will fail silently!

Anyway I hope this helps someone as I was fiddling with this for ages 🙂