cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bulk mapping a user to a location query

bmaudlin
By Level 9 Champion
Level 9 Champion

Hi Guys,

Are you able to provide any help on the below scenario.

Currently, we map a location of a device to a location via a customised Business Adapter. This location typically follows the markets we operate in, and as such. The end users of the tool are restricted to the market they are responsible for.

As users currently do not have a location attributed to them, this affects user based licensing, as the end users are unable to see the users consuming the licence. 

Is there a simple way in FNMS that we can auto assign a location to a user, based on the location of the end device they are using. 

Or is it a case of having a customised Business Adapter to carry out the necessary location mapping to an end user.

Ben

 

(1) Solution
mfranz
By Level 17 Champion
Level 17 Champion

Hi Ben,

You'll have to run a Business Import. It may update users with existing mechanics, or you may just use it as a vehicle to run SQL code like this:

UPDATE cu
SET cu.LocationID = cc.LocationID
FROM ComplianceUser cu
JOIN ComplianceComputer cc
	ON cu.ComplianceUserID = COALESCE(cc.AssignedUserID, cc.CalculatedUserID, cc.ComplianceUserID)
WHERE cc.LocationID IS NOT NULL

Be aware this is quick'n'dirty. Potential issue will be if one user has multiple computers with different locations assigned.

Best regards,

Markward

View solution in original post

(2) Replies
mfranz
By Level 17 Champion
Level 17 Champion

Hi Ben,

You'll have to run a Business Import. It may update users with existing mechanics, or you may just use it as a vehicle to run SQL code like this:

UPDATE cu
SET cu.LocationID = cc.LocationID
FROM ComplianceUser cu
JOIN ComplianceComputer cc
	ON cu.ComplianceUserID = COALESCE(cc.AssignedUserID, cc.CalculatedUserID, cc.ComplianceUserID)
WHERE cc.LocationID IS NOT NULL

Be aware this is quick'n'dirty. Potential issue will be if one user has multiple computers with different locations assigned.

Best regards,

Markward

Hello @mfranz ,

Okay thank you good to know, I thought that was likely to be the case.

Thank you for the SQL code, that is really helpful. 

Ben