How to Show Multiple Module Fields Audit Log in Single Audit Log View

Hello Suite CRM Team,

I created three modules, and use other two modules fields in one module. So can it be possible to show all fields of other modules audit log show in single module audit log.

If is it possible, then please let me know the way, how to achieve this thing.

For example : i have created two custom module viva studio

  1. Module 1
  2. Module 2
  3. Module 3

In Module 1 Edit View, i also add custom template footer and showing the other two module fields here .

I need the audit log of all there modules in single audit log view .

Thanks For your Suggestion

You can start by having a look at the database, the tables are called accounts_audit, contacts_audit, etc. From there you can get your information.

Then it’s a matter of customizing the view you want to change, and from there you can query the database directly with SQL and show the data in a table.

hello pgr,
I want to edit audit log view tpl file.
Which file need to edit?
The problem is I have one dependent dropdown field. and in audit log it displayed its value insted of lable.
like “parentDropdown_chileValue1”

I don’t know, but I can try looking…

Which SuiteCRM version, and in which module, are you trying to edit?

Version 7.11.5
Sugar Version 6.5.25 (Build 344)

Thanks for reply :slight_smile:

You were so quick to answer that you didn’t see I also asked for the module you’re trying to edit :slight_smile:

Actually this problem with all module. And I’m working with Leads module. :slight_smile:

This is the file, I think

https://github.com/salesagility/SuiteCRM/blob/master/modules/Audit/Popup_picker.php

I searched the label “Fields audited in this module”, and found it was called “LBL_AUDITED_FIELDS”. Then I searched for that and I got to that file.

It seems the same file is used for all modules. And it seems that, for convenience, it uses the “popup picker” class, which I believe is what is used whenever you click to select a Contact, for example, and a pop-up appears.

If you make that change generic we can include it in the source code so everybody gets nice dropdown labels in their audit tracks.

Hello pgr,
I did this. and it’s work.
Please suggest if need any change… And thanks :slight_smile:

   $leadStatus= $app_list_strings['lead_status_dom'];
    foreach($leadStatus as $key => $val){
     if($key == $activity_fields['BEFORE_VALUE']){
      $activity_fields['BEFORE_VALUE'] = empty($activity_fields['BEFORE_VALUE'])? 'NULL':$val;
      
     }
     if($key == $activity_fields['AFTER_VALUE']){
      $activity_fields['AFTER_VALUE'] = empty($activity_fields['BEFORE_VALUE'])? 'NULL':$val;
     }
    }

Hello pgr,
Thanks for reply.
In “Popup_picker.php” file I have add my custom code and change

$activity_fields['BEFORE_VALUE'], $activity_fields['AFTER_VALUE']

value as per requirement. and its work fine.
Problem is I can’t extend audit module. I did this in core module.

code :

//Default assign value by suite
$activity_fields = array(
                'ID' => $audit['id'],
                'NAME' => $audit['field_name'],
                'BEFORE_VALUE' => $before_value,
                'AFTER_VALUE' => $after_value,
                'CREATED_BY' => $audit['created_by'],
                'DATE_CREATED' => $audit['date_created'],
            );

//My customization
$leadStatus= $app_list_strings['lead_status_dom'];
			 foreach($leadStatus as $key => $val){
				 if($key == $activity_fields['BEFORE_VALUE']){
					 $activity_fields['BEFORE_VALUE'] = empty($activity_fields['BEFORE_VALUE'])? 'NULL':$val;
					 
				 }
				 if($key == $activity_fields['AFTER_VALUE']){
					 $activity_fields['AFTER_VALUE'] = empty($activity_fields['BEFORE_VALUE'])? 'NULL':$val;
				 }
			 }

and Thanks again for your quick reply. :slight_smile:

Nice. If you can make that code more generic we can put it into core. B-)

It would need to be generic regarding the field (so, it should apply to all dropdown fields, not just Lead Status).

I think you can also probably get the label without a loop - you can probably just index into the array, like here for example: https://github.com/salesagility/SuiteCRM/blob/master/modules/Leads/Lead.php#L398

1 Like

Sure, I’ll do it.
And thanks for your reply. :slight_smile:

Hello pgr,
Just I want to know, can I extend audit module?
I tried to update audit module but its not work for me?

I suppose you can extend it, but I am not sure.

Anyway, you need to decide first which approach you’re going to adopt: if you’re working to contribute code to core, you shouldn’t extend it, you should just change it.

But if you working on a local customization only, then you can look into extending it.