The CreatorCon Call for Content is officially open! Get started here.

Service Catalog Builder

sunnyt1
Tera Expert

Does anyone have  any idea how Client Script Page in Catalog Builder fetching the sys_id of catalog item? If you see this page filters the records based on the current catalog item which is being edited in Catalog builder.

 

5 REPLIES 5

@sunnyt1 

 

The “Field” property you see on the Client Script List macroponent is not hardcoded; it is being populated dynamically from the page context. Here’s what happens under the hood in Catalog Builder:

 

  1. When you open a catalog item in Catalog Builder
    • The framework loads the catalog item’s record into the page state.
    • This includes the sys_id and other key fields.
  2. Macroponent property binding
    • The “Field” property you see in the configuration is exposed by the Client Script List macroponent (it expects the catalog item reference so it knows what to filter on).
    • In the page definition (UI Builder → Page JSON), this “Field” property is mapped to a state property, usually something like:

{
"field": "@state.record.sys_id"
}

    • This means whatever record sys_id the page is holding will be passed into that “field” property automatically.