task URL opening auto aceept is not working

Hi All,

Am doing publish and wait concept to publish canonical document and getting back taskURL in to CAF project and opening the task URL, task is opening but auto accept is not happening even it is auto accept =true in task project, if iopen same task from task queue inbox auto accept is working fine with acceptBy value with user name , even from task list management if i open task,auto accept is not happening, can any one help me if open taskURL which is return by publish and waitt, auto accept should work.

Regards,
Anil Kumar Ellendula

The auto accept = true is a feature implemented by the custom task inbox, that is why it isn’t auto accepted when you invoke the API or use the TLM. You’ll need to invoke the same code from the API if you want the task auto-accepted. Have a look at the links that the Task Inbox creates to learn how to mark the task accepted.

Regards,
–mark

hi mimel,

after observing with publish and wait taskURL is coming as http://10.30.125.97:8585/meta/default/wm_xt_fabricfolder/0000017063?wmp19716.taskID=21491

if i open the same task in queue inbox url is
http://10.30.125.97:8585/5D87A0D8-5330-EC17-01DD-69F7763CF162.task.app.details.page?wmp_tc=19716&wmp_rt=render&requestID=0.6440929047466611&cancelUrl=%2Fmeta%2Fdefault%2Fwm_xt_fabricfolder%2F0000017066%3Fwmp_tc%3D19719%26wmp_rt%3Drender%26wmp_tv%3D%252fRefundRequestInboxResults%252fdefault.view%26sh.wmp_ks%3Dtrue&finishUrl=%2Fmeta%2Fdefault%2Fwm_xt_fabricfolder%2F0000017066%3Fwmp_tc%3D19719%26wmp_rt%3Daction%26wmp_ta%3D%2523%257bactivePageBean.taskSearchProvider.refresh%257d%26wmp_tv%3D%252fRefundRequestInboxResults%252fdefault.view%26sh.wmp_ks%3Dtrue&taskID=21491

what are the changes i need to do in above first link to make auto accept.

regards,
Anil kumar Ellendula

This is the behavior of the InboxResultsPortlets when configured with autoAccept=true:

  • They have a command Link in one of their columns
  • That command Link is bound to a method: acceptAndOpenTask
  • That method delegates to the base class: BaseTaskInboxResultPageBean#acceptAndOpenTask()
  • That method calls acceptTask() on the TaskProvider and then calls BaseTaskInboxResultPageBean#openTask()
  • OpenTask creates a PortletUrl to the task Details page which includes a PortletURL back to the inbox and refreshes the inbox
  • OpenTask then redirects to the created URL

So that large link below is the result of the URL created in the OpenTask() API


Back to your question. Do you just want to make sure that the task is always accepted when you browse to it?

Maybe you should just accept it in the initialize() method of the Task Details page if it isn’t already accepted.

Or, you should create a method that does something similar to what the task inbox page does and then create a commandlink to invoke that method.

I hope this helps.
–mark

This is the behavior of the InboxResultsPortlets when configured with autoAccept=true:

  • They have a command Link in one of their columns
  • That command Link is bound to a method: acceptAndOpenTask
  • That method delegates to the base class: BaseTaskInboxResultPageBean#acceptAndOpenTask()
  • That method calls acceptTask() on the TaskProvider and then calls BaseTaskInboxResultPageBean#openTask()
  • OpenTask creates a PortletUrl to the task Details page which includes a PortletURL back to the inbox and refreshes the inbox
  • OpenTask then redirects to the created URL

So that large link below is the result of the URL created in the OpenTask() API


Back to your question. Do you just want to make sure that the task is always accepted when you browse to it?

Maybe you should just accept it in the initialize() method of the Task Details page if it isn’t already accepted.

Or, you should create a method that does something similar to what the task inbox page does.

I hope this helps.
–mark

This is the behavior of the InboxResultsPortlets when configured with autoAccept=true:

  • They have a command Link in one of their columns
  • That command Link is bound to a method: acceptAndOpenTask
  • That method delegates to the base class: BaseTaskInboxResultPageBean#acceptAndOpenTask()
  • That method calls acceptTask() on the TaskProvider and then calls BaseTaskInboxResultPageBean#openTask()
  • OpenTask creates a PortletUrl to the task Details page which includes a PortletURL back to the inbox and refreshes the inbox
  • OpenTask then redirects to the created URL

So that large link below is the result of the URL created in the OpenTask() API


Back to your question. Do you just want to make sure that the task is always accepted when you browse to it?

Maybe you should just accept it in the initialize() method of the Task Details page if it isn’t already accepted.

Or, you should create a method that does something similar to what the task inbox page does.

I hope this helps.
–mark

hi mimel,

i have already tried in initialise method by checking

