{"id":962,"date":"2025-01-23T13:02:50","date_gmt":"2025-01-23T12:02:50","guid":{"rendered":"https:\/\/www.ume.li\/blog\/?p=962"},"modified":"2025-01-23T13:02:50","modified_gmt":"2025-01-23T12:02:50","slug":"store-settings-in-hcl-engagement-center-widgets","status":"publish","type":"post","link":"https:\/\/www.ume.li\/blog\/2025\/01\/23\/store-settings-in-hcl-engagement-center-widgets\/","title":{"rendered":"Store settings in HCL Engagement Center widgets"},"content":{"rendered":"<p>I had the task to create a new Highlights widget. The documentation has some examples on how to create a new widget\u00a0<a title=\"Custom Widget\" href=\"https:\/\/help.hcl-software.com\/connections\/v8-cr4\/connectors\/icec\/cec-custom-widget-api.html\" rel=\"nofollow \">https:\/\/help.hcl-software.com\/connections\/v8-cr4\/connectors\/icec\/cec-custom-widget-api.html<\/a><\/p>\n<p>To add properties to your widget you simply provide a customEditor in the registerCustomWidget command.<\/p>\n<pre>\r\nfunction editSampleConfig(container$, widgetData) {\r\n   var instanceID=XCC.T.getXccPropertyValue(widgetData,\"widgetinstanceid\");\r\n   return [\r\n      XCC.U.createTextInputOnTheFly('Title', widgetData.title, 'title'),\r\n      XCC.U.createTextInputOnTheFly('Height', widgetData.height, 'height'),\r\n      XCC.U.createTextInputOnTheFly('InstanceID', instanceID, 'instanceid'),\r\n  ];\r\n }\r\n<\/pre>\n<p>And a simple save function<\/p>\n<pre>\r\nfunction saveSampleConfig(container$, widgetData) {\r\n      \r\n      widgetData.title = container$.find('input[name=title]').val();\r\n      widgetData.height = container$.find('input[name=height]').val();\r\n      var instanceid = container$.find('input[name=instanceid]').val();\r\n    \r\n\r\n      XCC.T.setXccProperty(widgetData, {\r\n        \"propKey\": \"widgetinstanceid\",\r\n        \"propValue\": instanceid,\r\n        \"propType\": \"string\"\r\n      });\r\n}\r\n<\/pre>\n<p>And the register function looks like<\/p>\n<pre>\r\n  XCC.W.registerCustomWidget({\r\n      id: 'cloud.collab.view-sample.widget',\r\n      name: 'View Sample Widget',\r\n      icon: 'th-large',\r\n      createCustomWidget: render,\r\n      customEditor: editSampleConfig,\r\n      synchUiToWidgetDataObject: saveSampleConfig,\r\n    });\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had the task to create a new Highlights widget. The documentation has some examples on how to create a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,1],"tags":[24,121,119,76,97,51,120],"class_list":["post-962","post","type-post","status-publish","format-standard","hentry","category-connections","category-uncategorized","tag-connections","tag-dummy","tag-engagement-center","tag-hcl","tag-widget","tag-widgets","tag-xcc"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/posts\/962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/comments?post=962"}],"version-history":[{"count":5,"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/posts\/962\/revisions"}],"predecessor-version":[{"id":967,"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/posts\/962\/revisions\/967"}],"wp:attachment":[{"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/media?parent=962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/categories?post=962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ume.li\/blog\/wp-json\/wp\/v2\/tags?post=962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}