<div dir="ltr"><div dir="ltr"><div><div>Very good, thanks again.</div><div>I will analyze and adapt it for my case.</div></div><div><br></div><div>Regards</div><div>Gus</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter., 20 de out. de 2020 às 18:12, Ethan Kromhout via midPoint <<a href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a>> escreveu:<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>
    <p>In my case, each of the unique accounts has a userName attribute,
      so I pull that out and use it as the tag, but you can also just
      let midPoint generate the tag. The below is from my account kind
      in schemahandling, I'm using grovy in my case to pull the needed
      userName from an incoming json object.<br>
    </p>
    <p> <multiplicity><br>
                      <maxOccurs>unbounded</maxOccurs><br>
                      <tag><br>
                          <expression><br>
                              <script
      xmlns:xsi=<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a>
      xmlns:c=<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
      xsi:type="c:ScriptExpressionEvaluatorType"><br>
                                  <code><br>
                                   import groovy.json.JsonSlurper<br>
                                  userNameString =
      basic.getAttributeValue(projection, "userName");<br>
                                  jsonSlurper = new JsonSlurper()<br>
                                  userNameJson =
      jsonSlurper.parseText(userNameString)<br>
                                  <a href="http://log.info" target="_blank">log.info</a>('userName =
      {}',userNameJson.userName)<br>
                                  return userNameJson.userName<br>
                                </code><br>
                              </script><br>
                          </expression><br>
                      </tag><br>
                  </multiplicity></p>
    <p>Then later I do something similar to pull out the primary
      username, and store that in an extension property "loginId". For
      your case you probably can just use a condition, and not worry
      about groovy.</p>
    <p><inbound id="19"><br>
                          <source><br>
                              <name>loginId</name><br>
                              <c:path
xmlns:uncPerson=<a href="http://unc.edu/xml/ns/uncPerson" target="_blank">"http://unc.edu/xml/ns/uncPerson"</a>>$user/extension/uncPerson:logonId</c:path><br>
                          </source><br>
                          <expression><br>
                              <script
      xmlns:xsi=<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">"http://www.w3.org/2001/XMLSchema-instance"</a>
      xmlns:c=<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3" target="_blank">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
      xsi:type="c:ScriptExpressionEvaluatorType"><br>
                                  <code><br>
                                   import groovy.json.JsonSlurper<br>
                                  jsonSlurper = new JsonSlurper()<br>
                                  userNameJson =
      jsonSlurper.parseText(input)<br>
                                  <a href="http://log.info" target="_blank">log.info</a>('userName =
      {}',userNameJson.userName)<br>
                                 
      if(userNameJson.type.equals('PRIMARY')) {<br>
                                     return userNameJson.userName<br>
                                  }<br>
                                  else {<br>
                                     return loginId<br>
                                  }<br>
                                </code><br>
                              </script><br>
                          </expression><br>
                          <target><br>
                              <c:path
xmlns:uncPerson=<a href="http://unc.edu/xml/ns/uncPerson" target="_blank">"http://unc.edu/xml/ns/uncPerson"</a>>$user/extension/uncPerson:logonId</c:path><br>
                          </target><br>
                      </inbound></p>
    <p>I needed to return the existing value of loginId so that I
      wouldn't get a null loginId when processing the non-primary
      account.</p>
    <p>Full resource definition is attached in case that is useful. The
      scim service it connects to is a UNC proprietary service, so that
      may not add much value to the above. I'd forgotten, but the
      correlation expression is using a different attribute of the
      account, one that is unique per user, not per account. I think
      that probably always needs to be the case when doing correlation
      with a multiaccount resource.<br>
    </p>
    <p>Ethan<br>
    </p>
    <p><br>
    </p>
    <div>On 10/20/20 4:33 PM, Gus Lou via
      midPoint wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">Hi Ethan<br>
          <div>Thank you for share, I would like to see your approach.</div>
          <div>
            <div>I will study the link you recommended as well.</div>
            <div>Thank you very much.</div>
          </div>
          <div>Gus</div>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Em ter., 20 de out. de 2020 às
          17:20, Ethan Kromhout via midPoint <<a href="mailto:midpoint@lists.evolveum.com" target="_blank">midpoint@lists.evolveum.com</a>>
          escreveu:<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>
            <p>I have a situation that is similar, though perhaps not
              quite the same, where one of my source systems has
              multiple accounts for some users. In my case there primary
              and secondary accounts for some users, and then sometimes
              accounts can be considered inactive. I used the method
              discussed here <a href="https://wiki.evolveum.com/display/midPoint/Multiaccounts+HOWTO" target="_blank">https://wiki.evolveum.com/display/midPoint/Multiaccounts+HOWTO</a>
              to create tagged shadows for each of the accounts, then in
              schemahandling I select the primary account record to
              store in a user attribute that I use later in correlation.</p>
            <p>I can share some config snippets if the multiaccount
              approach sounds useful.</p>
            <p>Thanks,</p>
            <p>Ethan<br>
            </p>
            <div>On 10/20/20 2:57 PM, Gus Lou via midPoint wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">Hi Guys
                    <div><br>
                    </div>
                    <div>
                      <div>Has anyone here ever had to deal with unique
                        attributes (dupplicate) from the HR base?</div>
                      <div>I explain, in my human resources system the
                        same person can have more than one record, with
                        the status of hired and fired.</div>
                      <div>When I run the synchronization task, the MP
                        displays the error of unique attribute value
                        111.111 is not unique in Data.csv</div>
                      <div>I would like to apply some kind of filter to
                        process only the record with hired status in
                        case of duplicate records.</div>
                    </div>
                    <div><br>
                    </div>
                    <div>
                      <div>I am studying the information on Correlation
                        Expression to try to achieve this goal</div>
                      <div><a href="https://wiki.evolveum.com/display/midPoint/Correlation+and+Confirmation+Expressions" target="_blank">https://wiki.evolveum.com/display/midPoint/Correlation+and+Confirmation+Expressions</a></div>
                    </div>
                    <div><br>
                    </div>
                    <div>Best Regards</div>
                    <div><br>
                    </div>
                    <div>Gus</div>
                  </div>
                </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>
          _______________________________________________<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>
      <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>

_______________________________________________<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>