Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

getInheritedProps()

Updated on July 20, 2021

Obtains the properties that are set in the parent metadata node within the inheritedProps metadata structure. The inheritedProps metadata allows cascading of values in the view metadata, which results in better reuse of the properties.

Returns

The inherited properties as an object.

Parameters

This API does not have parameters.

Usage example

In this example, the API obtains the value of the label property inherited from the parent metadata and overrides the value of the label property set in the child view.

// Parent reference metadata
{
  "type": "reference",
  "config": {
    "name": "Address",
    "inheritedProps": [
      {
        "prop": "label",
        "value": "@L Shipping address"
      }
    ]
  }
}

// Child reusable Address view
{
  "name": "Address",
  "type": "View",
  "config": {
    "template": "OneColumn",
    "ruleClass": "Data-Address"
    "label": "Generic address"
  },
  "children": [
    {
      "name": "A",
      "type": "Region",
      "children": []
    }
  ]
}

// During rendering the Address child view, you can retrieve the inherited label as follows:
const propsToUse = { label, ...getPConnect().getInheritedProps() };

// This results in propsToUse.label being assigned the “Shipping address” value. This inherits the value that was set on the parent (if the parent had a “label” property) and overrides any “label” property that was set on the child view.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us