on 08-08-2012 12:24 PM
Greetings,
I am trying to develop a custom application that will allow UWL tasks creation.
Methods I am using now are:
IUWLService uwlService = null; | |||
try { | |||
IUser user = WDClientUser.getLoggedInClientUser().getSAPUser(); | |||
UWLContext myContext = new UWLContext(); | |||
myContext.setUser(user); | |||
uwlService = (IUWLService) WDPortalUtils.getServiceReference(IUWLService.ALIAS_KEY); | |||
uwlService.beginSession(myContext, 600); | |||
IPushChannel pushchannel = uwlService.getPushChannel(); |
IProviderConnector connectors[] = uwlService.getRegisteredProviderConnectors();
int thisconnector = 0;
for (int i = 0; i < connectors.length; i++) {
if (connectors[i].getId().equals(IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID))
thisconnector = i;
};
if (thisconnector > 0) {
Item item =
new Item(
IProviderConnector.ADHOC_WORKFLOW_CONNECTOR_ID,
IProviderConnector.ADHOC_WORKFLOW_SYSTEM,
""+new Date().getTime(),
"some user ID");
Attachment[] atts = new Attachment[1];
Attachment printScreen = new Attachment(IAttachmentConnector.WF_ATTACHMENT_CONNECTOR_ID,Attachment.TYPE_RAW_DATA, "Attachment.doc", "This is a description", String.valueOf(new Date().getTime()));
printScreen.setContent(wdContext.currentContextElement().getDataSource());
item.setAttachmentCount(1);
atts[0] = printScreen;
item.setAttachments(atts);
item.setProcessor("some user ID");
item.setDescription("This describes a task created at "+new Date().toGMTString());
item.setSubject("This was generated at "+new Date().toLocaleString());
item.setItemType("uwl.task.coll.inprogress");
item.setCreatedDate(new Date());
item.setDueDate(new Date(2012,9,1,13,00));
item.setCreatorId("some user ID");
item.setStatus(StatusEnum.NEW);
item.setExternalObjectId(""+new Date().getTime());
item.setExternalType("WFTask");
Set users = new HashSet();
// users.add("some user ID");
pushchannel.pushSharedItem(connectors[thisconnector], item, users);
wdComponentAPI.getMessageManager().reportSuccess("UWL item created");
} else {
wdComponentAPI.getMessageManager().reportSuccess("Can't find a connector for AdHoc Workflow");
}
}catch (Exception e){ | |||
wdComponentAPI.getMessageManager().reportWarning(e.getMessage()); | |||
} |
I have two problems with the coding above:
1. It creates a notification, but once UWL is refreshed - the item disappears, it looks like I am not creating an actual task, but a notification about it
2. While item is still there, functionality is missing - I cannot mark the item as competed, see attachments, progress bar etc.
Has anyone ever created UWL tasks through custom WD application? If yes - where can I find the API?
We are running 7.31 version...
Thanks in advance!
Hi Ivan,
I think you should use the pushItems and not the pushShareItem in the pushChannel,
try it and let me know if it worked.
Best Regards,
Saar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
this should do the trick for you:
http://help.sap.com/saphelp_nw70/helpdata/en/46/94b9b2b321581ce10000000a1553f7/frameset.htm
Best Regards,
Saar
Hi Saar,
I saw this API actually, but I can't find the matching DC with source libraries to compile my own DC. Do you have any idea which one it is? I tried all libraries under JWF and UWLJWF development components, but without success.
I need to compile a WD DC, running on top of 7.30.
Thanks in advance!
I think I am close to getting this resolved, but now, after the code compiles fine, I can't get reference to IJWFPortalService service, neither of below lines would return a live object:
IJWFPortalService service = (IJWFPortalService) WDPortalUtils.getServiceReference(IJWFPortalService.KEY); | |
// | IJWFPortalService service = (IJWFPortalService) PortalRuntime.getRuntimeResources().getService(IJWFPortalService.KEY); |
Any ideas?
Did you find the DC that contains IJWFPortalService? Or how did you solve the problem? I couldn't build my own DC as there are missing dependencies and therefore com.sap.workflow.engine.api.IWorkflow and com.sap.workflow.es.portal.IJWFPortalService could not be found. How did you solve this issue?
Best regards,
Robert
Hi Robert,
Until now, I couldn't resolve the dependencies problem.
I cannot find the matching DC.
If you hear something - let me know!
🙂
Regards,
Ivan
* Read my blog here
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.