Open parvezghumra opened 10 months ago
@seanmcne @kenakamu Fixed in PR #526
@parvezghumra were you able to test to ensure this doesn't break anything when sending the request over?
Thanks!
@seanmcne Yes, I tested it successfully for my use case as described in this issue above.
Hi All and @seanmcne,
I'm fairly new to this PowerShell module so please bear with me. I've built a couple of custom scripts using this module: one to export data from a source environment and store it in source control, and a second to import that data from source control to a target environment.
I'm trying to use the following command to do an upsert based on the record's primary unique identifier column:
$output = Set-CrmRecord -EntityLogicalName $primaryEntityName -Id $recordId -Fields $fieldHash -Upsert
I've found that if there is at least one null column value in
$fieldHash
and the command attempts to create the record in the target environment because it does not already exist, then it fails with the following error:cannot bind argument to parameter Value because it is null
I thought the whole point of the
-upsert
option was so that I do not need to query the existing data first manually myself first before then deciding whether to perform a create or update operation depending on whether or not the record exists, as this logic would be handled internally by the upsert option? Is this not the case? Do I really need to build logic to exclude null column values from$fieldHash
if it's going to be a create operation and so I need to query the data in the target environment first?Not sure if it makes a difference, but the way I'm setting the null column value is using the following sort of command:
$fieldHash.Add("new_mycolumn", $null)
Is this correct?