[midPoint] How to compare old with new value in Midpoint

Pavol Mederly mederly at evolveum.com
Sat Aug 13 09:20:57 CEST 2022


Jean Michel,

there is a dirty hack that could be used as a last resort:

The properties *modelContext.focusContext.objectOld*, *.objectCurrent*, 
and *.objectNew* provide old, current, and new (expected) values of the 
focus object, respectively.

There you can find old/new values of the user property, and act upon them.

But it is strongly recommended to *NOT* 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.

The best way forward is to exploit supported midPoint features and - if 
needed - discuss with us about their potential extension to cover your 
needs.

Best regards,

-- 
Pavol Mederly
Software developer
evolveum.com

On 13/08/2022 00:48, Pavol Mederly via midPoint wrote:
> Subject:
> Re: [midPoint] How to compare old with new value in Midpoint
> From:
> Pavol Mederly via midPoint <midpoint at lists.evolveum.com>
> Date:
> 13/08/2022, 00:48
>
> To:
> midpoint at lists.evolveum.com
> CC:
> Pavol Mederly <mederly at evolveum.com>
>
>
> Hello Jean Michel,
>
> midPoint transparently works with old and new values, as explained 
> e.g. here: 
> https://docs.evolveum.com/midpoint/reference/expressions/mappings/mapping-relativity/. 
>
>
> Isn't that sufficient for you? What is the use case where you need to 
> explicitly access (compare) old and new values?
>
> -- 
>
> 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.
>
> This feature is called "Policy rules". Although it works quite well, 
> it is not documented enough (yet). See 
> https://docs.evolveum.com/midpoint/reference/roles-policies/policy-rules/. 
>
>
> -- 
>
> Best regards,
>
> -- 
> Pavol Mederly
> Software developer
> evolveum.com
>
> On 12/08/2022 15:19, Jean Michel Santos via midPoint wrote:
>> Hi Community,
>>
>> 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.
>>
>> Could you please help me out in this question?
>>
>> Thanks in advance!
>>
>> Best Regards,
>>
>> Jean Michel Santos
>> EbZ Tecnologia
>> _______________________________________________
>> midPoint mailing list
>> midPoint at lists.evolveum.com
>> https://lists.evolveum.com/mailman/listinfo/midpoint
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220813/d01583f1/attachment.htm>


More information about the midPoint mailing list