if(!getAccountClosureRequest().isCurrentUserAccepted()){
getAccountClosureRequest().acceptTask();
}

if i open the task first time, it is accepting by user, if i open same task second time it is giving below error

[POP.017.0100] You may not accept this task because it is already accepted by another user

can you please reply me with what condition i need to call getAccountClosureRequest().acceptTask();

have tried with

if(getAccountClosureRequest().getCanUserAcceptTask()){
getAccountClosureRequest().acceptTask();
}

with it also same error am getting.

Regards,
Anil kumar Ellendula

The API (getCanUserAcceptTask) is just a permissions check, not a ‘logic’ check. By default only one user can accept a task at a time, so below i show an algorithm that un-accepts the task if previously accepted and accepts the task for the current user. Hope this helps.
–mark



//Get a reference to the task provider
ManualAcceptTask mat = getManualAcceptTask();

//is the current user already accepted
if (!mat.isCurrentUserAccepted()) {

	//If interested, have a look at the current 
	//accepted list and the maximum allowed to accept (default is 1)
	String [] currentAcceptedUsers = mat.getTaskInfo().getAcceptedByList();
	int maxAllowed = mat.getMaxAllowedToAccept();

	//empty out the accepted list and apply
	mat.getTaskInfo().setAcceptedByList(new String[0]);
	mat.applyChangesNoAccept();
	
	//accept on behalf of the current user
	mat.acceptTask();
} 

Hi Mark,

Thanks for reply, i have done below code in initialise();,does below code give the solution what am expecting.

    if (!getAccountClosureRequest().isCurrentUserAccepted()) { 

	    	String [] currentAcceptedUsers = getAccountClosureRequest().getTaskInfo().getAcceptedByList(); 
	     		       int maxAllowed = getAccountClosureRequest().getMaxAllowedToAccept(); 

	       if(currentAcceptedUsers.length==0&&maxAllowed==1)
	       {
	    	  //empty out the accepted list and apply 
		       getAccountClosureRequest().getTaskInfo().setAcceptedByList(new String[0]); 
		       getAccountClosureRequest().applyChangesNoAccept(); 
		        
		       //accept on behalf of the current user 
		       getAccountClosureRequest().acceptTask();
	       }
	    }

Regards,
Anil Kumar Ellendula

Hi Mark,

After i kept above logic in initialise method my obeservation is that in my left navigation portlet am calling flow service having publish and wait service for this am using AsyTree and Portlet simple link and extended portletURL control it will ope taskURL on center navigation.

if i click first time link, taskURL is opening in center and it is calling initialise() method and checking above logic and it is accepting the task by current user.

if i click same link second time initialise() method is not calling and opening task in center and accepted by is happening with current user.

i have check by putting logs in initiase method.

i have implemented same above logic in 3 tasks initialise methods and it has 3 links in left navigation.

if i click first time “A” task link,it is opening task in center navigation WITH ACCEPT BY CURRENT USER(calling initialise methods of that task).

than if i click B task link it is is opening task in center navigation WITH ACCEPT BY CURRENT USER(calling initialise methods of that task).

than if click again A" task link it is opening task in center navigation WITH ACCEPTED BY CURRENT USER(icalling initialise methods of that task).

Can you please explain me why initialise method is not if i click same task link morethan one-time.

Regards,
Anil Kumar Ellendula

The initialize method is called when the the managedBean has been newly created. I think in the situations you describe where the initialize() method isn’t invoked is because that bean hasn’t been destroyed yet. (See this doc for more details: http://communities.softwareag.com/ecosystem/communities/public/Developer/webmethods/tutorials/CAF/CAFandJSF/JSF_Mbeans_BindingExp.html)

You could add your logic to beforeRenderResponse() and just add some flags as to whether you’ve already checked for the current taskID or not.

Regards,
–mark

Hi Mimel,

Thanks for reply yesterday after i replied this topic i did same by keeping the logic in beforeRenderResponse() , my observations are it is working fine ever time it is doing auto accpet for every new task but in my task has asycommands and command buttons if i click these buttons every time it is calling beforeRenderResponse() method and checking the condition, will these cause perfomanace in QA and Production environment.

you replied that just add some flags as to whether you’ve already checked for the current taskID or not.i think it can achieve same if condition in my logic i.e if(currentAcceptedUsers.length==0&&maxAllowed==1)
{

And also in your reply you mentioned that “”“”“”“”““The initialize method is called when the the managedBean has been newly created. I think in the situations you describe where the initialize() method isn’t invoked is because that bean hasn’t been destroyed yet””“”“”“”“”',can you please reply me how to detroy the managedbean to call initialise method,now it is set with expireWithPageFlow “true” and managedbean scope session.

Regards,
Anil Kumar Ellendula

Regards,
Anil Kumar Ellendula