Share all details about your problem, including any error messages you may have received.
I have created a new custom task that executes via the Plugin Task Executor. I have configured the task with the progressMode=“Percentage” property and set the percentage as with the monitor.updateProgress() method.
However while the progress is saved to the task result and also returned by the Ajax calls from the API the task result page is rendered incorrectly. Does anyone know what I am missing here or is the progress mode percentage just not working at all?
I recall something like this happening to me in the past. I think I fixed it by making sure to include executor="sailpoint.task.RuleExecutor" in the TaskDefinition object. Then I would see changes when I called updates to the TaskMonitor object.
That was my first attempt as well. But I actually would like to show the progress bar. The problem is that its always at 100% even if the backend reports a different percentage.
Sorry I missed that part! I usually have a TaskDefinition object that calls a rule where I calculate the completion and call updates to the MonitorTask object. Let me see if I can find a basic example in my stuff, but the progress bar does work so don’t give up yet.
@Felix_Witt
what is your progress interval in task definition xml and also how long is your task running
please make sure you are updating the progress within iteration of processing so that the update will happen to task result as per your progress interval configured
The task currently completes within a few seconds. Therefore I have slowed it down with thread.sleep or by simply halting the environment with the attached jvm debugger. Currently the interval is set to the default 5000.
I dont think it is related to this, as the percentage is persisted to the TaskResult object. As you can see on the second screenshot its also retrieved from the backend. But for whatever reason its not rendered correctly.
I went back into my notes and realized that I came to the same issue you had. I gave up and changed progressMode from Percentage to String to not even show that status bar.
I gave completion updates as a string similar to my example. You can try playing with these examples as it might be easier than recompiling your Java class, but I don’t think it’s honoring the updateProgress call.
Sorry if I gave you any false hopes!
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="rule-demo">
<Source><![CDATA[
import sailpoint.object.*;
import sailpoint.task.TaskMonitor;
TaskResult taskResult = (taskResult != void) ? taskResult : new TaskResult(); // Initialize in case rule ran from debug
TaskMonitor monitor = new TaskMonitor(context, taskResult);
void updateProgress(String progressInfo, int percentComplete) {
monitor.reattach(taskResult);
monitor.updateProgress(progressInfo, percentComplete);
}
int percentCompleted = 0;
int desiredRuns = 5;
for (int x = 0; x <= desiredRuns; x++) {
Thread.sleep(5000); // Sleep for 5 seconds
percentCompleted = (x * 100) / desiredRuns;
updateProgress("Evaluating " + x + " out of " + desiredRuns + " - Completion Percentage: " + percentCompleted + "%", percentCompleted);
}
return "done";
]]></Source>
</Rule>
Thanks for the code. To be honest at the moment my assumption is that this is a bug in the UI. Probably not many people use this and no one reported it.
BTW i run this in a local dockerized environment. Recompiling is a matter of clicking a button and waiting 30 seconds. I wouldnt want to develop on a hosted environment anyways.
I agree about it probably being an unreported bug. I’m pretty sure I invoked the method calls to update the percentage correctly and it still didn’t work.