(1) You need to substite currentobject in your xpaths with the context your widget is retrieving, for example
update : function(data) {
/* context applied */
if (data)
this.dataguid = data.getGUID();
},
yourexistingfunction : function() {
var xpath = //what you already have
xpath = xpath.replace(/\[\%CurrentObject\%\]/gi, this.dataguid);
//retrieve stuff
}
(2) No, that is not possible. You do not need to duplicate the code however, you can use the same javascript for two different xml configs. I think the confirm microflow widget is an example for how that can be doen. .