We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code in cmdlet Add-CrmSecurityRoleToUser is using variable SecurityRoleName but this variable is not correctly handled in the logic.
Add-CrmSecurityRoleToUser
SecurityRoleName
Calling Add-CrmSecurityRoleToUser with the following parameters does not associate the role
Add-CrmSecurityRoleToUser -UserId $targetUser.systemuserid -SecurityRoleId $_.roleid
The code checks if the value is not an empty string - which is true, becaue the value is NULL.
if($SecurityRoleName -ne "") { if($UserRecord -eq $null -or $UserRecord.businessunitid -eq $null) { $UserRecord = Get-CrmRecord -conn $conn -EntityLogicalName systemuser -Id $UserId -Fields businessunitid }
The text was updated successfully, but these errors were encountered:
Nice catch @thuld! Do you want to submit a PR for this issue?
Sorry, something went wrong.
If anyone needs a workaround in the mean time, you can just assign a global variable with the same name before the call:
$global:SecurityRoleName = "System Administrator" Add-CrmSecurityRoleToUser -conn $conn -UserId $appUser -SecurityRoleId $roleid
#451
Successfully merging a pull request may close this issue.
Code in cmdlet
Add-CrmSecurityRoleToUser
is using variableSecurityRoleName
but this variable is not correctly handled in the logic.Calling
Add-CrmSecurityRoleToUser
with the following parameters does not associate the roleThe code checks if the value is not an empty string - which is true, becaue the value is NULL.
The text was updated successfully, but these errors were encountered: