I've tried using this parameter a few times to filter jobs by process attributes, but have never managed to do so successfully.
Here's the basic setup I have:
The WF_JOBSLIST resource is set to use a table with the name PROCATTRS.
In the form where the Jobslist will be filtered and fetched, I have both the Jobslist table and the PROCATTRS tables. Note the type for the value column of the PROCATTRS is integer.
And here is the code in the before form script that filters and fetches jobs. The EMPLOYEEID value coming from the getRolesForAutoRemoval table is an integer as well, and so is the process attribute (not pictured).
If I'm not mistaken, this should get me a Jobslist table with all jobs having the process attribute employeeID equal to the value passed in to the PROCATTRS table. There are 4 such jobs with that employeeID, however I'm getting 0 results every time. Anyone notice what I'm missing?
Thanks in advance.
Using JOB_PROCESS_ATTRIBUTES_FILTER_TABLE_NAME to filter job
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 82
- Joined: Fri Jan 15, 2016 2:34 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
I think there is a bug in the WorkflowJobsList custom resource class. It changes the name of all process attributes to upper case, so "employeeID" is being changed to "EMPLOYEEID". This is probably a hang-over from V4 when all names had to be upper case.
However the WorkflowJobsList resource is just a front end onto the workflow API and you can address that directly if you want to e.g. the equivalent code will be something like this (I'm afraid I haven't tried this):
See the help doc for the getFilteredJobs() method for info on all the filter parameters you can use. This method returns a list of JobDescriptor objects - see http://www.ebasetech.com/ebase/doc/java ... iptor.html
However the WorkflowJobsList resource is just a front end onto the workflow API and you can address that directly if you want to e.g. the equivalent code will be something like this (I'm afraid I haven't tried this):
Code: Select all
var procAttrs = { "employeeID" : value};
var userId = system.securityManager.userName;
var languageId = form.language;
var jobs = system.workflow.api.getFilteredJobs(null, null, null, null, false, null, null, null, null, procAttrs, true, false, languageId, userId);
for each (var job in jobs)
{
var id = job.identifier;
var processName = job.processName;
var description = job.description;
var creationDate = job.creationDate; // type date
var modificationDate = job.modificationDate; // type date
var owner = job.owner;
var opener = job.opener;
var completed = job.completed; // type boolean
}
0 x
-
- Ebase User
- Posts: 82
- Joined: Fri Jan 15, 2016 2:34 pm
-
- Ebase User
- Posts: 82
- Joined: Fri Jan 15, 2016 2:34 pm
Armed with the knowledge that getFilteredJobs() exists, I decided to go back to other parts of our application to use that function instead of the custom resource, which has lead me to encounter a new issue.
In this usage, I only want to retrieve workflow jobs which have a certain attribute (_parentJobID) set to null. I expected the following to get me that result, however as you can see from the code & log example below, it's displaying both jobs currently in the system, even though only one of them has _parentJobID == null.
Does setting a process attribute filter to a null value just cancel it, like it does for other filters? Does that mean it's impossible to use procAttrs in the way I'm trying to below, which is to look for jobs that have a certain process attribute set to null?
In this usage, I only want to retrieve workflow jobs which have a certain attribute (_parentJobID) set to null. I expected the following to get me that result, however as you can see from the code & log example below, it's displaying both jobs currently in the system, even though only one of them has _parentJobID == null.
Does setting a process attribute filter to a null value just cancel it, like it does for other filters? Does that mean it's impossible to use procAttrs in the way I'm trying to below, which is to look for jobs that have a certain process attribute set to null?
Code: Select all
var procAttrs = {"_parentJobID" : null};
var jobs = api.getFilteredJobs(null, null, null, null, finishedJobs, null, null, null, null, procAttrs, true, false, form.language, system.securityManager.getUserName());
for each (var job in jobs) {
log('Job ID: '+ job.getIdentifier());
log('Parent ID: '+ api.getProcessAttributeValue(job.getIdentifier(), '_parentJobID', ''));
log('Comparison: '+ (api.getProcessAttributeValue(job.getIdentifier(), '_parentJobID', '') === procAttrs._parentJobID));
Code: Select all
Thu Apr 20 15:52:05: INFO Job ID: JOB:SSA_GeneralFormProcess_Comp:1:523
Thu Apr 20 15:52:05: INFO Parent ID: null
Thu Apr 20 15:52:05: INFO Comparison: true
Thu Apr 20 15:52:05: INFO -------
Thu Apr 20 15:52:05: INFO Job ID: JOB:SSA_doorITsysJob:1:254
Thu Apr 20 15:52:05: INFO Parent ID: JOB:SSA_doorITsysApprovals:1:495
Thu Apr 20 15:52:05: INFO Comparison: false
Thu Apr 20 15:52:05: INFO -------
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
-
- Ebase User
- Posts: 82
- Joined: Fri Jan 15, 2016 2:34 pm
Unfortunately that parameter doesn't work for all cases for us, because some of our jobs aren't actual subjobs as far as Ebase is concerned. Case in point, in the example I gave above, the second job ("JOB:SSA_doorITsysJob:1:254") is a subjob asf ar as we're concerned, but Ebase is picking it up despite that IgnoreSubJobs param already being set to true.
I'll just change the default value of our _parentJobID parameter to be something like n/a instead of null so that I can filter it that way.
Thanks again Jon.
I'll just change the default value of our _parentJobID parameter to be something like n/a instead of null so that I can filter it that way.
Thanks again Jon.
0 x
Who is online
Users browsing this forum: No registered users and 2 guests