<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Rodrigo,</p>
    <p>a wild guess: your outbound mappings in the resource are not
      setting the mandatory attributes, i.e. icfs:name, when adding new
      account. Could this be the case?<br>
    </p>
    Ivan<br>
    <br>
    <div class="moz-cite-prefix">On 08/30/2016 09:48 PM, Rodrigo Yanis
      wrote:<br>
    </div>
    <blockquote
cite="mid:CADu-59F_PETRMEa-9D+0iXuAmgqkFpSBT3Sw-J_0Fpsz9PY1Ow@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello everyone,
        <div><br>
        </div>
        <div>I'm currently trying to perform a call on a stored
          procedure in my Oracle DB through a SQLScript resource. The
          use case is as follows:</div>
        <div>1. The resource is assigned to the user X</div>
        <div>2. Resource performs a call to a stored procedure on the
          database, sending one of the user attributes as a parameter
          for the stored procedure to do its magic</div>
        <div>3. Stored procedure outputs a value, and its written into a
          different attribute on my midPoint user.</div>
        <div><br>
        </div>
        <div>I've tried to do this by modifying the CreateScript in the
          midPoint examples, here:</div>
        <div><a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/blob/master/samples/resources/scriptedsql/CreateScript.groovy">https://github.com/Evolveum/midpoint/blob/master/samples/resources/scriptedsql/CreateScript.groovy</a><br>
        </div>
        <div><br>
        </div>
        <div>The script I've come up with is the following:</div>
        <div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex"><font size="1"><a
                moz-do-not-send="true" href="http://log.info">log.info</a>("Entering
              "+action+" Script");<br>
              def sql = new Sql(connection);<br>
              try {<br>
                      sql.call("{? = call STORED_PROCEDURE(?,
              ?)}",[Sql.VARCHAR, attributes?.get("pidm")?.get(0),
              Sql.VARCHAR])<br>
                      {<br>
                              alias -> return alias<br>
                      };<br>
              }<br>
              catch(all) {<br>
                      log.error("Exception in Stored Procedure
              execution");<br>
              }<br>
              return "errorInCall";</font></blockquote>
        </div>
        <div>Stored procedure logic is out of the scope of this case.</div>
        <div><br>
        </div>
        <div>I've configured the resource so it maps the "pidm"
          attribute i'm requesting in my script to the user attribute in
          midPoint. I've also mapped "alias" as an inbound attribute to
          my attribute in midPoint.</div>
        <div><br>
        </div>
        <div>Does this scenario make any sense to you? Is this being
          approached correctly? Is there a way to perform a "set
          attribute" on the script itself?</div>
        <div><br>
        </div>
        <div>Right now I'm getting the following error in step 1. of the
          use case I described:</div>
        <div>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px
            0.8ex;border-left:1px solid
            rgb(204,204,204);padding-left:1ex"><font size="1">Error
              executing changes for (account (default) on
              <a class="moz-txt-link-freetext" href="resource:e1054471-b559-4f13-bc32-aec273c51e46(Banner">resource:e1054471-b559-4f13-bc32-aec273c51e46(Banner</a>
              Personas)): Couldn't add object. Schema violation: Schema
              violation during processing shadow: shadow: null
              (OID:null): Attempt to add shadow without any attributes:
              shadow:null(null)<br>
            </font><font size="1">com.evolveum.midpoint.util.exception.SchemaException:
              Couldn't add object. Schema violation: Schema violation
              during processing shadow: shadow: null (OID:null): Attempt
              to add shadow without any attributes: shadow:null(null)</font></blockquote>
          <div><br>
          </div>
          <div>Thanks in advance,</div>
        </div>
        <div>
          <div>
            <div class="gmail_signature"
              data-smartmail="gmail_signature">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div>
                      <div dir="ltr">
                        <div>
                          <div dir="ltr">
                            <div dir="ltr">
                              <div dir="ltr"><br>
                              </div>
                              <div dir="ltr"><font face="arial,
                                  helvetica, sans-serif"><b>Rodrigo
                                    Yanis.</b><br>
                                  <img moz-do-not-send="true"
                                    src="http://www.identicum.com/img/favicon.ico">Identicum
                                  S.A.<br>
                                </font>Jorge Newbery 3226<br>
                                Tel: +54 (11) 4824-9971<font
                                  face="arial, helvetica, sans-serif"><br>
                                  <a moz-do-not-send="true"
                                    href="mailto:ryanis@identicum.com"
                                    target="_blank"><font
                                      color="#0b5394">ryanis@identicum.com</font></a><br>
                                  <a moz-do-not-send="true"
                                    href="http://www.identicum.com/"
                                    target="_blank"><font
                                      color="#0b5394">www.identicum.com</font></a></font></div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Ivan Noris
Senior Identity Engineer
evolveum.com
</pre>
  </body>
</html>