
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
I am trying add or inject additional elements into the modify-attr output
<modify-attr attr-name="ExternalId">
<add-value>
<value timestamp="1577168497#1" type="string">111111</value>
</add-value>
</modify-attr>
The required output is
<modify-attr attr-name="ExternalId">
<add-value>
<value timestamp="1577168497#1" type="structured">
<component name="value">111111</component>
<component name="type">organization</component>
</value>
</add-value>
</modify-attr>
I guessed that I have to use Append XML Element and Set XML Attribute to construct this, but I am really no clue on how to write this.
Anyone to help ?
Regards,
Keng
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Like Alex and Rob suggested, Reformat op attr is a way better choice. You can use a special local variable called current-value that only works inside reformat op attr, and if there is more than one op attr value, then it implicitly loops over all the values and does the same thing to each of them.
So set the type to oStructured, and then for your components define them. I mocked it up simply as this:
<do-reformat-op-attr name="ExternalId">
<arg-value type="structured">
<arg-component name="value">
<token-local-variable name="current-value"/>
</arg-component>
<arg-component name="type">
<token-text xml:space="preserve">organization</token-text>
</arg-component>
</arg-value>
</do-reformat-op-attr>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Yes you could do this with a strip by xpath, then add elements then add text or you could justuse the reformat operation attribute to reformat the attribute from String to Structured


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I can give one of the simple options:
Policy:
<rule>
<description>Adding elements to modify-attr</description>
<conditions>
<and>
<if-op-attr name="ExternalId" op="available"/>
</and>
</conditions>
<actions>
<do-set-local-variable name="lvExternalId" scope="policy">
<arg-string>
<token-op-attr name="ExternalId"/>
</arg-string>
</do-set-local-variable>
<do-strip-op-attr name="ExternalId"/>
<do-set-dest-attr-value name="ExternalId">
<arg-value type="structured">
<arg-component name="value">
<token-local-variable name="lvExternalId"/>
</arg-component>
<arg-component name="type">
<token-text xml:space="preserve">organization</token-text>
</arg-component>
</arg-value>
</do-set-dest-attr-value>
</actions>
</rule>
Designer simulation:
Generic Null :Applying policy: %+C%14Ccs%-C.
Generic Null : Applying to modify #1.
Generic Null : Evaluating selection criteria for rule 'Adding elements to modify-attr'.
Generic Null : (if-op-attr 'ExternalId' available) = TRUE.
Generic Null : Rule selected.
Generic Null : Applying rule 'Adding elements to modify-attr'.
Generic Null : Action: do-set-local-variable("lvExternalId",scope="policy",token-op-attr("ExternalId")).
Generic Null : arg-string(token-op-attr("ExternalId"))
Generic Null : token-op-attr("ExternalId")
Generic Null : Token Value: "111111".
Generic Null : Arg Value: "111111".
Generic Null : Action: do-strip-op-attr("ExternalId").
Generic Null : Action: do-set-dest-attr-value("ExternalId",{value=token-local-variable("lvExternalId"),type="organization"}).
Generic Null : arg-string({value=token-local-variable("lvExternalId"),type="organization"})
Generic Null : arg-component("value",token-local-variable("lvExternalId"))
Generic Null : token-local-variable("lvExternalId")
Generic Null : Token Value: "111111".
Generic Null : Arg Value: "111111".
Generic Null : arg-component("type","organization")
Generic Null : token-text("organization")
Generic Null : Arg Value: "organization".
Generic Null :Policy returned:
Generic Null :
<nds dtdversion="4.0" ndsversion="8.x">
<source>
<product version="4.7.1.0">DirXML</product>
<contact>NetIQ Corporation</contact>
</source>
<input>
<modify class-name="User" qualified-src-dn="o=dirXML Test\ou=Users\cn=User1">
<association>o=dirXML Test\ou=Users\cn=User1</association>
<modify-attr attr-name="ExternalId">
<remove-all-values/>
<add-value>
<value type="structured">
<component name="value">111111</component>
<component name="type">organization</component>
</value>
</add-value>
</modify-attr>
</modify>
</input>
</nds>


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Like Alex and Rob suggested, Reformat op attr is a way better choice. You can use a special local variable called current-value that only works inside reformat op attr, and if there is more than one op attr value, then it implicitly loops over all the values and does the same thing to each of them.
So set the type to oStructured, and then for your components define them. I mocked it up simply as this:
<do-reformat-op-attr name="ExternalId">
<arg-value type="structured">
<arg-component name="value">
<token-local-variable name="current-value"/>
</arg-component>
<arg-component name="type">
<token-text xml:space="preserve">organization</token-text>
</arg-component>
</arg-value>
</do-reformat-op-attr>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi All,
Thanks Alex, Rob and Georg's response over this during the festive season holiday.
I will test this out. If it works, it will solve the Google Apps Driver sync Employee ID field.
Merry Christmas and Happy New Year to you all
Cheers,
Keng