Developer forum

Forum » Development » Importing users

Importing users

Martin Nielsen
Reply
 Hi DW,

I've updated a solution to 19.2.5.2, and now importing users with custom fields gives an error for some of the users in my file.

My XML for a users looks like this (I have about 2000 users in the file, this is one of them):
<Users>
  <User>
      <AccessUserUserName>00001</AccessUserUserName>
      <AccessUserPassword>xxx</AccessUserPassword>
      <AccessUserName>Diverse DKK - spørgekonto</AccessUserName>
      <AccessUserAddress />
      <AccessUserAddress2 />
      <AccessUserCity />
      <AccessUserCountry>Danmark</AccessUserCountry>
      <AccessUserPhone />
      <AccessUserEmail />
      <AccessUserFax />
      <AccessUserType>15</AccessUserType>
      <AccessUserValidFrom>1900-01-01</AccessUserValidFrom>
      <AccessUserValidTo>2300-12-31</AccessUserValidTo>
      <AccessUserModules />
      <AccessUserInformation />
      <AccessUserCustomerNumber>00001</AccessUserCustomerNumber>
      <AccessUserRead />
      <AccessUserActive>1</AccessUserActive>
      <AccessUserPasswordDate />
      <AccessUserComment>Importeret debitor</AccessUserComment>
      <AccessUserRedirectOnLogin>/Default.aspx?ID=66</AccessUserRedirectOnLogin>
      <AccessUserCurrencyCharacter>DKK</AccessUserCurrencyCharacter>
      <UserCustomFields>
        <Field>
          <FieldSystemName>AccessUser_Delete</FieldSystemName>
          <FieldType>Boolean</FieldType>
          <FieldName>Delete</FieldName>
          <FieldOption />
          <FieldValue>False</FieldValue>
        </Field>
        <Field>
          <FieldSystemName>AccessUser_ImportedNow</FieldSystemName>
          <FieldType>Boolean</FieldType>
          <FieldName>ImportedNow</FieldName>
          <FieldOption />
          <FieldValue>True</FieldValue>
        </Field>
      </UserCustomFields>
    </User>
</Users>
This validates against the XSD, but when running the import i get this error for some of my users, and they don't get imported
Error processing XML or executing SQL: Must declare the scalar variable "@AccessUser_Delete".
I think that updating users works fine, but creating new ones is when this error occurs.

What is the 100% correct way to import users with customfields?

Regards
 Martin


Replies

 
Martin Nielsen
Reply
Okay, i've done some digging, and i found out that you cannot import non-existing users with custom fields.

Creating a new users fails when i have customfields in my XML.
Updating an existing use with customfields works.

Importing the above XML will not work if the user doens't exist in DW already.

Creating the user with this XML. and then importing the above XML will add the customfields.
<Users>
  <User>
      <AccessUserUserName>00001</AccessUserUserName>
      <AccessUserPassword>xxx</AccessUserPassword>
      <AccessUserName>Diverse DKK - spørgekonto</AccessUserName>
      <AccessUserAddress />
      <AccessUserAddress2 />
      <AccessUserCity />
      <AccessUserCountry>Danmark</AccessUserCountry>
      <AccessUserPhone />
      <AccessUserEmail />
      <AccessUserFax />
      <AccessUserType>15</AccessUserType>
      <AccessUserValidFrom>1900-01-01</AccessUserValidFrom>
      <AccessUserValidTo>2300-12-31</AccessUserValidTo>
      <AccessUserModules />
      <AccessUserInformation />
      <AccessUserCustomerNumber>00001</AccessUserCustomerNumber>
      <AccessUserRead />
      <AccessUserActive>1</AccessUserActive>
      <AccessUserPasswordDate />
      <AccessUserComment>Importeret debitor</AccessUserComment>
      <AccessUserRedirectOnLogin>/Default.aspx?ID=66</AccessUserRedirectOnLogin>
      <AccessUserCurrencyCharacter>DKK</AccessUserCurrencyCharacter>
      <AccessUserShopID>SHOP1</AccessUserShopID>
    </User>
</Users>
In what version of DW did this break?

Regards
 Martin






 

You must be logged in to post in the forum