javascript - Alfresco: update data list line -


i have data being sent custom data list following code:

// site name , datalists  var site = siteservice.getsite("testing"); var datalists = site.getcontainer("datalists");  // check data list existence  if (!datalists) {   var datalists = site.createnode("datalists", "cm:folder");    var datalistprops = new array(1);   datalistprops["st:componentid"] = "datalists";   datalists.addaspect("st:sitecontainer", datalistprops);   datalists.save(); }  // create new data list variable  var orplist = datalists.childbynamepath("orplist1");  // if data list hasn't been created yet, create if (!orplist) {   var orplist = datalists.createnode("orplist1","dl:datalist");    // tells alfresco share type of items create   orplist.properties["dl:datalistitemtype"] = "orpdl:orplist";   orplist.save();    var orplistprops = [];   orplistprops["cm:title"] = "opportunity registrations: in progress";   orplistprops["cm:description"] = "opportunity registrations out review.";   orplist.addaspect("cm:titled", orplistprops); }  // create new item in data list , populate                               var opportunity = orplist.createnode(execution.getvariable("orpworkflow_nodename"), "orpdl:orplist"); opportunity.properties["orpdl:nodename"] = orpworkflow_nodename; opportunity.properties["orpdl:datesubmitted"] = date().tostring(); opportunity.properties["orpdl:submissionstatus"] = "requires revisions"; opportunity.save(); 

this correctly creates data list items, however, @ other steps of workflow require these items updated. have thought of following options:

  • remove data list item , add updated information
  • simply update data list item

unfortunately have not found adequate solutions elsewhere either of these options. attempted use orpworkflow_nodename, unique identifier generated @ step, identify node find it. not seem work. aware nodes have unique identifiers generated alfresco itself, documentation doesn't give adequate information on how obtain , use this.

my question:

instead of var opportunity = orplist.createnode(), must use in place of createnode() identify existing node can update properties?

you can use check existing datalist item.

var opportunity = orplist .childbynamepath(execution.getvariable("orpworkflow_nodename"));  // if data list item not been created yet, create if (!opportunity ) {   var orplist = orplist .createnode(execution.getvariable("orpworkflow_nodename"),"dl:datalist");} 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -