Creating a Page selector that returns field values from a custom page type.

mun yung kan asked on May 10, 2016 03:51

Hi Guys,

i've been trying to make a page selector that displays only 1 specific page type, and returns me a value from a field of the page type (e.g. myCustomID which is a text value)

the only approach i have found is to use uni selector, set its object type to cms.document, set the return value to documentNodeID, and make it filter out pages by specifying classname='myCustomPageType' in the where clause. in my code behind, i retrieve the documentNodeID, and then the page, where i then retrieve the value i need.

the problem with the above approach is obviously i have to take extra steps to get a value i need.

setting the object type to 'myCustomPageType' doesn't return anything, and in fact throws runtime errors when i load up the form control.

does anyone have a better solution? i will need to implement quite a few of these selectors for a project coming up, and i'm hoping for a better solution

Recent Answers


Chetan Sharma answered on May 10, 2016 11:06

Hi,

I guess you are not using Portal Engine development model, right?

From my understanding, what you are trying to achiever can be easily achieved using a Universal document viewer or a repeater using portal engine development model.

Please share more about your development model approach.

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

mun yung kan answered on May 10, 2016 11:23

Hey Chetan,

we use portal engine development, but almost everything we do involves custom web-parts/widgets, which is where the picker comes in

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on May 10, 2016 12:35

SO does above suggestion won't fit in your use case? Would you mind sharing some what more in details about the requirements please?

I will try to see if things can be achieved using in built web parts

Thanks, CHetan

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on May 10, 2016 15:38 (last edited on December 10, 2019 02:30)

If all you're trying to do is get a value from a field, i would use a static text and just add the macro

{% Documents.WithAllData['My/Node/Alias/Path'].GetValue("myCustomID") |(identity)GlobalAdministrator%}

Or something like that

0 votesVote for this answer Mark as a Correct answer

Zach Perry answered on May 10, 2016 18:36

You might have to create a custom control. This page might help: Documentation on Uniselector

It says it can handle document types. Support might be able to answer your question too.

0 votesVote for this answer Mark as a Correct answer

mun yung kan answered on May 12, 2016 10:47

thanks guys! i'll have a go at experimenting with all these options when i am back in office.

0 votesVote for this answer Mark as a Correct answer

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