# Define the values for the multi-select picklist attribute
$optionSetValues = @(484800005, 484800001, 484800003)
# Create account data
$account = @{
"name" = "A Viansh" # Single Line Text
"Multiselection" = $optionSetValues # Multi-Select Option Set
}
# Update the account record
$accountRecord = Set-CrmRecord -conn $conn -EntityLogicalName account -Id accounId -Fields $account
----------------------------
# Define the values for the multi-select picklist attribute
$optionSetValue1 = New-CrmOptionSetValue -Value 484800005
$optionSetValue2 = New-CrmOptionSetValue -Value 484800001
$optionSetValue3 = New-CrmOptionSetValue -Value 484800003
# Create account data
$account = @{
"name" = "AViansh" # Single Line Text
"Multiselection" = @($optionSetValue1, $optionSetValue2, $optionSetValue3) # Multi-Select Option Set
}
# Update the account record
$accountRecord = Set-CrmRecord -conn $conn -EntityLogicalName account -Id accountId -Fields $account

Allam PurushothamPosted Mar 26, 2024, 11:07 AM
While using your code also same issue
FaultException`1 - Update : Updating account : 265bcef3-5aeb-ee11-a203-000d3a3b5473 |=> Incorrect attribute value type System.Object[]
Incorrect attribute value type System.Object[] => Incorrect attribute value type System.Object[] => System.ArgumentException: Incorrect attribute
value type System.Object[]
Parameter name: MultiSelection[TerminalFailure] Failed to Execute Command - Update : RequestID=09d2c983-a780-4458-b806-23eb7bcc1e96 :
Updating account : 265bcef3-5aeb-ee11-a203-000d3a3b5473 duration=00:00:01.3538665 ExceptionMessage = Incorrect attribute value type System.Object[]
Incorrect attribute value type System.Object[] => Incorrect attribute value type System.Object[] => System.ArgumentException: Incorrect attribute
value type System.Object[]
Mithilesh TataPosted Mar 23, 2024, 6:18 AM
To update a multi-select option set field in Dynamics 365 using PowerShell, you first need to retrieve the existing values of the record, modify the multi-select option set field, and then update the record with the new values. Here's how you can do it:
In this script:
$connvariable properly with connection details.Get-CrmRecord.New-CrmOptionSetValue.Set-CrmRecord.Make sure to replace
"new_multiselectfield"with the actual schema name of your multi-select option set field in Dynamics 365. Also, replace"Your_Account_Id_Goes_Here"with the ID of the account record you want to update.