Detail component filled by a server-side JS
Last updated
Last updated
When choosing this component, you can fill in a detail form, starting from what got back by it. You have first to select an object from the combobox, then write javascript code in order to get back a JSON content compatible with structure of the selected object.
When writing server-side javascript in this component, you can access to a series of built-in methods you can use. The complete javascript methods list is reported in this section. A method you have always to include (once) at the end of the script is:
where jsonString is a JSON string having always this content:
To make it clear, let’s see an example. Suppose we have selected an object Customer related to a CUSTOMER table having these fields: CUSTOMER_CODE CORPORATE_NAME ENABLED That means we have to get back a JSON string with this format:
In case of a detail form, you have always in input all the primary key values, in order to make it possible to fetch a single record, related to such a primary key. Starting from this requisite, you can access to the primary key values through a built-in object named “reqParams”, where you can find as attributes all the input passed to the business component (from the detail form). This is an example of how to get data to fill in a detail form using server-side javascript: