Ability to add key/value metadata to widgets
My team was adding scripts to widgets to add attributes to the embedded widget and noticed an opportunity to expand what metadata we can use in the scripts. Currently, we're using the widget description (`desc` field) to set a testid attribute, but by default that description is viewable in the embedded widget.
I'd love the ability for designers to add key/value pairs to the Widget class metadata that are accessible in the widget script.
widget.on('domready', function(w) {
const { oid, customMetadata } = w; // customMetadata is the new (optional) property on a Widget
const testId = customMetadata['testId']; // a key/value pair added by designer
const selectorString = `[widgetid='${oid}']`;
const widgetElement = $(selectorString);
widgetElement[0].setAttribute('testid', testId);
});
smccartney09
Posted 2 years ago·Last reply 2 years ago
1 comment
DRay
·2 years agoHello smccartney09 ,
Thank you for sharing your idea and providing details. We will bring this to the product team and provide updates here as they are available.
We encourage people to continue to vote and comment. We use community interest as one of the ways we prioritize efforts, so every vote and comment can help turn a request into a reality.
Thank you again for sharing and being part of our community!