Skip to main content

Resources

What's a Resource?​

A Resource is a file linked to a Business object, an External object, a Disposition or a Business Process.

They are a versatile component of the platform and have many use-cases.

Resource types​

TypeExample use-case 
ImageImage file that can be used in a publication
Style CSS  CSS stylesheet for customizing the UI
Object iconIcon set
JavaScriptJavaScript file for front-end customization
HTMLUsed for the content of a publication
MarkdownStore a Markdown file
PDF Store a PDF file in the application for use in business process
File setFor an external object, it can be used to store a static web site
FontFont file for customizing the UI
XMLStore an XML file
JSONStore a JSON file
OtherAny other file type

How to create Resources?​

For a Business Object, Disposition or Business Process​

Go to the object's form and click Create in the Resources tab :

For an External Object​

Use the Create Resources action button in the external object's form :

Configuration​

FieldDescription
ObjectThe Business Object, External Object, Disposition or Business Process that uses the resource
TypeType of the resource from (types)
LanguageLanguage of the resource ('*' by default, otherwise English or French)
CodeName of the resource
Cached?Tells if the resource is included in the cache or not (No by default)

Page lifecycle triggers​

To run custom code when the UI is ready, or when a page is hidden or shown, create a SCRIPT resource and attach it to the relevant disposition. Bind the handlers to document:

(function(ui, $) {
$(document).on("ui.ready", function() {
// The UI is ready, after the home page has loaded.
});

$(document).on("ui.pagehide", function(e, persisted) {
// The page is hidden; persisted is true when stored in the back/forward cache.
});

$(document).on("ui.pageshow", function(e, persisted) {
// The page is shown; persisted is true when restored from the back/forward cache.
});
})(window.$ui, jQuery);

The persisted argument distinguishes a page stored in or restored from the back/forward cache from a page that is unloaded or reloaded.

Using the Java API​

The main methods used to access a Resource are:

  • HTMLTool.getResourceHTMLContent(Grant g, String code)
  • HTMLTool.getResourceCSSContent(Grant g, String code)
  • HTMLTool.getResourceJSContent(Grant g, String code)
  • See the Javadoc for more details

Read more​