Results 1 to 6 of 6

Thread: How to audit link fields? Audit works great except for link fields.

  1. #1
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default How to audit link fields? Audit works great except for link fields.

    Is it possible to audit fields defined in vardefs.php as type => link?

    Here are selected lines directly from my Contacts module vardefs.php:

    HTML Code:
    $dictionary['Contact'] = array('table' => 'contacts', 'audited'=>true, 'unified_search' => true, 'duplicate_merge'=>true, 'fields' =>
    array (
    <... snip ...>
    	'lead_source' =>
    	array (
    		'name' => 'lead_source',
    		'vname' => 'LBL_LEAD_SOURCE',
    		'type' => 'enum',
    		'options' => 'lead_source_dom',
    		'len' => '100',
    		'audited'=>true,
    		'comment' => 'How did the contact come about',
    	),
    	'account_name' =>
    	array (
    		'name' => 'account_name',
    		'rname' => 'name',
    		'id_name' => 'account_id',
    		'vname' => 'LBL_ACCOUNT_NAME',
    		'join_name'=>'accounts',
    		'type' => 'relate',
    		'link' => 'accounts',
    		'table' => 'accounts',
    		'isnull' => 'true',
    		'module' => 'Accounts',
    		'dbType' => 'varchar',
    		'len' => '255',
    		'audited'=>true,
    		'source' => 'non-db',
    		'unified_search' => true,
    		),
    <... snip ...>
    	'email_addresses' =>
    	array (
    		'name' => 'email_addresses',
    		'type' => 'link',
    		'relationship' => 'contacts_email_addresses',
    		'module' => 'EmailAddress',
    		'bean_name'=>'EmailAddress',
    		'source' => 'non-db',
    		'audited'=>true,
    		'vname' => 'LBL_EMAIL_ADDRESSES',
    		'reportable'=>false,
    	),
    Note that auditing is enabled for all three fields and that the first (lead_source) is a data field (type => enum), but the next two are link fields.

    Changes to lead_source show up in the change log.

    Changes to account_name have the side effect that all linked address information that changes shows up in the change log, but the account_name change does not show up in the change log.

    Changes to email_address do not show up in the change log.



    The underlying MySQL audit tables show up when you enable auditing, clear the vardefs cache and rebuld vardefs. There is an audit table specific to the modules' underlying table (e.g. contacts_audit), implying that it is there to hold changes to data fields stored in the Contacts module. The results of the account_name audit test are consistent with this showing that only data stored in the contacts table is audited for changes.


    This creates the awkward situation where a field like email_address is viewed from Contacts, but apparently can't be audited from there as it has a many-to-one relationship to contact.


    Also note that the relationship definition 'relationship' => 'contacts_email_addresses', does not refer to an existing table since email addresses are related to multiple tables using 'email_addr_bean_rel'


    I would love to be able to audit data that is (from the user perspective) related to Contacts using the Contacts module. But any audit trail would let me accomplish the purpose.



    So the general question is:
    How is auditing supposed to work when applied to links?

    And the more specific question is:
    Is it possible to audit Email Addresses?


    I asked the more specific question earlier in http://www.sugarcrm.com/forums/showthread.php?t=31557, but didn't get any answers.

    Does anyone have any info for me on this??

    Thanks

    Phil

  2. #2
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: How to audit link fields? Audit works great except for link fields.

    Help! Any info at all out there?

    Thanks

    Phil

  3. #3
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: How to audit link fields? Audit works great except for link fields.

    I think I found the bug responsible for your problem, look to thread http://www.sugarcrm.com/forums/showt...d=1#post109275 for the solution.

  4. #4
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: How to audit link fields? Audit works great except for link fields.

    Hi Kuske,

    Thanks for the response, but Sugar has already informed us that this is no longer a supported feature in 5.0 due to the schema changes between 4.5.1 and 5.0.

    See http://www.sugarcrm.com/forums/showthread.php?t=31765

    I didn't have time to read your solution carefully or try it, so if it does indeed let you audit email address changes, etc, I'd love to hear about it.

    Thanks

    Phil

  5. #5
    smithni is offline Junior Member
    Join Date
    May 2010
    Posts
    3

    Default Re: How to audit link fields? Audit works great except for link fields.

    this worked for me sugarcrm professional 5.5.1

    thanks for your help!

  6. #6
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: How to audit link fields? Audit works great except for link fields.

    Quote Originally Posted by smithni View Post
    this worked for me sugarcrm professional 5.5.1

    thanks for your help!
    Hi smithni,

    I never did get this working and went on to other things. Sounds like it's time to re-visit it.

    Can you post exactly what you did or attach the modified file(s)? There are a couple of solutions in that thread that I could not get working at that time, so seeing your solution would be very helpful.

    Thanks

    Phil

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 2011-02-15, 05:46 PM
  2. Hot to Audit Custom Fields
    By tbivans in forum Developer Help
    Replies: 4
    Last Post: 2006-12-21, 01:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •