Keng Super Contributor.
Super Contributor.
238 views

Adding elements to modify-attr

Jump to solution

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

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Knowledge Partner
Knowledge Partner

Re: Adding elements to modify-attr

Jump to solution

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>

 

View solution in original post

4 Replies
rrawson Honored Contributor.
Honored Contributor.

Re: Adding elements to modify-attr

Jump to solution

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

Knowledge Partner
Knowledge Partner

Re: Adding elements to modify-attr

Jump to solution
IDM is a flexible tool and allows to get the same result by using different methods. 🙂
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>
0 Likes
Knowledge Partner
Knowledge Partner

Re: Adding elements to modify-attr

Jump to solution

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>

 

View solution in original post

Keng Super Contributor.
Super Contributor.

Re: Adding elements to modify-attr

Jump to solution

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

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.