Categories:
  1. What is UI Builder
  2. Create custom workspace
  3. Event Mapping Script – Link to destination
  4. Important UI Builder Component
  5. Enable TAB in Worksapce
  6. UI Action Visible in Workspace
  7. Declarative Actions in ServiceNow
  8. UXF Client Action – Declative Action
  9. Data Management
  10. EVAM Data Resource Dynamic Filter
  11. Custom Component Setup for UI Builder
  12. Concept of Custom Component
  13. Beautiful Table Content
  14. Build Custom Component UI Builder
  15. Call Data Resources From Client Script

Create Properties for Input

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
createCustomElement('x-1359912-custom-builder', {
renderer: {type: snabbdom},
view,
styles,properties:{text:{default:'[{"number":"INC0000052","stateDisplay":"New"},{"number":"INC0000053","stateDisplay":"In Progress"}]'}
});
createCustomElement('x-1359912-custom-builder', { renderer: {type: snabbdom}, view, styles,properties:{text:{default:'[{"number":"INC0000052","stateDisplay":"New"},{"number":"INC0000053","stateDisplay":"In Progress"}]'} });
createCustomElement('x-1359912-custom-builder', {
	renderer: {type: snabbdom},
	view,
	styles,properties:{text:{default:'[{"number":"INC0000052","stateDisplay":"New"},{"number":"INC0000053","stateDisplay":"In Progress"}]'}
});

Update View Part

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
const view = (state, {updateState}) => {
//var title = state.properties.title;
const {properties:{title}} = state;
return (
<div>
</div>
);
}
const view = (state, {updateState}) => { //var title = state.properties.title; const {properties:{title}} = state; return ( <div> </div> ); }
const view = (state, {updateState}) => {
	//var title = state.properties.title;
	const {properties:{title}} = state;

	return (
                 <div>
                </div>
             );
}

now-ui.json file update

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
"uiBuilder": {
"associatedTypes": [
"global.core",
"global.landing-page"
],
"label": "My New Component",
"tileIcon": "./tile-icon/generic-tile-icon.svg",
"description": "A description of my component",
"category": "primitives"
},
"actions":[
{
"description":"demo",
"label": "Button Row Click",
"action":"EVENT_FIRED",
"payload":[]
}
],
"properties":[
{
"name":"text",
"label":"Text",
"fileType":"string"
}
]
"uiBuilder": { "associatedTypes": [ "global.core", "global.landing-page" ], "label": "My New Component", "tileIcon": "./tile-icon/generic-tile-icon.svg", "description": "A description of my component", "category": "primitives" }, "actions":[ { "description":"demo", "label": "Button Row Click", "action":"EVENT_FIRED", "payload":[] } ], "properties":[ { "name":"text", "label":"Text", "fileType":"string" } ]
"uiBuilder": {
        "associatedTypes": [
          "global.core",
          "global.landing-page"
        ],
        "label": "My New Component",
        "tileIcon": "./tile-icon/generic-tile-icon.svg",
        "description": "A description of my component",
        "category": "primitives"
      },
      "actions":[
        {
          "description":"demo",
          "label": "Button Row Click",
          "action":"EVENT_FIRED",
          "payload":[]
        }
      ],
      "properties":[
        {
          "name":"text",
          "label":"Text",
          "fileType":"string"
        }
      ]

Lookup Records JSON Files:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[{"_row_data":{"displayValue":"INC0000060","uniqueValue":"1c741bd70b2322007518478d83673af3"},"short_description":{"value":"demo","displayValue":"demo"},"number":{"value":"INC0000060","displayValue":"INC0000060"},"state":{"value":"7","displayValue":"Closed"}}]
[{"_row_data":{"displayValue":"INC0000060","uniqueValue":"1c741bd70b2322007518478d83673af3"},"short_description":{"value":"demo","displayValue":"demo"},"number":{"value":"INC0000060","displayValue":"INC0000060"},"state":{"value":"7","displayValue":"Closed"}}]
[{"_row_data":{"displayValue":"INC0000060","uniqueValue":"1c741bd70b2322007518478d83673af3"},"short_description":{"value":"demo","displayValue":"demo"},"number":{"value":"INC0000060","displayValue":"INC0000060"},"state":{"value":"7","displayValue":"Closed"}}]

Dispatch Event

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
const resolve = (number) =>{
dispatch('EVENT_FIRED', {data: number});
}
const resolve = (number) =>{ dispatch('EVENT_FIRED', {data: number}); }
const resolve = (number) =>{
		dispatch('EVENT_FIRED', {data: number});
	}

Call dispatch function:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<button className="btn btn-primary" on-click={()=>{
resolve(rec.number);
}}>Resolve</button>
<button className="btn btn-primary" on-click={()=>{ resolve(rec.number); }}>Resolve</button>
<button className="btn btn-primary" on-click={()=>{
					resolve(rec.number);
				}}>Resolve</button>

Action Handler & Dispatch:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
createCustomElement('x-26525-custom-filter', {
renderer: {type: snabbdom},
view,actionHandlers:{
"NOW_DROPDOWN#ITEM_CLICKED":(coeffects)=>{
//console.log(JSON.stringify(coeffects.action.payload));
coeffects.dispatch("INCIDENT_FILTER",{data:coeffects.action.payload});
}
},
createCustomElement('x-26525-custom-filter', { renderer: {type: snabbdom}, view,actionHandlers:{ "NOW_DROPDOWN#ITEM_CLICKED":(coeffects)=>{ //console.log(JSON.stringify(coeffects.action.payload)); coeffects.dispatch("INCIDENT_FILTER",{data:coeffects.action.payload}); } },
createCustomElement('x-26525-custom-filter', {
	renderer: {type: snabbdom},
	view,actionHandlers:{
		"NOW_DROPDOWN#ITEM_CLICKED":(coeffects)=>{
			//console.log(JSON.stringify(coeffects.action.payload));
			coeffects.dispatch("INCIDENT_FILTER",{data:coeffects.action.payload});
		}
	},

For Loop Array:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
{text.map((rec,index) =>{
})}
{text.map((rec,index) =>{ })}
{text.map((rec,index) =>{
})}

State Dropdown JSON Mapping

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[{id: '1', label: 'New'}, {id: '2', label: 'In Progress'},{id: '3', label: 'On Hold'},{id: '6', label: 'Resolved'}]
[{id: '1', label: 'New'}, {id: '2', label: 'In Progress'},{id: '3', label: 'On Hold'},{id: '6', label: 'Resolved'}]
[{id: '1', label: 'New'}, {id: '2', label: 'In Progress'},{id: '3', label: 'On Hold'},{id: '6', label: 'Resolved'}]

Total Views: 1537