<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">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Thanks again, John, that worked perfectly!&nbsp;&nbsp;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I really appeciate it.&nbsp;&nbsp;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I ended up using the &quot;other&quot; action and pushed some info in the details.</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">
Tomasz</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">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div></div>
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div style="font-family:Tahoma; font-size:13px">
<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33); background:white">
<span lang="FR-CA" style="font-size:8pt; font-family:&quot;Courier New&quot;; color:rgb(166,166,166)">________________________________________________</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 12pt 17.85pt; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33); background:white">
<span lang="FR-CA" style="font-size:9pt; font-family:Arial,sans-serif; color:black">Tomasz Neugebauer<span style=""><br>
</span><span style="background-color:rgb(255,255,255); display:inline!important">Senior Librarian | Bibliothécaire titulaire
</span><span style="margin:0px; background-color:rgb(255,255,255)"><br>
</span>Digital Projects &amp; Systems Development Librarian / Bibliothécaire des Projets Numériques &amp; Développement de Systèmes<br>
Concordia University / Université Concordia</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 12pt 17.85pt; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33); background:white">
<span lang="FR-CA" style="font-size:9pt; font-family:Arial,sans-serif; color:black">Tel. / Tél. 514-848-2424 ext. / poste 7738<br>
Email / courriel:&nbsp;</span><a tabindex="0" href="mailto:tomasz.neugebauer@concordia.ca" target="_blank"><span lang="FR-CA" style="font-size:9pt; font-family:Arial,sans-serif; color:blue">tomasz.neugebauer@concordia.ca</span></a><span style="font-size:9pt; font-family:Arial,sans-serif; color:black"></span></p>
<p class="MsoNormal" style="margin:0cm 0cm 12pt 17.85pt; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33); background:white">
<span lang="FR-CA" style="font-size:9pt; font-family:Arial,sans-serif; color:black">Mailing address / adresse postale:&nbsp;1455 De Maisonneuve Blvd. W.,&nbsp;LB-540-03, Montreal, Quebec H3G 1M8<br>
Street address / adresse municipale: 1400&nbsp;De Maisonneuve Blvd. W.,&nbsp;LB-540-03, Montreal, Quebec H3G 1M8</span></p>
<p class="MsoNormal" style="margin:0cm 0cm 12pt 17.85pt; font-size:11pt; font-family:Calibri,sans-serif; color:rgb(33,33,33); background:white">
<span class="MsoHyperlink" style="color:rgb(5,99,193); text-decoration:underline"><span lang="IT" style="font-size:9pt; font-family:Arial,sans-serif; color:purple">library.concordia.ca</span></span></p>
</div>
</div>
</div>
</div>
</div>
<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> John Salter &lt;J.Salter@leeds.ac.uk&gt;<br>
<b>Sent:</b> Sunday, August 7, 2022 3:15 PM<br>
<b>To:</b> Tomasz Neugebauer &lt;Tomasz.Neugebauer@concordia.ca&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>
<div>
<p><span style="font-weight:bold; color:rgb(156,0,0)">Attention</span> This email originates from outside the concordia.ca domain. // Ce courriel provient de l'exterieur du domaine de concordia.ca</p>
<p><br>
</p>
<div><br>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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%7C92d53d546a3b412df67108da7add5aab%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637957388371433126%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=0V5cWNSNVBZ3HenUnJPq66uIgEKgXBcQVpXJ%2B2ViPIQ%3D&amp;reserved=0" originalSrc="https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/EPrint.pm#L755-L772" shash="MymkQ+HQRUd5SHqjpQJM/OxP7rpa25xyEi54Up1m3gaXdfr8PKE826yxkQavZjhvqGZebgRbJoA0z0Zb/4NOy6MyrxlnEBV6w5jpzQEZeDKi6xXQLXWuKQlHtRrFASoz5zgD8FBh9eehec9TKdFQ7j86bNmCsNbr+l8ZQvRw5y0=" originalsrc="https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/EPrint.pm#L755-L772" shash="p4AX3YD/1oAkjDyGsQ5wWfRYlJhktkhhqRVWusM+bKtXruli+KtnP214jyvupxGhTESUJ+t2pC9AB+5SJelN5m7UCTlftdm2CPqeR416Gr2i7RA+wPX7c8L2yLViINW3ao6t/LAQrMn4CYFJhr/jfGzAhjvNFD0xcqpcWlN/10o=" id="LPNoLPOWALinkPreview">https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/EPrint.pm#L755-L772</a><br>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview x__EReadonly_1">
</div>
<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I don't think the 'revision' needs to be set.</div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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%7C92d53d546a3b412df67108da7add5aab%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637957388371433126%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=E5jvG0KmjIcVk9hSq2O6vAdNP7QyiIBVUslhIK48qN4%3D&amp;reserved=0" originalSrc="https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/History.pm#L120-L137" shash="oVAi3Azf6/NbMGMpqc7KCFPW9xHPaVGdr4Ga8WQHJqep5n4+YTXsYhiy/3tf5NsZHtBjdNoTpVFR+h5CuNhbTDHKkzyW+2q0LacYkExfnGGdNoCuPWwRi7P5yhFHOOlopyX7K95xPAVQoks68e3m08RTrpGnl/FwbBQnqxdhyyQ=" originalsrc="https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/History.pm#L120-L137" shash="C+YK9fuR85zoC8iHGhTF9XoreJeDafGhzixjNwbBDevbqJ0en9ufaV4oD1Dqwx9hLAY/RT9PqUkqVuXf5uKDiTHSS0YEH+71oafS68gH78XAo2G5j6daMA03rmZVgVlOcd8dpyv8+7A+8aRMA18lA1fLe3B+Y7CLHECL/DEEml8=" id="LPNoLPOWALinkPreview_1">https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/History.pm#L120-L137</a>&nbsp;<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
You could use the 'note' or 'other' action and include info in the 'details' field.</div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
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 class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt"><br>
</span></div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hope that gets you somewhere close to a working solution!</div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Cheers,</div>
<div class="x_elementToProof" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
John</div>
<div class="x__Entity x__EType_OWALinkPreview x__EId_OWALinkPreview_1 x__EReadonly_1">
</div>
<br>
<div id="x_appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><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}
p.x_x_MsoNormal, li.x_x_MsoNormal, div.x_x_MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Tahoma",sans-serif}
a:link, span.x_x_MsoHyperlink
        {color:#0563C1;
        text-decoration:underline}
