- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 05:10 AM
Hi,
I am trying to create a custom field decorator.
The decorator should copy the text in the field it is attached to, to the clipboard.
How do I create a custom field decorator??
I have tried creating a now-cli component that does this, but when I create the decorator and attach it to the field as a UI component, it just does nothing...
Solved! Go to Solution.
- Labels:
-
Now Experience UI Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 10:51 AM
thank you for the suggestions Drew, it helped me get the motivation to rumage around more to find the issue.
I was able to figure out why a UI component didn't natively work as a field decorator.
When you create a field decorator from the menu.
It does not set the form position to contextual side bar.
as the UI component MUST be set as a contextual side bar(maybe related item, didn't test this) to be loaded in,
even if it is a field decorator
I had to go to sys_declarative_action_assignment.list
where I found my decorator missing the form position.
Set it to contextual side bar through the list view, not the form view.
As the form view hides this option.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 08:45 AM
So you saying that when the page loads that no where in the console you are seeing any of the messages you are logging out and there are no other console errors?
Make sure you have cleared your browser cache and reload the page to make sure you have the latest version of your component and add a on-click to the div that just does an alert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 10:09 AM
yes, when put as a field decorator. page loads, component does nothing.
when you click the decorator, it does nothing.
yes I have cleared cache etc.
is there a trigger I need to watch for from inside the component?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 10:20 AM
Ok, so have you added an on-click for the div tag you have to see if that gets a reaction?
Have you used the dev tools for the browser to see what the shadow dom looks like for the icon its creating?
Based on your code it does not sound like the view function is being called, if it was you should see at least that console message.
You could put in code to check all of these lifecycle action handlers to see if any are being triggered.
https://developer.servicenow.com/dev.do#!/guide/orlando/now-experience/ui-framework/now-experience-ui-framework-101/lifecycles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 10:51 AM
thank you for the suggestions Drew, it helped me get the motivation to rumage around more to find the issue.
I was able to figure out why a UI component didn't natively work as a field decorator.
When you create a field decorator from the menu.
It does not set the form position to contextual side bar.
as the UI component MUST be set as a contextual side bar(maybe related item, didn't test this) to be loaded in,
even if it is a field decorator
I had to go to sys_declarative_action_assignment.list
where I found my decorator missing the form position.
Set it to contextual side bar through the list view, not the form view.
As the form view hides this option.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2020 12:59 PM
Good catch, I wonder if its worth putting in a case for this to see if ServiceNow will fix it.