<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Jean Michel,</p>
<p>there is a dirty hack that could be used as a last resort:</p>
<p>The properties <b>modelContext.focusContext.objectOld</b>, <b>.objectCurrent</b>,
and <b>.objectNew</b> provide old, current, and new (expected)
values of the focus object, respectively.</p>
<p>There you can find old/new values of the user property, and act
upon them.</p>
<p>But it is strongly recommended to <b>NOT</b> do so. Among the
reasons is that it creates the dependency of your design on the
internal midPoint workings that can change anytime. Also, the use
of these undocumented/internal mechanisms may provide unexpected
results in some situations.</p>
<p>The best way forward is to exploit supported midPoint features
and - if needed - discuss with us about their potential extension
to cover your needs.<br>
</p>
<p>Best regards,<br>
</p>
<pre class="moz-signature" cols="72">--
Pavol Mederly
Software developer
evolveum.com</pre>
<div class="moz-cite-prefix">On 13/08/2022 00:48, Pavol Mederly via
midPoint wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1e5136ef-e566-9b58-1fa9-7ecdd4c17ff7@evolveum.com">
<table class="moz-header-part1 moz-main-header" width="100%"
cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<div class="moz-header-display-name"
style="display:inline;">Subject: </div>
Re: [midPoint] How to compare old with new value in
Midpoint</td>
</tr>
<tr>
<td>
<div class="moz-header-display-name"
style="display:inline;">From: </div>
Pavol Mederly via midPoint
<a class="moz-txt-link-rfc2396E" href="mailto:midpoint@lists.evolveum.com"><midpoint@lists.evolveum.com></a></td>
</tr>
<tr>
<td>
<div class="moz-header-display-name"
style="display:inline;">Date: </div>
13/08/2022, 00:48</td>
</tr>
</tbody>
</table>
<table class="moz-header-part2 moz-main-header" width="100%"
cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td>
<div class="moz-header-display-name"
style="display:inline;">To: </div>
<a class="moz-txt-link-abbreviated" href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a></td>
</tr>
<tr>
<td>
<div class="moz-header-display-name"
style="display:inline;">CC: </div>
Pavol Mederly <a class="moz-txt-link-rfc2396E" href="mailto:mederly@evolveum.com"><mederly@evolveum.com></a></td>
</tr>
</tbody>
</table>
<br>
<div class="moz-text-flowed" style="font-family: -moz-fixed;
font-size: 14px;" lang="x-unicode">Hello Jean Michel,
<br>
<br>
midPoint transparently works with old and new values, as
explained e.g. here: <a class="moz-txt-link-freetext"
href="https://docs.evolveum.com/midpoint/reference/expressions/mappings/mapping-relativity/"
moz-do-not-send="true">https://docs.evolveum.com/midpoint/reference/expressions/mappings/mapping-relativity/</a>.
<br>
<br>
Isn't that sufficient for you? What is the use case where you
need to explicitly access (compare) old and new values?
<br>
<br>
--
<br>
<br>
Just for completeness, midPoint can process rules like "If a
user property changed from state S1 to state S2, execute action
A". The states can be specified as concrete values, or using
arbitrary expression.
<br>
<br>
This feature is called "Policy rules". Although it works quite
well, it is not documented enough (yet). See <a
class="moz-txt-link-freetext"
href="https://docs.evolveum.com/midpoint/reference/roles-policies/policy-rules/"
moz-do-not-send="true">https://docs.evolveum.com/midpoint/reference/roles-policies/policy-rules/</a>.
<br>
<br>
--
<br>
<br>
Best regards,
<br>
<br>
<div class="moz-txt-sig"><span class="moz-txt-tag">-- <br>
</span>Pavol Mederly
<br>
Software developer
<br>
evolveum.com
<br>
<br>
On 12/08/2022 15:19, Jean Michel Santos via midPoint wrote:
<br>
<blockquote type="cite" style="color: #007cff;">Hi Community,
<br>
<br>
In some cases, we need to compare the old and the new
value(s) from an attribute to make a decision, I saw that
when we're tracing in a mapping, we're able to see both
values in the log. However, I don't know yet how to get
those values inside a expression or condition and make a way
to compare then.
<br>
<br>
Could you please help me out in this question?
<br>
<br>
Thanks in advance!
<br>
<br>
Best Regards,
<br>
<br>
Jean Michel Santos
<br>
EbZ Tecnologia
<br>
_______________________________________________
<br>
midPoint mailing list
<br>
<a class="moz-txt-link-abbreviated moz-txt-link-freetext"
href="mailto:midPoint@lists.evolveum.com"
moz-do-not-send="true">midPoint@lists.evolveum.com</a>
<br>
<a class="moz-txt-link-freetext"
href="https://lists.evolveum.com/mailman/listinfo/midpoint"
moz-do-not-send="true">https://lists.evolveum.com/mailman/listinfo/midpoint</a>
<br>
</blockquote>
_______________________________________________
<br>
midPoint mailing list
<br>
<a class="moz-txt-link-abbreviated moz-txt-link-freetext"
href="mailto:midPoint@lists.evolveum.com"
moz-do-not-send="true">midPoint@lists.evolveum.com</a>
<br>
<a class="moz-txt-link-freetext"
href="https://lists.evolveum.com/mailman/listinfo/midpoint"
moz-do-not-send="true">https://lists.evolveum.com/mailman/listinfo/midpoint</a>
<br>
</div>
</div>
</blockquote>
</body>
</html>