How to display a list of custom objects from custom modules in a frontend page.

Joao Ferreira asked on March 27, 2019 12:58

I have created a custom module project and a custom scheduled task, the purpose of the task is to get some data from a XML file and insert/update the respective custom objects.

This is all working great, the scheduled task runs and updates the objects, I was also able to list them in administration under "Custom" where I can now add/edit/delete a custom object.

The issue is when I need to display these custom objects in the front-end, I am unsure on how to proceed, all I want is to have a repeater listing all the objects and then provide a link to a "view" page where the clicked object is displayed individually with more information about it.

I've tried creating a new query in the module class called "selectall" and then tried to use a repeater with custom query as a webpart in a page but when I try to select the query name, the class type only shows Page type (that has no reference to the module I've created) and Custom table that also, doesn't have any reference to the custom module or class I've created.

It must be something simple I am missing but I can't figure out what I am missing to be able to display a list of these objects in a page, can someone help me with this?

Thank you in advance.

Correct Answer

Brenden Kehren answered on March 27, 2019 14:16

Module classes children like queries, alternate forms and such are not directly available in the Pages app or many of the web parts. You have 2 choices:

  • Create a "container" page type and add your queries and transformations in there (probably the easiest). Then you can use all the base out of the box web parts in the Pages application.
  • Simply enter the fully qualified namespace and query in the Repeater with Custom Query webpart and save it. This works as well but it requires someone to know the namespace of the module and class you're working with as you cannot select that query name from a list.
2 votesVote for this answer Unmark Correct answer

Recent Answers

Dragoljub Ilic answered on March 27, 2019 13:24 (last edited on March 27, 2019 13:25)


You can create a dummy page type which purpose will be only to hold generic data, f.e. projectNamespace.Container and put your custom query there. Then you can link your query in simple repeater in a way that you already mention in the post.

For detail view of the object, you can use same repeater configuration, but modify where condition by query string (pass id of the object, or any other data that is needed, into query string on detail page) and then simply show that one object in transformation.

Best regards, Dragoljub

1 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on March 27, 2019 13:42

You don't necessary have to select the query, I believe you could type in query name. The only thing you need to know is query code name.

1 votesVote for this answer Mark as a Correct answer

Joao Ferreira answered on March 27, 2019 18:04

Hey guys, thanks a bunch for your help.

I've ended up opting for the second route: just enter the fully qualified namespace in the query name and save it, that did the trick at least for the list.

I might need to add a simple filter to it, related to some of the fields and I still need to add the view for the custom objects but I believe I am able to do it without many issues now.

0 votesVote for this answer Mark as a Correct answer

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