Mass Update Plugin and Record Editor Automatic Value

Topics related to AppGini plugins/add-ons go here.
Post Reply
yvonnes
Posts: 5
Joined: 2015-04-06 17:44

Mass Update Plugin and Record Editor Automatic Value

Post by yvonnes » 2020-09-03 18:45

Hello,

Is there is a way to get the "Edited by Username" automatic value (<%%editorUsername%%>) to work when records are updated with the Mass Update plugin?

I'm updating a field (a "Completed" checkbox) with the mass update plugin and that part works great. However, I also have another field set to an automatic value that usually records the user name of whoever made the most recent change in the record and that automatic value is being left unchanged by the plugin.

Thanks in advance for your help!

yvonnes
Posts: 5
Joined: 2015-04-06 17:44

Re: Mass Update Plugin and Record Editor Automatic Value

Post by yvonnes » 2020-09-04 20:42

This is what I've got working for now:

In the applicable hooks/ajax-mass-update-[tablename]-[field to update]-[command id].php file, I modified the update query to add $recordeditorfield and $recordeditoruser.

$tn = 'public_workflowprogress';
$field = 'completed';
$recordeditorfield = 'recordeditor';
$recordeditoruser = $user['username'];
$pk = getPKFieldName($tn);

$query = "UPDATE `{$tn}` SET `{$field}`='{$new_value}', `{$recordeditorfield}`='{$recordeditoruser}' WHERE `{$pk}` IN ({$cs_ids})";

Hopefully a future version of this great plugin will insert all the automatic values the same way they would when individual records are manually updated, perhaps optionally if there are cases where that is not wanted :)

Post Reply