Microsoft.Xrm.Data.PowerShell icon indicating copy to clipboard operation
Microsoft.Xrm.Data.PowerShell copied to clipboard

issue passing varible with space in it.

Open fuentej opened this issue 6 years ago • 1 comments

This works $Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "_Role Name" -Fields * -AllRows).CrmRecords

This does not $Role = "_Role Name" $Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue $Role -Fields * -AllRows).CrmRecords

$Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "$Role" -Fields * -AllRows).CrmRecords

$Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "$($Role)" -Fields * -AllRows).CrmRecords

$Roleobj = (Get-CrmRecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue $($Role) -Fields * -AllRows).CrmRecords

Would prefer not to have to hardcode the role name in the command.

fuentej avatar Mar 12 '20 15:03 fuentej

I just tried to reproduce the problem and cannot, are you able to use the same script I did and reproduce the problem?

get-crmrecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue "Schedule Manager"   
$name = "Schedule Manager" 
get-crmrecords -EntityLogicalName role -FilterAttribute name -FilterOperator eq -FilterValue $name  

image

seanmcne avatar Mar 19 '20 03:03 seanmcne