Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 05:30 AM
I'm writing an external component and I'm going to add event mapping to this. I use this code in now-ui.json:
~~~and index.js:
"xxxxx-datepicker": {
"innerComponents": [
"now-input",
"now-heading",
"now-button",
"now-record-mini-calendar"
],
"uiBuilder": {
"associatedTypes": ["global.core", "global.landing-page"],
"label": "XXXXX Date Picker",
"icon": "calendar-outline",
"description": "Date Picker Control",
"category": "primitives"
},
"properties": [],
"actions": [{
"description": "Dispatched when the button is clicked",
"label": "Button clicked",
"name": "XXXXX_DATEPICKER#CLICKED",
"payload": []
}],
"slots": [],
"handlers": []
},
~~~
~~~And it doesn't work unfortunately, I mean, UI Builder still displays empty "Events" configuration tab for this component. "No events available. The selected component has no configurable events."
createEnhancedElement('xxxxx-datepicker', {
renderer: {type: snabbdom},
view,
styles,
dispatches: {
'XXXXX_DATEPICKER#CLICKED': {schema: {type: 'object'}}
},
slots: {
defaultSlot: {}
}
});
What did I wrong?
I'd read "Introduction to External Component Development - SD" course, but it doesn't cover event mappings, so I'm trying to learn by source code of @Servicenow/now-button component, for example.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 05:51 AM
Hi,
yes, there is a bug in now-cli. Here you can find the fix for that 😉
https://youtu.be/fyBVjuAY1wo?t=156
Jan
In this episode, we take a custom component with an event, deploy it to the instance, and then configure the component in the instance so event handlers can be attached to it through UI Builder. Blog: https://developer.servicenow.com/blog.do?p=/post/quebec-ui-builder-custom-component-events/ Docs:
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 05:51 AM
Hi,
yes, there is a bug in now-cli. Here you can find the fix for that 😉
https://youtu.be/fyBVjuAY1wo?t=156
Jan
In this episode, we take a custom component with an event, deploy it to the instance, and then configure the component in the instance so event handlers can be attached to it through UI Builder. Blog: https://developer.servicenow.com/blog.do?p=/post/quebec-ui-builder-custom-component-events/ Docs:
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2023 05:55 AM
Thank you!