Greetings,

If you work with the Treelist field extensively like I do, you may notice that it is not registering links under certain conditions. You may experience this when search is not coming back with results, when working with Link Database, etc. Also the issue is happening when you have a complex source parameter passed to your treelist field on the template:

DataSource=/sitecore/content/Home&IncludeTemplatesForDisplay=PrimaryPage

Luckly, there are two solutions from our brilliant tech support.

1st option: *Add “databasename=master” attribute to every treelist field source: __DataSource=/sitecore/content/Home&IncludeTemplatesForDisplay=PrimaryPage_&databasename=master*_

*2nd option: *Override the Sitecore.Data.Fields.MultilistField class:

    1) Compile the following class and put the built assembly to the “/bin” folder:

public class MultilistField : MultilistField
{

public MultilistField(Field innerField) : base(innerField) { }

private Database GetDatabase()

{

string source = base.InnerField.Source;

if (!string.IsNullOrEmpty(source))

{

if (!LookupSources.IsComplex(source))

{

return base.InnerField.Database;

}

Database database = LookupSources.GetDatabase(source);

if (database != null)

{

return database;

}

}

return base.InnerField.Database;

}

public override void ValidateLinks(LinksValidationResult result)

{

Database database = this.GetDatabase();

if (database != null)

{

foreach (string str in base.Items)

{

if (ID.IsID(str))

{

ID id = ID.Parse(str);

if (!ItemUtil.IsNull(id) && !id.IsNull)

{

Item targetItem = database.GetItem(id);

if (targetItem != null)

{

result.AddValidLink(targetItem, base.Value);

}

else

{

result.AddBrokenLink(base.Value);

}

}

}

}

}

} }

2) Modify the \App_Config\FieldTypes.config file, specifically the Treelist field type definition:

<fieldType name="Treelist" type="Custom.MultilistField,Custom" />

Enjoy!