You have two CFLOOPs in your code.  Both your <cfscript> block and
second <cfldap> query should be in the same <cfloop> block.

Just remove the first </cfloop> and the second <cfloop> and you should
be fine.

What it's doing is you are looping through all of your results and
setting each one to your "s" variable.  Then, when that first loop is
complete, "s" holds the last value.

Then, you start over with the second loop which is using the "s" from
the previous group.

M!ke

-----Original Message-----
From: Ian Vaughan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 06, 2006 8:04 AM
To: CF-Talk
Subject: RE: CFLDAP Question ?

Mike

When running the script below, it changes the mailnickname(alias) but
all to the same value which seems to be the last user in the ou's
proxyaddresses which in this case is a.testuser3

So all 3 users in this OU now have an mailnickname(alias) of a.testuser3
instead of it picking the correct mail suffix from each of their
proxyaddresses.

Any ideas why this is happening from the code below ?

<!--- query LDAP --->

<cfldap action="query"
name="adresult"
attributes = "cn,dn, mailNickname, proxyAddresses"
START="ou=Test,DC=domain,dc=gov,dc=uk"
filter="(&(objectClass=User)(mail=*))"
server="server"
port="389"
username="username"
password="password"
>

<cfloop query="adresult">
<cfscript>
  s = "#adresult.mailNickname#";
  re = "SMTP:([EMAIL PROTECTED]).*";
  s = reReplaceNoCase(s, re, "\1", "all");
  writeoutput("#s#");
</cfscript>
</cfloop>

<cfloop query="adresult">
<cfldap
action="modify"
modifyType="replace"
attributes="mailNickname=#s#"
dn="#adresult.dn#"
server="server"
port="389"
username="username"
password="password">
</cfloop>

Changes Completed

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237091
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to