Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
siddharth_s3
Partner - Creator II
Partner - Creator II

Qlik Cli Update-QlikUser update custom property

Hello,

I am unable to figure out the syntax for updating the custom property when trying tom Update-QlikUser when using the cli module.

Has anyone managed to update a user's custom property?

Below is the module gallery:

https://www.powershellgallery.com/packages/Qlik-Admin-Utils/3.2.5.1/Content/Update-QlikUser.ps1

Labels (1)
  • Cli

12 Replies
siddharth_s3
Partner - Creator II
Partner - Creator II
Author

bump. Anyone?

Levi_Turner
Employee
Employee

@siddharth_s3,

 

A few thoughts:

  • What is the work-flow? i.e.
    • Are you trying to assign a single custom property to a user? Multiple values of a single custom property? Append a value to an existing custom property assignment?
  • Example commands with the responses is needed
  • A basic work-flow is working fine on my end:
Connect-Qlik
Get-QlikUser -filter "userid eq 'test@test'" | Update-QlikUser -customProperties UserCustomProperty=foo

Additionally, Qlik Branch's Slack instance, specifically the #qrs-api and/or #qlik-cli channels may be a more appropriate venue for getting more insight: http://qlikbranch-slack-invite.herokuapp.com/

babitaku
Contributor III
Contributor III

Hi @Levi_Turner ,

How to remove Custom Property value for a particular user? Appreciate you help.

 

Thanks!

babitaku
Contributor III
Contributor III

HI @Levi_Turner ,

With the below endpoint, we can not append the value. This is replacing all the other value with 'foo'

Get-QlikUser -filter "userid eq 'test@test'" | Update-QlikUser -customProperties UserCustomProperty=foo

 How can we append with the existing value?

Levi_Turner
Employee
Employee

Hey @babitaku ,

Adapted from @Marc 's code here: https://github.com/ahaydon/Qlik-Cli-Windows/issues/133

Connect-Qlik
$newCustomProp = "Group=DL-Enterprise Team"
$user = Get-QlikUser -filter "userDirectory eq 'ANYDIR' and userId eq 'ltu'" -full
[string[]]$customProperties = ""
[string[]]$customProperties = $($user.customProperties|%{"$($_.definition.Name)=$($_.value)"})
$customProperties += $newCustomProp
$user | Update-QlikUser -customProperties $customProperties

 

Marc
Employee
Employee

just a quick update to the above.... if only because I hate using '+=' even if I did perpetrate its use here...

+= has a fairly hefty performance impact, trivial and not worth worrying about for small sets of items, but noticeable when there is a lot of data (like in a production environment)

the better way to do this is using a Generic List object... like so..

Connect-Qlik
$newCustomProp = "Group=DL-Enterprise Team"
$user = Get-QlikUser -filter "userId eq 'marc'" -full
[System.Collections.Generic.List[string]]$customProperties = ""
if ($user.customProperties.Count -gt 0)
{
	$customProperties.AddRange($($user.customProperties | ForEach-Object{"$($_.definition.Name)=$($_.value)"}))
}
$customProperties.Add($newCustomProp)
$user | Update-QlikUser -customProperties $customProperties

 

 

Example for why not to use '+='

10,000 objects using '+='  takes 11.31 seconds

Marc_0-1620169662661.png

 

10,000 object using List.Add takes 0.54 seconds

Marc_1-1620169671223.png

 

 

 

babitaku
Contributor III
Contributor III

You rock @Levi_Turner 

Thank you so much. This saved our tedious work of manually adding Custom Properties 🙂

 

ilyas393
Creator
Creator

Hi @babitaku ,

did you figure out how to remove the custom properties using the cli?

I am looking to remove all the custom properties assigned to all the users. i would appreciate any help.

Thank you,

Ilyas

Padmini
Contributor
Contributor

Hi Levi_Turner,

I 'm facing an issue in updating a custom property for the new stream that was created using windows PowerShell script (Qlik CLI) .Please consider the below example of Custom Property :

Group=AB=QS_ABCD_Developer,CD=Efg,GH=LOB,IJ=PROD,IJ=KLMN,IJ=net where 'Group ' is the Custom Property Name and 'AB=QS_.....=net' is the Value.

Below is the syntax I'm using which is not working.

Update-QlikStream -id $streamid -customProperties @("Group=AB=QS_ABCD_Developer,CD=Efg,GH=LOB,IJ=PROD,IJ=KLMN,IJ=net")

I tried esc character ` for the = and , since other property value without the commas and eq to worked, only this property where the value is in such way is not working for me.

Any suggestion here would be of great  help.Thanks,

Padmini