<div dir="ltr">Hi,<div><br></div><div>try something like this for example in object template:</div><div><pre class="gmail-code gmail-highlight" lang="xml"><mapping><br> <name>Mapping User to Org by script</name><br> <source><br> <path>organizationalUnit</path><br> </source><br> <br> <expression><br> <script><br> <code><![CDATA[<br> import java.text.SimpleDateFormat;<br> import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;<br> import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;<br> import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;<br> import com.evolveum.midpoint.schema.constants.SchemaConstants;<br> import java.util.ArrayList;<br><br> private AssignmentType createAssignment(String oid) {<br> ObjectReferenceType orgRef = new ObjectReferenceType();<br> orgRef.setOid(oid)<br> orgRef.setRelation(SchemaConstants.ORG_DEFAULT)<br> orgRef.setType(OrgType.COMPLEX_TYPE);<br><br> AssignmentType assignment = new AssignmentType();<br> assignment.setTargetRef(orgRef);<br> return assignment;<br> }<br><br> ArrayList<AssignmentType> assignmentList = new ArrayList();<br><br> org = midpoint.getOrgByName(organizationalUnit);<br> if (org != null) {<br> assignmentList.add(createAssignment(org?.oid));<br> }<br><br> return assignmentList;<br> ]]></code><br> </script><br> </expression><br><br> <target><br> <path>assignment</path><br> </target><br></mapping><br><br>but similar things you can do also over assignmentTargetSearch</pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">st 26. 1. 2022 o 18:44 Hsin-Fang Hsu via midPoint <<a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</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 lang="en-CH" style="overflow-wrap: break-word;">
<div class="gmail-m_1945609371672415010WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt">Does anyone know how to set the orgRef of an assignment in xml?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt">This is what I tried. But apparently it’s just read the assignment but won’t update it.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt"><img width="402" height="178" style="width: 4.1916in; height: 1.8583in;" id="gmail-m_1945609371672415010Picture_x0020_1" src="cid:17e99aabb294cff311"></span><span lang="EN-US" style="font-size:14pt"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt">Many thanks for your help in advance!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt">Best regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:14pt">Hsin-Fang<u></u><u></u></span></p>
</div>
</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>