Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
15 replies
Subscribers
8 subscribers
Views
7088 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
How do we get the next task Id of a User Input Task. This has to be entered in t
aneeshv713
over 10 years ago
How do we get the next task Id of a User Input Task. This has to be entered in the Send Email Smart Service which is triggered before the User Input Task? Is there any such Out Of The Box function?...
OriginalPostID-114894
OriginalPostID-114894
Discussion posts and replies are publicly visible
0
Eduardo Fuentes
Appian Employee
over 10 years ago
Tasks do not have an ID until they are instantiated. You cannot "predict" what the next task ID will be.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv713
over 10 years ago
We want to disable the alerts and then use a Send Email Node before the actual task and provide an actual link to the task rather than just a link to the Tempo Interface. This way when the user clicks on the link, he lands directly on the exact task rather than on a specific tab. How do we achieve this?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 10 years ago
You can send the email after the task is instantiated (e.g. a paralel flow one that goes to the task to instantiate it, one that goes to a timer to wait for the task to be instantiated).
The flow that has the timer would then go to a script task that can call a custom function you will have to create (
forum.appian.com/.../ProcessExecutionService.html
, int, int, int, java.lang.Integer, java.lang.Integer) to get the current tasks for process and based on your business logic get the desired task from that process then pass that information to the Send Email node.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv713
over 10 years ago
Do you have any sample plugin code to this? The return type for the getCurrentTasksForProcess is a ResultPage.I am not sure how to convert a ResultPage into an Integer type to get tasksids as an integer?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 10 years ago
Sure! Actually for any ResultPage you just need to look at the API Docs to determine what cast you need. Since according to the Java Docs the getCurrentTasksForProcess returns a ResultPage of TaskSummary objects you just need to call its getResults() method and then cast that to an array of TaskSummary
TaskSummary[] currentTasksForProcess = (TaskSummary[])currentTasksForProcessResultPage.getResults();
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv713
over 10 years ago
Hi Eduardo, any update on the plugin?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 10 years ago
It seems you missed my last post, the relevant code for you to build your plugin is in there.
There are no plans on my end to create a plugin to be shared since you need to adapt it to your specific needs.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 10 years ago
Oh I know what you mean, when I said "sure" I meant that I was going to provide the two lines to explain how you convert a ResultPage into a TaskSummary[], not that I had a built example, sorry for the confusion.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv713
over 10 years ago
I am getting a null pointer exception when I put the following code with the interface implementation of processExecutionService
Long[] currentTasksForProcess = new Long[100];
ProcessExecutionService processExecutionService = new ProcessExecutionService() {
@Override
public void setServiceContext(ServiceContext arg0) {
// TODO Auto-generated method stub
}
ResultPage resultPage;
resultPage = processExecutionService.getCurrentTasksForProcess(processID, com.appiancorp.suiteapi.process.ProcessExecutionService.UNATTENDED_AND_ATTENDED_TASKS, 1, 10, TaskSummary.SORT_BY_ID, Constants.SORT_ORDER_ASCENDING);
currentTasksForProcess = (Long[])resultPage.getResults();
What could be the root cause of this null pointer exception?
Is processExecutionService() null or currentTasksForProcess() .
The error is at line 1787 which is this:-
resultPage = processExecutionService.getCurrentTasksForProcess(processID, com.appiancorp.suiteapi.process.ProcessExecutionService.UNATTENDED_AND_ATTENDED_TASKS, 1, 10, TaskSummary.SORT_BY_ID, Constants.SORT_ORDER_ASCENDING);
currentTasksForProcess = (Long[])resultPage.getResults();
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aneeshv713
over 10 years ago
I resolved this error but quick question :-
You said , you can do --> TaskSummary[] currentTasksForProcess = (TaskSummary[])currentTasksForProcessResultPage.getResults();
But there is no return type by the type TaskSummary[] and type casting to a Long[] does not work either? Then how do we get the task ids as a array of integers?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>