Uni Selector Not Returning a value

Stephen Herz asked on November 17, 2021 19:10

I'm developing an Kentico 13 site.

I am using a Uni Selector as a field type to allow users to select a piece of content that is of a specific page type. I have the Uni Selector configured as below:

Uni selector control
Data Type: Text

Object type: CMS.Document
Return column name: NodeGuid
Display name format: {%DocumentName%}
Selection mode: Single Text Box
Where condition: ClassName in ('MySite.Separator')

The selector works exactly as expected, and the user can choose an object of Type MySite.Separator then save the page changes.

However, the field returns as blank when I retrieve the page from Kentico. I was expecting to be returned a NodeGuid. Why is Kentico returning an empty string?

Correct Answer

Stephen Herz answered on December 14, 2021 16:35

Turns out my code query.Columns(DefaultDtoFactory().SourceColumns); was causing the columns to not be returned. Removing this fixed my issue

0 votesVote for this answer Unmark Correct answer

Recent Answers


Juraj Ondrus answered on November 18, 2021 13:35

I do not see anything wrong. Btw. you can also limit the page types by using cms.document.< pageType.CodeName> and it will do the same as the WHERE condition.

What is the code you are using the get the data? What is being saved in the DB? If the field is used in a page type - isn't it possible you are using workflows and the change has not been published yet? In case your code is not getting the latest edited version vs. published version.

0 votesVote for this answer Mark as a Correct answer

Stephen Herz answered on November 30, 2021 18:30 (last edited on November 30, 2021 19:27)

Juraj,

In the database field, I see the correct GUID.

I tried changing the WHERE condition to use your logic. That did not fix it.

I also created a new field with a different name (thinking maybe the word 'separator' was a key word) but that didn't fix anything.

Here is the code I'm using:

var result = await _repositoryServices.PageRetriever.RetrieveAsync(query =>
{
    query.Columns(DefaultDtoFactory().SourceColumns);
    filter?.Invoke(query);
},
buildCacheAction,
cancellationToken);
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.