Workspace, custom field decorator

Roen
Kilo Expert

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...

find_real_file.png

 

find_real_file.png

 

 

1 ACCEPTED SOLUTION

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.

find_real_file.png

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

find_real_file.png

 

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.

 

 

View solution in original post

12 REPLIES 12

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.

 

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?

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

 

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.

find_real_file.png

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

find_real_file.png

 

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.

 

 

Good catch, I wonder if its worth putting in a case for this to see if ServiceNow will fix it.