Developer forum

Forum » Development » Geolocation and api

Geolocation and api

Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Hi,

Is it possible to disable the geolocation-lookup, when importing users from an ERP-system via the api?

I've tried to set the parameter IsGeolocationCustom=true on the user, but that doesn't do the trick.

--
Best regards
Kurt Moskjaer Andersen


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Kurt

SettingIsGeolocationCustom = true before calling user.save the first time, should ensure that.Can you share your code?

Thanks, Nicolai

Votes for this answer: 1
 
Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

My code goes below:

User groupAdminUser = new User();
groupAdminUser = User.GetUserByUserName("admin" + custNo);
groupAdminUser.Company = userGroup.CompanyName.Trim();
groupAdminUser.Name = userGroup.CompanyName.Trim();
groupAdminUser.CustomerNumber = userGroup.CustomerNumber;
groupAdminUser.Address = userGroup.Address;
groupAdminUser.Zip = userGroup.ZipCode;
groupAdminUser.City = userGroup.City;
groupAdminUser.Country = userGroup.Country;
groupAdminUser.Phone = userGroup.Telephone;
groupAdminUser.Email = custMail;
groupAdminUser.VatRegNumber = custVAT;
groupAdminUser.UserName = "admin" + custNo;

groupAdminUser.CustomFieldValues.First(x => x.CustomField.SystemName == "AccessUser_EnvironmentCode").Value = custEnvCode;
groupAdminUser.CustomFieldValues.First(x => x.CustomField.SystemName == "AccessUser_FreightAmount").Value = custFreightAmount;
groupAdminUser.CustomFieldValues.First(x => x.CustomField.SystemName == "AccessUser_FreightLimit").Value = custFreightLimit;

groupAdminUser.IsGeolocationCustom = true;

groupAdminUser.AddToGroup(custGroupID);
groupAdminUser.Save();

 

I just experienced a "thread aborted" or timeout, when I did this previously. 

/Kurt

 
Nicolai Pedersen
Reply

thread aborted comes from a response.redirect somewhere.

Does this mean it works now?

BR Nicolai

 
Kurt Moskjær Andersen
Kurt Moskjær Andersen
Reply

Well, it works now, but nothing has been changed, as I already added the IsGeoloationCustom setting to the user.

/Kurt

 
Nicolai Pedersen
Reply

Magic!

 

You must be logged in to post in the forum