1

We are using the General Link with Search field to filter and select the items in Sitecore 10.1. Now when I click Search for a link on the field and then search for the items of a particular template, it gives me the proper result and that is fine.

But when I select the item from the results, it appends the language with the Item ID selected in the ItemLink box like this as shown in below screenshot.

enter image description here

The issue is that after selecting the item when I click OK, it gives me the error.

Object reference not set to an instance of an object.

Here is the screenshot.

enter image description here

The value in the Item Link field shows like this {7F0FE8D0-36A7-4502-BFA9-49EE583FF513}/en. Now if I manually remove /en in the ItemLink field and click OK then it doesn't show any error and the item gets selected in the field and it works fine.

Can anyone let me know how to resolve this?

4
  • Do you have any custom link provider in your project? Can you try commenting out and checking if that helps?
    – Marek Musielak
    Commented May 16, 2022 at 13:03
  • Thanks @MarekMusielak but I have checked this on the Sitecore Vanilla instance. Commented May 16, 2022 at 13:08
  • sounds like a bug. have you tried support ticket?
    – Marek Musielak
    Commented May 16, 2022 at 13:31
  • @MarekMusielak Not yet but I think If I can get some context if anyone faced the issue before that. Commented May 16, 2022 at 13:44

2 Answers 2

2

This issue looks bug to me, I suggest you create a support ticket to confirm this. Alternatively, you can update the ItemBucket.utils.js file located - sitecore\shell\Applications\Buckets\scripts on your website root. This file has a BindItemResult function, where dialogViewType is not handled properly. you just need to add one more else if condition just before the else condition in this function. see below updated code -

if (window.currentBucketsViewType == window.dataSourceViewType) {
        $j('#ItemLink', parent.document.body).val(b);
    } 
else if (window.currentBucketsViewType == window.mediaViewType) {
            b = b.replace(window.imageFullPath, "");
            $j('#Filename', parent.document.body).val(b);
            $j('#ItemName', parent.document.body).val(b);
        } 
else if (window.workBox != "") {
            window.scForm.getParentForm().postRequest('', '', '', 'search:launchresult(url=' + b + ')');
        }
  //Add below code
    else if(window.currentBucketsViewType == window.dialogViewType){
            $j('#ItemLink', parent.document.body).val(b.split("/")[0]);
    }
        else {
         ...
    }

Since we don't need anything after "/", so we are removing it in just the case of dialog view. Make sure your cache is clear after these updates. I hope this will fix your issue.

1

I created a support ticket on Sitecore for this issue. And got a response that they are able to reproduce the similar behavior locally, this behavior has been registered as a bug in their tracking system with the reference number 511692.

The issue has been fixed in Sitecore 10.2, So they suggested to consider upgrade it to the specific version to get the issue fixed.

If the upgrade is not an option then you can also consider the following workarounds to avoid the issue happens:

Workaround 1:

Remove the language parameter manually in the field. Here's the sample

screencast: https://www.screencast.com/t/Ux8JejD0M

Workaround 2:

The issue only happens in the List View, you can switch it to Grid View to avoid the issue happens.

screencast: https://www.screencast.com/t/mlEOVL2acMYq

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.