I'm using IDM 3.6.1 and I do a query to find the CN of the user for whom the contract informations are changing.

The query works, and I receive the <instance> element that contains the CN of the user, but then I'm unable to take the cn from the element.

I tried with xpath expression, but the expression always apply to the <modify> element but not to the <instance> element. (Hope this is clear enough...)

(see the policy and trace below )

I use a loopback driver and do the following rule:

<rule>
<description>Update from contrat Principal -test</description>
<conditions>
<and>
<if-class-name mode="nocase" op="equal">hessoContrat</if-class-name>
<if-operation mode="case" op="equal">modify</if-operation>
<if-op-attr name="Telephone Number" op="changing"/>
</and>
</conditions>
<actions>
<do-set-local-variable name="usercn" scope="policy">
<arg-node-set>
<token-query datastore="src">
<arg-match-attr name="hesgeContratPrincipal">
<arg-value type="string">
<token-src-name/>
</arg-value>
</arg-match-attr>
<arg-string>
<token-text xml:space="preserve">CN</token-text>
</arg-string>
</token-query>
</arg-node-set>
</do-set-local-variable>
</actions>
</rule>


Here is the trace :

<nds dtdversion="3.5" ndsversion="8.x">

<source>

<product version="3.6.10.4747">DirXML</product>

<contact>Novell, Inc.</contact>

</source>

<input>

<modify cached-time="20120913095025.476Z" class-name="hessoContrat" event-id="heg-42#20120913095025#1#1" qualified-src-dn="O=hesge\OU=people\OU=contrat\CN=2271204518-2410555632" src-dn="\HESGE-TREE\hesge\people\contrat\2271204518-2410555632" src-entry-id="70722" timestamp="1347529825#2">

<modify-attr attr-name="Telephone Number">

<remove-value>

<value timestamp="1347528915#2" type="teleNumber">---111111</value>

</remove-value>

<add-value>

<value timestamp="1347529825#2" type="teleNumber">---222222</value>

</add-value>

</modify-attr>

</modify>

</input>

</nds>

[09/13/12 11:50:25.524]:hesgePeopleLpBack ST:Applying policy: %+C%14CContrat Principal%-C.

[09/13/12 11:50:25.525]:hesgePeopleLpBack ST: Applying to modify #1.

[09/13/12 11:50:25.525]:hesgePeopleLpBack ST: Evaluating selection criteria for rule 'Update from contrat Principal -test'.

[09/13/12 11:50:25.525]:hesgePeopleLpBack ST: (if-class-name equal "hessoContrat") = TRUE.

[09/13/12 11:50:25.526]:hesgePeopleLpBack ST: (if-operation equal "modify") = TRUE.

[09/13/12 11:50:25.526]:hesgePeopleLpBack ST: (if-op-attr 'Telephone Number' changing) = TRUE.

[09/13/12 11:50:25.526]:hesgePeopleLpBack ST: Rule selected.

[09/13/12 11:50:25.527]:hesgePeopleLpBack ST: Applying rule 'Update from contrat Principal -test'.

[09/13/12 11:50:25.527]:hesgePeopleLpBack ST: Action: do-set-local-variable("usercn",scope="policy",arg-node-set(token-query(datastore="src",arg-match-attr("hesgeContratPrincipal",token-src-name()),"CN")+token-xpath("./@src-dn"))).

[09/13/12 11:50:25.528]:hesgePeopleLpBack ST: arg-node-set(token-query(datastore="src",arg-match-attr("hesgeContratPrincipal",token-src-name()),"CN")+token-xpath("./@src-dn"))

[09/13/12 11:50:25.528]:hesgePeopleLpBack ST: token-query(datastore="src",arg-match-attr("hesgeContratPrincipal",token-src-name()),"CN")

[09/13/12 11:50:25.529]:hesgePeopleLpBack ST: arg-match-attr("hesgeContratPrincipal",token-src-name())

[09/13/12 11:50:25.529]:hesgePeopleLpBack ST: arg-string(token-src-name())

[09/13/12 11:50:25.529]:hesgePeopleLpBack ST: token-src-name()

[09/13/12 11:50:25.530]:hesgePeopleLpBack ST: Token Value: "2271204518-2410555632".

[09/13/12 11:50:25.530]:hesgePeopleLpBack ST: Arg Value: "2271204518-2410555632".

[09/13/12 11:50:25.530]:hesgePeopleLpBack ST: arg-string("CN")

[09/13/12 11:50:25.531]:hesgePeopleLpBack ST: token-text("CN")

[09/13/12 11:50:25.531]:hesgePeopleLpBack ST: Arg Value: "CN".

[09/13/12 11:50:25.531]:hesgePeopleLpBack ST: Query from policy

[09/13/12 11:50:25.532]:hesgePeopleLpBack ST:

<nds dtdversion="3.5" ndsversion="8.x">

<source>

<product version="3.6.10.4747">DirXML</product>

<contact>Novell, Inc.</contact>

</source>

<input>

<query scope="subtree">

<search-attr attr-name="hesgeContratPrincipal">

<value type="string">2271204518-2410555632</value>

</search-attr>

<read-attr attr-name="CN"/>

</query>

</input>

</nds>

[09/13/12 11:50:25.533]:hesgePeopleLpBack ST: Pumping XDS to eDirectory.

[09/13/12 11:50:25.533]:hesgePeopleLpBack ST: Performing operation query for .

[09/13/12 11:50:28.967]:hesgePeopleLpBack ST: Query from policy result

[09/13/12 11:50:28.968]:hesgePeopleLpBack ST:

<nds dtdversion="3.5" ndsversion="8.x">

<source>

<product version="3.6.10.4747">DirXML</product>

<contact>Novell, Inc.</contact>

</source>

<output>

<instance class-name="hessoPeople" qualified-src-dn="O=hesge\OU=people\OU=courant\CN=abdxxx-boubxxx" src-dn="\HESGE-TREE\hesge\people\courant\abdxxx-boubxxx" src-entry-id="72820">

<association state="associated">abdxxx-boubxxx</association>

<attr attr-name="CN">

<value naming="true" timestamp="1347339091#48" type="string">abdxxx-boubxxx</value>

</attr>

</instance>

<status level="success"></status>

</output>

</nds>

[09/13/12 11:50:29.015]:hesgePeopleLpBack ST: Token Value: {<instance> @class-name = "hessoPeople" @qualified-src-dn = "O=hesge\OU=people\OU=courant\CN=abdxxx-boubxxx" @src-dn = "\HESGE-TREE\hesge\people\courant\abdxxx-boubxxx" @src-entry-id = "72820"}.

[09/13/12 11:50:29.016]:hesgePeopleLpBack ST: token-xpath("./@src-dn")

[09/13/12 11:50:29.017]:hesgePeopleLpBack ST: Token Value: {@src-dn = "\HESGE-TREE\hesge\people\contrat\2271204518-2410555632"}.

[09/13/12 11:50:29.017]:hesgePeopleLpBack ST: Arg Value: {<instance> @class-name = "hessoPeople" @qualified-src-dn = "O=hesge\OU=people\OU=courant\CN=abdxxx-boubxxx" @src-dn = "\HESGE-TREE\hesge\people\courant\abdxxx-boubxxx" @src-entry-id = "72820",@src-dn = "\HESGE-TREE\hesge\people\contrat\2271204518-2410555632"}.

[09/13/12 11:50:29.019]:hesgePeopleLpBack ST:Policy returned:

[09/13/12 11:50:29.019]:hesgePeopleLpBack ST:


Any idea ?

Thanks

Sylvain