<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello Rodrigo,</p>
    <p>your bulk action seems to be quite correct, provided you have
      declared all your namespaces (c, q). I don't know the context,
      i.e. if you copy-and-pasted the script code from a task object, or
      entered it via GUI ("Bulk actions"). it would be also helpful if
      you would paste more details, i.e. the actual stack trace of the
      SchemaException; or at least the inner exception. It describes the
      reason of the problem.</p>
    <p>I'd like to say that:</p>
    <ol>
      <li>Even after fixing the schema exception, the problem is that
        bulk actions (and the "search" bulk action in particular) do not
        currently support expressions in filters. I.e. only constant
        values are allowed. I have created a jira for it (<a
          href="https://jira.evolveum.com/browse/MID-3364">MID-3364</a>).
        It is not too much work to implement, but we are very busy these
        days/weeks; so I marked it as "sposoring needed". You could
        contact Igor or Radovan for more information on this.</li>
      <li>There are some workarounds possible, however. For example, a
        task can be created and started via SOAP or REST. Or even a
        specific bulk action can be executed via SOAP. So you could run
        your actions (with pre-calculated "current date" value)
        regularly from outside midPoint. (Not very clean, but possible.)<br>
      </li>
      <li>But the most important of all: midPoint has a native mechanism
        for disabling users (as well as roles, orgs, or assignments)
        after given period of time: activation. Instead of using
        extension/metaEndDate, you could use activation/validTo, and
        your users will be disabled automatically. Please see wiki <a
          href="https://wiki.evolveum.com/display/midPoint/Activation">article
          on activation</a> for more information.<br>
      </li>
    </ol>
    <p>Best regards,<br>
    </p>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 22.08.2016 21:00, Rodrigo Yanis
      wrote:<br>
    </div>
    <blockquote
cite="mid:CADu-59ELH=JVK4wN8cgD1DLpZcO++72OogS9r+iRHZzA2gdUkQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello everyone,
        <div><br>
        </div>
        <div>I'm currently trying to build a task to disable users when
          they reach their termination date in midPoint (expressed on a
          custom attribute as dd/MM/yyyy).</div>
        <div><br>
        </div>
        <div>I'm having difficulties defining a search filter that would
          evaluate equality to a value returned by a Groovy script, the
          code is the following:</div>
        <div><br>
        </div>
        <div>
          <div><scext:executeScript xmlns:scext="<a
              moz-do-not-send="true"
href="http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3">http://midpoint.evolveum.com/xml/ns/public/model/scripting/extension-3</a>"></div>
          <div>                <s:search xmlns:s="<a
              moz-do-not-send="true"
              href="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3">http://midpoint.evolveum.com/xml/ns/public/model/scripting-3</a>"></div>
          <div>                   
            <s:type>c:UserType</s:type></div>
          <div>                    <s:searchFilter></div>
          <div>                        <q:equal></div>
          <div>                           
            <q:path>extension/metaEndDate</q:path></div>
          <div>                            <c:expression></div>
          <div>                                <c:script></div>
          <div>                                    <c:code></div>
          <div>                                        def dateTime =
            new Date().format( 'dd/MM/yyyy' );</div>
          <div>                                        return
            dateTime.toString();</div>
          <div>                                    </c:code></div>
          <div>                                </c:script></div>
          <div>                            </c:expression></div>
          <div>                        </q:equal></div>
          <div>                    </s:searchFilter></div>
          <div>                    <s:action></div>
          <div>                       
            <s:type>disable</s:type></div>
          <div>                    </s:action></div>
          <div>                </s:search></div>
          <div>            </scext:executeScript></div>
          <div><br>
          </div>
          <div>Error (execution time) I recieve is the following: <span
              style="color:rgb(51,51,51);font-family:"Source Sans
              Pro","Helvetica
Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(249,249,249)">Couldn't
              execute script: Couldn't parse object filter due to schema
              exception</span></div>
          <div><span style="color:rgb(51,51,51);font-family:"Source
              Sans Pro","Helvetica
Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;background-color:rgb(249,249,249)"><br>
            </span></div>
          I understand this must be related to namespaces definitions. I
          couldn't find any example of what i'm trying to do either.</div>
        <div><br>
        </div>
        <div>Do you know if this is possible?</div>
        <div><br>
        </div>
        <div>Thanks.<br>
          <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>
  </body>
</html>