<div dir="ltr"><div dir="ltr">Hi Vladislavs,</div><div dir="ltr"><br></div><div>is enought to put condition to your mapping</div><div><br></div><div><condition><br> <script><br> <code> // run this template only in new value, old value ignore <br>
boolean isNew = com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluationContext.getThreadLocal().isEvaluateNew() <br>
return isNew && !basic.isEmpty(
adGroup
)<br>
</code><br> </script><br></condition><br></div><div><br></div>Best regards,<div><br></div><div>Gustav</div><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">st 8. 4. 2020 o 19:39 Vladislavs Filipciks <<a href="mailto:vladislavs.filipciks@csolutions.lv">vladislavs.filipciks@csolutions.lv</a>> napísal(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Hello. Ty for reply. Unfortunately, further in execution I receive exception, that mapping is not possible on null object adGroup.<div dir="auto">I've tried several ways, for example if I remove this mapping from template, then mapping in resource works fine on account import - user is being created, with appropriate account and property adGroup filled nicely. I don't get it, why template mapping isn't working. I got another similar in OU template and it works nicely. </div><div dir="auto"><br></div><div dir="auto">I'll try to remove this user template and extension completely and import them once again.</div><div dir="auto"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">8 апр. 2020 г. 17:43 пользователь Pavol Mederly <<a href="mailto:mederly@evolveum.com" target="_blank">mederly@evolveum.com</a>> написал:<br type="attribution"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<p>Hello Vladislavs,</p>
<p>just a quick try: your template mapping should be executed twice
- once for "old" value of extension/adGroup and once for "new"
value of it. So maybe what you see in the log is the first
execution. Isn't there another execution, this time with the
expected value?<br>
</p>
<p>Best regards,<br>
</p>
<pre>Pavol Mederly
Software developer
<a href="http://evolveum.com" target="_blank">evolveum.com</a>
</pre>
<div>On 08/04/2020 16:34, Vladislavs
Filipciks wrote:<br>
</div>
<blockquote>
<div style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:rgb(0,0,0)">
<div>Hello.</div>
<div><br>
</div>
<div>I'm having trouble mapping user extended schema property to
another extended schema property during user import from
resource. The source extension/property is always being null
while object template is processed.</div>
<div>Probably I'm missing some additional config or something.
Could any one suggest/correct me? Config snips:</div>
<div><br>
</div>
<div>Resource:</div>
<div>
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:consolas,"courier new",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">attribute</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">ref</span><span style="color:rgb(128,128,128)">></span><span style="color:rgb(212,212,212)">ri:memberOf</span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">ref</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">inbound</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">expression</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">script</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">code</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> if(input != null){</span></div><div><span style="color:rgb(212,212,212)"> tmpdn = input;</span></div><div><span style="color:rgb(212,212,212)"> groupPath = tmpdn.substring(0, tmpdn.indexOf(",DC="));</span><span style="color:rgb(212,212,212)"> </span></div><div><span style="color:rgb(212,212,212)"> <a href="http://log.info" target="_blank">log.info</a>("-- adGroup from resource schemaHandling " + groupPath );</span></div><div><span style="color:rgb(212,212,212)"> return groupPath;</span></div><div><span style="color:rgb(212,212,212)"> }</span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">code</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">script</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">expression</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">target</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">path</span><span style="color:rgb(128,128,128)">></span><span style="color:rgb(212,212,212)">extension/adGroup</span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">path</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">target</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">inbound</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">attribute</span><span style="color:rgb(128,128,128)">></span></div></div>
</div>
<div><br>
</div>
<div>Extension schema:</div>
<div><br>
</div>
<div>
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:consolas,"courier new",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">xsd:complexType</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">name</span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(206,145,120)">"UserExtensionType"</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">xsd:annotation</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">xsd:appinfo</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">a:extension</span><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(156,220,254)">ref</span><span style="color:rgb(212,212,212)">=</span><span style="color:rgb(206,145,120)">"c:UserType"</span><span style="color:rgb(128,128,128)">/></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">xsd:appinfo</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">xsd:annotation</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">xsd:sequence</span><span style="color:rgb(128,128,128)">></span></div></div>
</div>
<div><br>
</div>
<div>User template that is being used with sync:</div>
<div><br>
</div>
<div>
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:consolas,"courier new",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"> <div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:consolas,"courier new",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">mapping</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">name</span><span style="color:rgb(128,128,128)">></span><span style="color:rgb(212,212,212)">Ad Group name mapping</span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">name</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">source</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">path</span><span style="color:rgb(128,128,128)">></span><span style="color:rgb(212,212,212)">extension/adGroup</span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">path</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">source</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">expression</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">script</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">code</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> <a href="http://log.info" target="_blank">log.info</a>('+++++++++++++++++ adGroup from user template ' + adGroup);</span></div><div><span style="color:rgb(212,212,212)"> if ((groupName = adGroup.split(",CN=")[0].substring(3))){</span></div><div><span style="color:rgb(212,212,212)"> return groupName.trim();</span></div><div><span style="color:rgb(212,212,212)"> }</span></div><div><span style="color:rgb(212,212,212)"> groupName = adGroup.split(",OU=")[0].substring(3);</span></div><div><span style="color:rgb(212,212,212)"> <a href="http://log.info" target="_blank">log.info</a>('++++++ gorupName from user template ' + groupName);</span></div><div><span style="color:rgb(212,212,212)"> return groupName.trim();</span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">code</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">script</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">expression</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">target</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">path</span><span style="color:rgb(128,128,128)">></span><span style="color:rgb(212,212,212)">extension/groupName</span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">path</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">target</span><span style="color:rgb(128,128,128)">></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">mapping</span><span style="color:rgb(128,128,128)">></span></div></div></div>
</div>
<div><br>
</div>
<div>Log:</div>
<div><br>
</div>
<div>
<div><span style="font-size:13.3333px">2020-04-08
17:31:28,495 [MODEL] [http-nio-8080-exec-4] INFO
(com.evolveum.midpoint.expression): -- adGroup from
resource schemaHandling CN=Midpoint Test Group,OU=Midpoint
Test OU,OU=CS_group_users</span></div>
<div><span style="font-size:13.3333px">2020-04-08
17:31:28,496 [MODEL] [http-nio-8080-exec-4] INFO
(com.evolveum.midpoint.expression): -- adGroup from
resource schemaHandling CN=Domain Admins,CN=Users</span></div>
<div><span style="font-size:13.3333px">2020-04-08
17:31:28,500 [MODEL] [http-nio-8080-exec-4] INFO
(com.evolveum.midpoint.expression): -- adOUContainer from
resource schemaHandling OU=Midpoint Test
OU,OU=CS_group_users</span></div>
<div><span style="font-size:13.3333px">2020-04-08
17:31:28,515 [MODEL] [http-nio-8080-exec-4] INFO
(com.evolveum.midpoint.expression): +++++++++++++++++
adGroup from user template null</span></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<p style="margin:0px;font-stretch:normal;font-size:18px;line-height:normal;font-family:arial"><b>Vladislavs
Fiļipčiks</b></p>
<p style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:arial">+371
6784 7766</p>
<p style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:arial"><b>SIA
“Corporate Solutions”</b></p>
<p style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:arial">Pērnavas
43A-9, Rīga, LV-1009</p>
<p style="margin:0px;font-stretch:normal;font-size:14px;line-height:normal;font-family:arial;color:rgb(128,127,127)"><span style="text-decoration:underline;color:rgb(153,153,153)"><a href="http://www.csolutions.lv/" style="color:rgb(153,153,153);text-decoration:underline" target="_blank">www.csolutions.lv</a></span><br>
</p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:arial;min-height:14px"><br>
<img src="https://drive.google.com/uc?export=view&id=1WuHLZnuvRtyBe4lBkMiUhpEYoRjH4eUH" width="140" height="46"></p>
<p style="margin:0px;font-stretch:normal;font-size:10px;line-height:normal;font-family:arial;color:rgb(76,76,76)"><span style="color:rgb(153,153,153)">Šis e-pasts un tā
pielikumā esošie dokumenti var saturēt ierobežotas
pieejamības informāciju, cita starpā fizisko personu
datus, kas adresēta tikai tā saņēmējam un izmantojama
tikai leģitīmiem mērķiem. Ja esat saņēmis šo e-pastu
kļūdas dēļ, vai nav pamatota mērķa ierobežotas pieejamības
informācijas, cita starpā fizisko personu datu, apstrādei,
Jums nav tiesību izmantot vai pārsūtīt šajā e-pastā un tam
pievienotajos dokumentos ietverto informāciju. Šādā
gadījumā nekavējoties neatgriezeniski izdzēsiet šo
e-pastu.</span></p>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
</div>
</blockquote></div><br></div>_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">s pozdravom<div><br></div><div>Gustáv Pálos</div></div></div></div>