Forum .LRN Q&A: Problem with Bulk Uploading of Users

I tried doing a bulk upload on Oracle with the following file:
first_names, last_name, email, id, type, access_level, guest
Gabriel, Marklund,, gabriel, student, full, f
Mohan, Pakkurti,, mohan, staff, full, f
Lars, Pind,, lars, professor, limited, f
Eva, Marklund,, eva, external, full, t

If I omit the id field the upload will break since no default value is set for that field:

can't read "row(id)": no such element in array
    while executing
"dotlrn::user_add -user_id $user_id -id $row(id) -type $row(type)
    ("full" arm line 2)
    invoked from within
"switch -exact $row(access_level) {
                limited {

That seems easy enough to fix. However when with the id field included I get (after having made the proc oacs::csv_foreach not catch its error messages so that I can see the stack trace, do we really need that catch?):

Object type "dotlrn_staff_profile_rel" does not exist
    while executing
"error "Object type "$object_type" does not exist""
    (procedure "package_instantiate_object" line 15)
    invoked from within
"package_instantiate_object  -creation_user $creation_user 
-creation_ip $creation_ip  -start_with "relationship"  -form_id
$form_id  -extra_vars $extr..."
    invoked from within
In the database I only have the similar sounding object types:

It seems the staff user class is not yet implemented in the database? Indeed, changing staff to student in my CSV file the upload succeeds. It's good that you are able to add the users to a group (i.e. a class) directly after the bulk upload. You can only add the uploaded users to one group though it seems.

Posted by Arjun Sanyal on
peter: "Staff" is the pretty name for the dotlrn_admin_profile_rel. so in your csv, the right type to pass in is "admin".

Id can be anything (including NULL), it's there only for convience.

Posted by Michael Feldstein on
Peter, are you using Excel to generate your CSV file? And if so, could you  kindly upload a copy of your template into file-storage here on Thanks.
Posted by Michael Feldstein on
Oh, it's so lame it's embarassing, really. I can't figure out how to designate the column names in a way that exports properly to the CSV.
Posted by Peter Marklund on
Arjun, could you please enumerate the valid values for user type on the first bulk upload page. Also, id is supposed to be optional but the upload breaks if it's not provided.
Posted by Arjun Sanyal on
michael and peter: i've added detailed documentation to the bulk upload page with all of the expected values of each column. also, it's contains an example CSV file that can be used as a model.