Console icon indicating copy to clipboard operation
Console copied to clipboard

Update-ItemReferrer Not working throwing unexpected error.

Open PunjabSoftSolution opened this issue 1 year ago • 1 comments

Expected Behavior

Update-ItemReferrer should function without any issues.

Actual Behavior

When attempting to run the Update-ItemReferrer command, we encounter an issue stating "FieldID cannot be null," even though we are not specifying any FieldID.

Steps to Reproduce the Problem

$coverImage = Get-Item 'master:\media library\Default Website\cover' $scLogoImage = Get-Item 'master:\media library\Default Website\sc_logo' $coverImage | Update-ItemReferrer -NewTarget $scLogoImage

I have a collection of items that I need to update the referrer for. However, when I try to run this command using a ForEach loop, I encounter an issue stating "FieldID cannot be null." Please look into this. Thanks in advance.

PunjabSoftSolution avatar Mar 12 '24 09:03 PunjabSoftSolution

When I tried it using the example in the docs, I found that as long as you set the image first it worked as expected. To get the sample to you work you'll need to add a field to the home template called "Image".

https://doc.sitecorepowershell.com/appendix/common/update-itemreferrer#examples

michaellwest avatar Mar 12 '24 15:03 michaellwest

Checked it and it's not reproducible, therefore have to assume a problem with the script or solution. @PunjabSoftSolution feel free to reopen the issue if you have an example that shows the problem on a clean Sitecore. With all the steps and the script leading to the error.

AdamNaj avatar May 17 '24 20:05 AdamNaj