WorkOrder driver does not update the DueDate when RepeatInterval is set

  • 7008391
  • 17-Apr-2011
  • 26-Apr-2012

Environment


Novell Identity Manager 3.5.1
Novell Identity Manager 3.6.1
Novell Identity Manager 4.0

Situation

When the status of an WorkOrder object is set to 'pending' the object is evaluated the first time without an issue. However it does not increment the DirXML-DueDate by the appropriate value set in the DirXML-nwoRepeatInterval attribute and will run again at the next polling interval. If the WorkOrder object actually creates a WorkToDo object due to the driver logic, the next poll will give a -606 error (because the WorkToDo object already exists) and set the DirXML-nwoStatus to error. That will prevent the WorkOrder object from being processed again.

Resolution

Issue reported to engineering.

It is possible to perform a work-around in policy to update the attribute. A sample logic for the work-around (that needs to have the conditions changed to match your environment) is provided below.

Create a new DirXML-Script policy on the WorkOrder's driver Input transformation policy set. Replace the XML of that policy with the one below:

<?xml version="1.0" encoding="UTF-8"?>
<policy>
    <rule>
        <description>Save WorkOrderDN</description>
        <conditions>
            <and>
                <if-operation mode="case" op="equal">add</if-operation>
                <if-class-name mode="nocase" op="equal">WorkOrderToDo</if-class-name>
                <if-op-attr name="WorkOrderDn" op="available"/>
            </and>
        </conditions>
        <actions>
            <do-set-op-property name="workorderdn">
                <arg-string>
                    <token-op-attr name="WorkOrderDn"/>
                </arg-string>
            </do-set-op-property>
            <do-set-local-variable name="object-dn" scope="policy">
                <arg-string>
                    <token-op-property name="workorderdn"/>
                </arg-string>
            </do-set-local-variable>
            <do-set-op-property name="currentduedate">
                <arg-string>
                    <token-dest-attr class-name="DirXML-WorkOrder" name="DirXML-DueDate">
                        <arg-dn>
                            <token-local-variable name="object-dn"/>
                        </arg-dn>
                    </token-dest-attr>
                </arg-string>
            </do-set-op-property>
            <do-set-op-property name="repeatinterval">
                <arg-string>
                    <token-dest-attr class-name="DirXML-WorkOrder" name="DirXML-nwoRepeatInterval">
                        <arg-dn>
                            <token-local-variable name="object-dn"/>
                        </arg-dn>
                    </token-dest-attr>
                </arg-string>
            </do-set-op-property>
        </actions>
    </rule>
</policy>

Create a new DirXML-Script policy on the WorkOrder's driver Output transformation policy set. Replace the XML of that policy with the one below:

<?xml version="1.0" encoding="UTF-8"?>
<policy>
    <rule>
        <description>Update DueDate if necessary</description>
        <conditions>
            <and>
                <if-operation mode="case" op="equal">status</if-operation>
                <if-xml-attr mode="nocase" name="level" op="equal">success</if-xml-attr>
                <if-op-property name="workorderdn" op="available"/>
            </and>
        </conditions>
        <actions>
            <do-set-local-variable name="current-duedate" scope="policy">
                <arg-string>
                    <token-op-property name="currentduedate"/>
                </arg-string>
            </do-set-local-variable>
            <do-set-local-variable name="repeat-interval" scope="policy">
                <arg-string>
                    <token-op-property name="repeatinterval"/>
                </arg-string>
            </do-set-local-variable>
            <do-set-local-variable name="update-duedate" scope="policy">
                <arg-string>
                    <token-xpath expression="$current-duedate + ( $repeat-interval * 60 )"/>
                </arg-string>
            </do-set-local-variable>
            <do-set-src-attr-value class-name="DirXML-WorkOrder" name="DirXML-DueDate">
                <arg-dn>
                    <token-op-property name="workorderdn"/>
                </arg-dn>
                <arg-value type="string">
                    <token-local-variable name="update-duedate"/>
                </arg-value>
            </do-set-src-attr-value>
        </actions>
    </rule>
</policy>

  Save, deploy and test. Depending on the customizations in your WorkOrder driver you may need to adjust the policy's conditions so that they won't be triggered in situations other than the issue being addressed.