how to differentiate Between 2 identical action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello All,
I have a problem with default component ,if i have 2 of same component in the custom component they both fire the same action with the same payload so i can not tell the difference between them
Example:
import { createCustomElement, declarativeOperations } from '@servicenow/ui-core';
import snabbdom from '@servicenow/ui-renderer-snabbdom';
import '@servicenow/now-toggle';
const view = (state, { updateProperties, updateState }) => (
<div>
<now-toggle data-field="email" id="masadjaskld"/>
<now-toggle data-field="notifications"/>
<button on-click={e => updateState({
path: 'math',
value: 2,
operation: declarativeOperations.SET
})}>Hello !</button>
<p>{JSON.stringify(state)}</p>
</div>
);
createCustomElement('my-element', {
renderer: { type: snabbdom },
view,
properties: {
name: { default: 'Fred' }
}, setInitialState() {
return {
animals: {
cats: 1,
oo: { mn: "rec" }
}
};
},actionHandlers:{
'NOW_TOGGLE#CHECKED_SET': {
effect(coeffects
) {
}
}
}
});
I tried by DOM variables but i can not get the DOM element from the action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Which kind of component it is . In Portal , component id should be unique.
Within ServiceNow , all component having unique sys_id. So instead of calling the component with other attribute like component's name , try with sys_id.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @ahmedt .
@Tanushree Maiti already responded to you.
i want to add some article please refer that, it may be help u.
https://www.servicenow.com/docs/r/yokohama/platform-administration/c_UniqueRecordIdentifier.html?con...
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
First Thanks ,
It is custom component for `UI builder` with https://developer.servicenow.com/dev.do#!/reference/next-experience/components?&query=toggle&order_b...
