cancel
Showing results for 
Search instead for 
Did you mean: 

Create a UWL task

Former Member
0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

saar_dagan
Employee
Employee
0 Kudos

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

Former Member
0 Kudos

Hi Saar,

Do you have a code sample that works?

I couldn't get this working, I am not familiar with the API...

Thanks in advance!

saar_dagan
Employee
Employee
0 Kudos
Former Member
0 Kudos

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!

Former Member
0 Kudos

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?

saar_dagan
Employee
Employee
0 Kudos

Hi Ivan,

If you get null it means this service doesn't exists in your portal..

BR,

Saar

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Answers (0)