<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="padding-bottom: 10px; padding-top: 5px;">
<div style="padding:12px; border:1px solid #8D3970; background-color:#F7F9FA; color:#8D3970; font-size:14px; line-height:22px; font-family: Calibri, Arial, Helvetica, sans-serif;">
<strong>CAUTION:</strong> This e-mail originated outside the University of Southampton.
</div>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
To log something in the history dataset, you need to do something like this:<br>
<a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Fperl_lib%2FEPrints%2FDataObj%2FEPrint.pm%23L755-L772&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C24917ee7cded4358f27008da78a92567%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637954965110788748%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=TMaXxKfeta%2FbdstQEKPk14afQtZIyl35zZHqwxiGtt4%3D&amp;reserved=0" originalSrc="https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/EPrint.pm#L755-L772" shash="BWnJXQibqC6XL91Qc3XceROItQN9D122pqGkcfQvN77pg8URpN2WnpZgrLuXGL3UhBqghzD0BsS590otb/RQfVCALq0o/iPNaCDOMUlorPgQ7c2+CBadxWDsF8mS99HzaSMAVcnAUET2E1cOegzszGH+Eti6JnKI9FNhuW0zlEY=" id="LPNoLPOWALinkPreview">https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/EPrint.pm#L755-L772</a><br>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1"></div>
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I don't think the 'revision' needs to be set.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
The 'action' value is defined as a set:&nbsp;<a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Fperl_lib%2FEPrints%2FDataObj%2FHistory.pm%23L120-L137&amp;data=05%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C24917ee7cded4358f27008da78a92567%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637954965110788748%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=04ypc9EMlGCE5Ri50i8a5iY9oi1H80K1UCDW3gGKotg%3D&amp;reserved=0" originalSrc="https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/History.pm#L120-L137" shash="cfdXP4MREtGYUKZPdcDrbxphY11xXxwBXodB2N978IMHLEZMJpAd7NrE5L/OdpjLzhWH0EX5oQrfCIVjYoZ0TTYn0Wf2SS5ze1dHxZEOd1yT1oGmfjcxynLrxpSv0gwk084mAqNRr+pssdkutCdNJd9ra4PrRK+6WtAJ1dxM0LE=" id="LPNoLPOWALinkPreview_1">https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/History.pm#L120-L137</a>&nbsp;<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
You could use the 'note' or 'other' action and include info in the 'details' field.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
An alternative approach would be to add a new value to the set of options (pushing a value onto the set), or redefining the history-&gt;action field using 'replace_core'. This would be beneficial if you ever needed to search the history dataset for that specific
 action.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;"><br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hope that gets you somewhere close to a working solution!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Cheers,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
John</div>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview_1 _EReadonly_1"></div>
<br>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Tomasz Neugebauer &lt;Tomasz.Neugebauer@concordia.ca&gt;<br>
<b>Sent:</b> 05 August 2022 22:20<br>
<b>To:</b> John Salter &lt;J.Salter@leeds.ac.uk&gt;; eprints-tech@ecs.soton.ac.uk &lt;eprints-tech@ecs.soton.ac.uk&gt;<br>
<b>Subject:</b> RE: [EP-tech] email notification on a specific metadata field value change</font>
<div>&nbsp;</div>
</div>
<style>
<!--
@font-face
        {font-family:SimSun}
@font-face
        {font-family:"Cambria Math"}
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
@font-face
        {}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Tahoma",sans-serif}
a:link, span.x_MsoHyperlink
        {color:#0563C1;
        text-decoration:underline}
a:visited, span.x_MsoHyperlinkFollowed
        {color:#954F72;
        text-decoration:underline}
p
        {margin-right:0cm;
        margin-left:0cm;
        font-size:10.0pt;
        font-family:"Tahoma",sans-serif}
p.x_MsoListParagraph, li.x_MsoListParagraph, div.x_MsoListParagraph
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Tahoma",sans-serif}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif}
span.x_EmailStyle20
        {font-family:"Tahoma",sans-serif;
        color:windowtext}
