#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2014
    Posts
    11
    Rep Power
    0

    Insert multiple records


    Aloha all;

    I'm working on a Cold Fusion app to allow users to add and remove members from email Distribution lists. Got everything pretty much working but I'm struggling with how to handle situations where the user enters two or members at the same time. I've looked at lists, arrays, temp tables, etc. but not really coming up with anything that I can make work.

    Basically what happens, the user enters a user id to add or delete, that user id is verified against AD and I pull the cn and distinguishedName for that user. A second check is done to make sure that user is not already in that distribution list, or is in the distribution list in the case of a delete. If it's just one user, no problem, once the checks are done, the user gets a confirmation page, clicks OK and the record is written to a SQL table. (We have another process that runs and takes that record in the SQL table and does the actual update to the Distribution List).

    Instead of going through that process for every user that may need to be entered at one time, I was looking for a way I could hold those user names somewhere then present all the names on the confirmation page and write all the records at once. Is there a not too complicated way of doing this, I've only done a couple of apps in ColdFusion so there's an awful lot about this I don't know. If it turns out, that doing them one at a time is our best option, then I guess I could just tell the people who bitch about it to go out and hire a real programmer.

    Thanks
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,307
    Rep Power
    970
    You could store the user IDs (and even the names) in the session scope, so that you can present them on the final confirmation page, and then process all of the IDs together once they confirm.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2014
    Posts
    11
    Rep Power
    0
    Thanks, never thought about doing it that way. So my Session.Recipients variable will be a comma delimited string that I loop through on the insert/update/delete query, perfect. That will also work for another aspect of the app where users are assigned multiple distribution lists that they are authorized to edit.

    I'm having a problem with the syntax on a SQL to LDAP query that pulls the distribution lists from AD. I'm using proxyAddresses='*' in my WHERE statement, but unfortunately we have Security Groups that have email addresses. I've got a CFLDAP query that addresses that, where I filter groupType :1.2.840.113556.1.4.803:=2147483648, but I'm having trouble getting that to work in a SQL query. I'll post the detail later, hope you'll keep an eye out for it, you've been a great help and I appreciate it.

    Mahalo

IMN logo majestic logo threadwatch logo seochat tools logo