Attaching Notes via Startdust API [message #1066296] |
Tue, 02 July 2013 04:41 |
Vikash Pandey Messages: 12 Registered: October 2011 |
Junior Member |
|
|
Use Case: Consider a scenario where you need to create and attach notes to the process instance out of the data entered by user, while working on a manual activity. E.g. There is a remarks field on the UI while user is capturing details of a dispute, and you are required to attach all the text entered in remarks field as notes to the process instance.
Steps to do it:
Ensure you pass ProcessOID data from model to the converted JSF activity's backing bean.
Use ProcessOID to get required details for adding notes using below code:
public Long processOID;
public ProcessInstance processInstance;
private ProcessInstance scopeProcessInstance;
private ProcessInstanceAttributes attributes;
public Long getProcessOID() {
return processOID;
}
public void setProcessOID(Long processOID) {
this.processOID = processOID;
}
@SuppressWarnings("deprecation")
public void attachNotes(String notes){
processInstance =
ProcessInstanceUtils.getProcessInstance(processOID);
scopeProcessInstance =
ProcessInstanceUtils.getProcessInstance
(this.processInstance.getScopeProcessInstanceOID());
attributes = scopeProcessInstance.getAttributes();
scopeProcessInstance.getAttributes().addNote(notes ,
ContextKind.ProcessInstance, processInstance.getOID());
ServiceFactoryUtils.getWorkflowService().
setProcessInstanceAttributes(this.attributes);
}
public void complete() {
//getting the required data and pass it as arg to attachNotes
attachNotes(getData().get("Remarks").toString());
mergeDataForList(Data, (Map)getData("Data"));
}
on completion of the activity, the text entered in remarks field on UI will be added to Notes of the PI.
|
|
|
Powered by
FUDForum. Page generated in 0.03699 seconds