span.x_EmailStyle21
        {font-family:"Calibri",sans-serif;
        color:#1F497D}
span.x_EmailStyle23
        {font-family:"Tahoma",sans-serif;
        color:#1F497D}
.x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.x_WordSection1
        {}
ol
        {margin-bottom:0cm}
ul
        {margin-bottom:0cm}
-->
</style>
<div lang="EN-CA" link="#0563C1" vlink="#954F72">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">Thank you, John!&nbsp; Yes, that worked for me, the function looks like this:</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">$c-&gt;add_dataset_trigger( 'eprint', EPrints::Const::EP_TRIGGER_BEFORE_COMMIT, sub</span></p>
<p class="x_MsoNormal"><span style="color:#385723">{</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; my( %args ) = @_;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; my( $session, $eprint, $changed ) = @args{qw( repository dataobj changed )};</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp; if( exists $changed-&gt;{'field_of_interest'} )</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; {</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $old_val = $changed-&gt;{'field_of_interest'};</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $new_val = $eprint-&gt;get_value( 'field_of_interest');</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $user = $eprint-&gt;get_user();</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $username = EPrints::Utils::tree_to_utf8( $user-&gt;render_description() );</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # generate an email alert</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($old_val eq 'FALSE' &amp;&amp; $new_val eq 'TRUE') {</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print STDERR &quot;field_of_interest Changed from &quot;.$old_val.&quot; &quot;.$new_val.&quot; SEND NOTIFICATION EMAIL&quot;;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $message = $session-&gt;make_element( &quot;p&quot; );</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;appendChild( $session-&gt;make_text(&quot;Hello &quot; . $username.&quot;,&quot;));</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;appendChild($session-&gt;make_element( &quot;br&quot; ));</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;appendChild($session-&gt;make_element( &quot;br&quot; ));</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $title = $session-&gt;make_element( &quot;strong&quot; );</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $title-&gt;appendChild($session-&gt;make_text($eprint-&gt;get_value(&quot;title&quot;)));</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;appendChild($session-&gt;make_text( &quot;This email is to let you know that the following item you deposited: &quot;));</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;appendChild($title);</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;appendChild($session-&gt;make_text(&quot; (&quot;.$eprint-&gt;get_url().&quot;)&quot;));</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $message-&gt;appendChild($session-&gt;make_text(&quot; has changed in a specific way.&quot;));</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $ok = $user-&gt;mail(&quot;field_change_phrase&quot;,$message);</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
</p>
<p class="x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; }</span></p>
<p class="x_MsoNormal"><span style="color:#385723">}, priority =&gt; 73);</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">This works!&nbsp; The only thing is, I would like the action to register in the history for the item, any idea how would I do that?</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">Tomasz</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif"> John Salter &lt;J.Salter@leeds.ac.uk&gt;
<br>
<b>Sent:</b> August 3, 2022 5:37 PM<br>
<b>To:</b> eprints-tech@ecs.soton.ac.uk; Tomasz Neugebauer &lt;Tomasz.Neugebauer@concordia.ca&gt;<br>
<b>Subject:</b> RE: [EP-tech] email notification on a specific metadata field value change</span></p>
<p class="x_MsoNormal">&nbsp;</p>
<p><b><span style="color:#9C0000">Attention</span></b> This email originates from outside the concordia.ca domain. // Ce courriel provient de l'exterieur du domaine de concordia.ca<span style="font-size:12.0pt"></span></p>
<p>&nbsp;</p>
<div>
<p class="x_MsoNormal">&nbsp;</p>
</div>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">This sounds like a job for a commit trigger.<br>
There is a 'changed' hash - which has the old field values in it (the EPrint object already has the newer values in it).</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">You can check whether the field you are interested in is a key in the changed hash, and use that as a basis for sending an email.</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">NB The example below may not be syntactically correct. It's lashed together late at night (for me anyway), but I think you'll get the idea. Happy
 to answer questions about it in (my) morning!</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">Cheers,</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">John</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">$c-&gt;add_dataset_trigger( 'eprint', EPrints::Const::EP_TRIGGER_BEFORE_COMMIT, sub</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">{</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp; my( %args ) = @_;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp; my( $repo, $user, $changed ) = @args{qw( repository dataobj changed )};</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp;if( exists $changed-&gt;{'the_field_youre_interested_in'} )</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp; {</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;my $old_val = $changed-&gt;{'the_field_youre_interested_in'};</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; my $new_val = $eprint-&gt;get_value( 'the_field_youre_interested_in' );</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # generate an email alert</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;&nbsp; }</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">}, priority =&gt; 73);</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;&nbsp;
</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="x_MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">
<a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">eprints-tech-bounces@ecs.soton.ac.uk</a> [<a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk">mailto:eprints-tech-bounces@ecs.soton.ac.uk</a>]
<b>On Behalf Of </b>Tomasz Neugebauer via Eprints-tech<br>
<b>Sent:</b> 03 August 2022 22:18<br>
<b>To:</b> <a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a><br>
<b>Subject:</b> [EP-tech] email notification on a specific metadata field value change</span></p>
</div>
</div>
<p class="x_MsoNormal"><span lang="EN-GB" style="font-size:11.0pt">&nbsp;</span></p>
<div>
<div style="border:solid #8D3970 1.0pt; padding:9.0pt 9.0pt 9.0pt 9.0pt">
<p class="x_MsoNormal" style="line-height:16.5pt; background:#F7F9FA"><strong><span style="font-size:10.5pt; font-family:&quot;Calibri&quot;,sans-serif; color:#8D3970">CAUTION:</span></strong><span style="font-size:10.5pt; font-family:&quot;Calibri&quot;,sans-serif; color:#8D3970">
 This e-mail originated outside the University of Southampton. </span></p>
</div>
</div>
<div>
<p class="x_MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:11.0pt">Another question from me, I hope I don’t get blocked for posting too many!&nbsp;
</span></p>
<p class="x_MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:11.0pt">I would like to add an email notification that would be sent out to the depositor when a specific editor-only metadata field changes in a deposit.</span></p>
<p class="x_MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:11.0pt">What would be the best/easiest way to get that done?&nbsp;
</span></p>
<p class="x_MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:11.0pt">This method is the only way that comes to mind, but it seems complicated.&nbsp; Would I need to
</span></p>
<p class="x_MsoListParagraph" style="margin-bottom:12.0pt; text-indent:-18.0pt; background:white">
<span style="font-size:11.0pt"><span style="mso-list:Ignore">1.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;
</span></span></span><span style="font-size:11.0pt">add an item field with a date value,
</span></p>
<p class="x_MsoListParagraph" style="margin-bottom:12.0pt; text-indent:-18.0pt; background:white">
<span style="font-size:11.0pt"><span style="mso-list:Ignore">2.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;
</span></span></span><span style="font-size:11.0pt">use “automatic fields.pl” to insert a date of when the field changes into it whenver the field that I want monitored changes, and
</span></p>
<p class="x_MsoListParagraph" style="margin-bottom:12.0pt; text-indent:-18.0pt; background:white">
<span style="font-size:11.0pt"><span style="mso-list:Ignore">3.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;
</span></span></span><span style="font-size:11.0pt">run a batch script nightly to send the notification email to for all those items that have “today’s” date in the monitor field</span></p>
<p class="x_MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:11.0pt">Or could I use a trigger mechanism on this field to send out the email?&nbsp;
</span></p>
<p class="x_MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:11.0pt">Tomasz</span></p>
<p class="x_MsoNormal" style="margin-right:0cm; margin-bottom:12.0pt; margin-left:17.85pt; background:white">
<u><span lang="IT" style="font-size:9.0pt; font-family:&quot;Arial&quot;,sans-serif; color:purple"><span style="text-decoration:none">&nbsp;</span></span></u></p>
<p class="x_MsoNormal"><span style="font-size:11.0pt">&nbsp;</span></p>
</div>
</div>
</div>
</div>
</body>
</html>