a:visited, span.x_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_x_MsoListParagraph, li.x_x_MsoListParagraph, div.x_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_x_msonormal0, li.x_x_msonormal0, div.x_x_msonormal0
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif}
span.x_x_EmailStyle20
        {font-family:"Tahoma",sans-serif;
        color:windowtext}
span.x_x_EmailStyle21
        {font-family:"Calibri",sans-serif;
        color:#1F497D}
span.x_x_EmailStyle23
        {font-family:"Tahoma",sans-serif;
        color:#1F497D}
.x_x_MsoChpDefault
        {font-size:10.0pt}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
ol
        {margin-bottom:0cm}
ul
        {margin-bottom:0cm}
-->
</style>
<div lang="EN-CA">
<div class="x_x_WordSection1">
<p class="x_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_x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">$c-&gt;add_dataset_trigger( 'eprint', EPrints::Const::EP_TRIGGER_BEFORE_COMMIT, sub</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">{</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; my( %args ) = @_;</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; my( $session, $eprint, $changed ) = @args{qw( repository dataobj changed )};</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp; if( exists $changed-&gt;{'field_of_interest'} )</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; {</span></p>
<p class="x_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_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_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_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_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_x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # generate an email alert</span></p>
<p class="x_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_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_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_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_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_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_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_x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_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_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_x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_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_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_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_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_x_MsoNormal"><span style="color:#385723">&nbsp;</span></p>
<p class="x_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_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_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_x_MsoNormal"><span style="color:#385723">&nbsp;&nbsp;&nbsp; }</span></p>
<p class="x_x_MsoNormal"><span style="color:#385723">}, priority =&gt; 73);</span></p>
<p class="x_x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_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_x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">Tomasz</span></p>
<p class="x_x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_x_MsoNormal"><span style="font-size:11.0pt; color:#1F497D">&nbsp;</span></p>
<p class="x_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_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_x_MsoNormal">&nbsp;</p>
</div>
<p class="x_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_x_MsoNormal" style="margin-bottom:12.0pt; background:white"><span style="font-size:11.0pt">Tomasz</span></p>
<p class="x_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_x_MsoNormal"><span style="font-size:11.0pt">&nbsp;</span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>