Skip to content

Instantly share code, notes, and snippets.

@sammich
Last active August 20, 2017 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sammich/2f6fc445114da8e9f743eb24ecb54e49 to your computer and use it in GitHub Desktop.
Save sammich/2f6fc445114da8e9f743eb24ecb54e49 to your computer and use it in GitHub Desktop.
var items = this.context.binding.get('value').items,
html = '<table class="table table-sm table-bordered"><thead class="thead-default"><tr><th>Property</th><th>Value</th></tr></thead>';
html += items.map(function (i) {
var a;
try {
a = JSON.parse(i.value);
} catch (e) {
a = i.value;
}
return '<tr>' +
'<th>' + i.name + '</th>' +
'<td style="white-space: pre;">' + JSON.stringify(a, null, 4) + '</td>' +
'</tr>'
}).join('') + '</table>';
this.context.element.innerHTML = html;
var d = tw.system.currentProcessInstance.businessData;
var m = []
d.keyArray().sort().forEach(function (k) {
if (k === 'vars') return;
var val = d.get(k);
var v = (typeof val !== 'object') ? val : JSON.stringify(BPMJSON.convertTwToJS(val));
v = String(v);
m.push({ name: k, value: v });
});
tw.local.vars = m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment