IBM Business Process Manager


can get token id via JS API?


Is there a way to get the token id of the process instance via JS API, rather than REST API? thanks
My opinion is that there is not ... ive studied the documented JS APIs from BPM quite extensively and failed to find such. It doesn't mean that there absolutely isn't such a thing out there ... but if there is, it is hiding well.
Neil
Hi Samuelxie,
Can you please tell me which API call are you using to retrieve the token id.
regards,
Juan Carlos Lopera Marquez
JuanCarlosLopera
2700051FMD
‏2014-03-31T16:52:40Z
Hi Samuelxie,
Can you please tell me which API call are you using to retrieve the token id.
regards,
Juan Carlos Lopera Marquez
More...
I believe you can use /rest/bpm/wle/v1/process/<instanceId>?parts=all REST call to get these datails. i understan the result it returns contains many fields. You can use following code to get the token id for that instance
tw.local.startIndex = tw.local.responseText.indexOf('children":[{"name":', 0);
tw.local.lastIndex = tw.local.responseText.indexOf('}},"diagram":{"processAppID":', 0);
var response = tw.local.responseText.substring(tw.local.startIndex, tw.local.lastIndex);
tw.local.jsonResponse = response;
tw.local.startIndex1 = tw.local.jsonResponse.indexOf('"flowObjectId":', 0);
tw.local.lastIndex1 = tw.local.jsonResponse.indexOf(',"createdTaskIDs":', 0);
tw.local.jsonResponse = '{'+response.substring(tw.local.startIndex1, tw.local.lastIndex1)+'}';
This will give you JSON containing tonedId and flowObjectId for the given task.
Hope this helps!!!
As of Dec 2015, there still seems to be no way yet to do this using JS API, or as neil said, it's hiding really well :)
Something like the below would have been good:
tw.system.findProcessInstanceById('12345').getExecutionTree()
Yes, right now (2015) there is no way to get the token id from the JS API.
So it appears that in 8.5.6 (not sure if this was available earlier or not), there IS a way to obtain the tokenId from the JSAPI:
TWProcessInstance.tasks[].processInstanceStep.id
So for example:
tw.system.findProcessInstanceByID(pid).tasks[0].processInstanceStep.id // this should return the tokenId for this task
Just thought I'd share this find as I've always thought that the only way to get this information was using the REST API as well. Happy token moving!
DonWilliams(ProcessKonsult)
270004XE9J
‏2016-10-28T12:08:59Z
So it appears that in 8.5.6 (not sure if this was available earlier or not), there IS a way to obtain the tokenId from the JSAPI:
TWProcessInstance.tasks[].processInstanceStep.id
So for example:
tw.system.findProcessInstanceByID(pid).tasks[0].processInstanceStep.id // this should return the tokenId for this task
Just thought I'd share this find as I've always thought that the only way to get this information was using the REST API as well. Happy token moving!
More...
hi,
the example which you have given for finding tokenID is not working,Can you tell me any another way.
IBMdev001
50DDX01RU8
‏2017-06-07T09:27:42Z
hi,
the example which you have given for finding tokenID is not working,Can you tell me any another way.
More...
What version of the product are you running? Can you share the code you have attempted in order to do this.
-Andrew Paier
And since there seems to be in the meantime a way to get the tokenId through the JS API my next question is the following: Is there also a way to move the tokens through the JS API?
elag
50XYNQK2V3
‏2017-06-14T08:11:39Z
And since there seems to be in the meantime a way to get the tokenId through the JS API my next question is the following: Is there also a way to move the tokens through the JS API?
More...
No. To my knowledge there is no token movement in the JS-API.
-Andrew Paier
AndrewPaier
2700040K2Q
‏2017-06-30T20:40:47Z
No. To my knowledge there is no token movement in the JS-API.
-Andrew Paier
More...
Thanks for the reply!
I just don't understand why some functions are availble in the REST-API and not in the JS-API. If IBM is offerring a functionality then why not just make it availble at both APIs. Or am I not understanding soemthing?
elag
50XYNQK2V3
‏2017-07-12T14:40:18Z
Thanks for the reply!
I just don't understand why some functions are availble in the REST-API and not in the JS-API. If IBM is offerring a functionality then why not just make it availble at both APIs. Or am I not understanding soemthing?
More...
Some of the gaps are by design, others are just neglect or technical debt. The JS-API predates the REST API. The REST API became the "New and important" API with the 7.5 release, with the JS-API receiving minimal updates from 7.0 on. In an ideal world each addition to either API would be evaluated for inclusion in both, but in reality, last time I had insider information, the 2 APIs were owned by 2 different teams within IBM, so there was little cross pollination between them. It is important to note that the REST API is used by the product itself in many places, while the JS-API is really only used by people creating BPM solutions.
The biggest legitimate reason for having gaps is that the REST API needs to apply security rules to what you can see or change that the JS-API does not. Since the REST API calls can be (potentially) invoked by anyone with a BPM login, they need to not certain things such as allowing me to see BPD Instances I don't participate in. The JS-API however does not have this problem as (barring some specific use cases) there is not a easy manner for a remote client to invoke JS-API calls. As such the JS-API allows the developer to ignore the default "security" rules, so you can, for example, create a dashboard showing all open tasks in the system and allow the person viewing the dashboard to re-assign any of those tasks, even if they wouldn't have the right to do so via the REST API.
-Andrew Paier
AndrewPaier
2700040K2Q
‏2017-07-17T21:11:41Z
Some of the gaps are by design, others are just neglect or technical debt. The JS-API predates the REST API. The REST API became the "New and important" API with the 7.5 release, with the JS-API receiving minimal updates from 7.0 on. In an ideal world each addition to either API would be evaluated for inclusion in both, but in reality, last time I had insider information, the 2 APIs were owned by 2 different teams within IBM, so there was little cross pollination between them. It is important to note that the REST API is used by the product itself in many places, while the JS-API is really only used by people creating BPM solutions.
The biggest legitimate reason for having gaps is that the REST API needs to apply security rules to what you can see or change that the JS-API does not. Since the REST API calls can be (potentially) invoked by anyone with a BPM login, they need to not certain things such as allowing me to see BPD Instances I don't participate in. The JS-API however does not have this problem as (barring some specific use cases) there is not a easy manner for a remote client to invoke JS-API calls. As such the JS-API allows the developer to ignore the default "security" rules, so you can, for example, create a dashboard showing all open tasks in the system and allow the person viewing the dashboard to re-assign any of those tasks, even if they wouldn't have the right to do so via the REST API.
-Andrew Paier
More...
Thanks for this information.My suspicion was that some missing functionalities are indeed because of negelct. For example being able to move a toke with the REST-API, but not with JS. I would have thought of packing this in JS-API first and then in the REST-API. Let's hope IBM improves on this. It is how it is.
There is another point that I would like to add to the discussion. We have an IBM-Consultant helping us with our project. He mentions sometimes that the JS-API is not so performant, or some parts of it are not. This statement sounds a bit shady to me given the fact that BPM developers use it all the time.
I am just resuming a discussion so that I can make my question more tangible:
-Me: Is there a better way to retrieve in which stage I am apart from just decalring an environment variable called ENV? Is there a function in the JS-API, e.g. tw.system.getStage() or something like this?
-BPM-Consultant: The best way to do this is by using an environment variable because this is just a DB-Query for the system. And that doing such a thing with JS-API (with the hypothetical function tw.system.getStage()) would be expensive because the JS-API is expensive.
Would love to hear your opinions!
elag
50XYNQK2V3
‏2017-07-21T09:57:42Z
Thanks for this information.My suspicion was that some missing functionalities are indeed because of negelct. For example being able to move a toke with the REST-API, but not with JS. I would have thought of packing this in JS-API first and then in the REST-API. Let's hope IBM improves on this. It is how it is.
There is another point that I would like to add to the discussion. We have an IBM-Consultant helping us with our project. He mentions sometimes that the JS-API is not so performant, or some parts of it are not. This statement sounds a bit shady to me given the fact that BPM developers use it all the time.
I am just resuming a discussion so that I can make my question more tangible:
-Me: Is there a better way to retrieve in which stage I am apart from just decalring an environment variable called ENV? Is there a function in the JS-API, e.g. tw.system.getStage() or something like this?
-BPM-Consultant: The best way to do this is by using an environment variable because this is just a DB-Query for the system. And that doing such a thing with JS-API (with the hypothetical function tw.system.getStage()) would be expensive because the JS-API is expensive.
Would love to hear your opinions!
More...
Anyone ever telling me that something "is expensive" my first response is "That is interesting. How did you perform the test?" That tells me how much credit to give to their statement. If they have a detailed test they ran, then there is something there. If they start hand waving "Well, everyone just knows that" or "That's been my experience" tells me we really don't have a strong answer. If I have 2 choices, one that is claimed to be more performant and one that I know is more easily maintained, I default to the maintainable one. I've seen far more projects fail due to un-maintainable code than I've seen fail due to performance issues. That isn't to say it never happens, but generally performance can be later addressed (once we have tests created) where as unmaintainable code is very tough to fix.
I personally don't have any tests showing speed data for either of the APIs. I do know that the old TWSearch API had significant performance issues, and one of my consultants just created a POC, with tests of the old JS-API TWSearch vs. the newer Lucene index based one. The performance increase is significant and real. Those sort of results I believe.
-Andrew Paier
AndrewPaier
2700040K2Q
‏2017-07-24T22:10:58Z
Anyone ever telling me that something "is expensive" my first response is "That is interesting. How did you perform the test?" That tells me how much credit to give to their statement. If they have a detailed test they ran, then there is something there. If they start hand waving "Well, everyone just knows that" or "That's been my experience" tells me we really don't have a strong answer. If I have 2 choices, one that is claimed to be more performant and one that I know is more easily maintained, I default to the maintainable one. I've seen far more projects fail due to un-maintainable code than I've seen fail due to performance issues. That isn't to say it never happens, but generally performance can be later addressed (once we have tests created) where as unmaintainable code is very tough to fix.
I personally don't have any tests showing speed data for either of the APIs. I do know that the old TWSearch API had significant performance issues, and one of my consultants just created a POC, with tests of the old JS-API TWSearch vs. the newer Lucene index based one. The performance increase is significant and real. Those sort of results I believe.
-Andrew Paier
More...
We should focus on developing functionalities in the best fitting way and solve performance problems when and if they occur. I don't understand why people invest time in solving potential performance problem that might not even occur.
Is there any sources mentioning something about the lucene based API and the differences to TWSearch? There seems to be nothing about it on IBM-websites. I only found a mention of the word "lucene" here: https://www.ibm.com/support/knowledgecenter/en/SSFTBX_8.5.7/com.ibm.wbpm.ref.doc/ae/doc/JSAPI.html
Is there something fundamentally different between the two?
elag
50XYNQK2V3
‏2017-07-25T12:52:47Z
We should focus on developing functionalities in the best fitting way and solve performance problems when and if they occur. I don't understand why people invest time in solving potential performance problem that might not even occur.
Is there any sources mentioning something about the lucene based API and the differences to TWSearch? There seems to be nothing about it on IBM-websites. I only found a mention of the word "lucene" here: https://www.ibm.com/support/knowledgecenter/en/SSFTBX_8.5.7/com.ibm.wbpm.ref.doc/ae/doc/JSAPI.html
Is there something fundamentally different between the two?
More...
I think our team uncovered it by looking at the implementation details of the Responsive Portal. I've not worked with it myself so I don't have the details ready to hand.
-Andrew Paier

Related Links

BPM 8.5 installation (deployment environment creation)
settting auto height of tabs
Pause System Service
BPM 8.5.5 node under WAS 8.5 Dmgr
ibpm 8.0.1 to 8.5 Migration
Cannot find POReference - Effects UCA jobs Failed
Auto fill an Output text using a drop down
Integration BPM SAP
Unable to access bpmwiki
Adding tasks to an active BPD instance
Cannot find POReference with id
bpm v8 process designer refresh problem on table
onChange for TypeAHead in IBM BPM 7.5
Portal Admin Group - Authorization Settings
An exception occurred in an EJB call while starting the Process Server BPM 8.5 Express
Brazos ComboBox

Categories

DW
IBM Connections Cloud
Unica
IBM Tivoli Monitoring ...
IBM ILOG
ibm_ru
dW Korea
test
Globalization
Tivoli
IBM Connections Docs C...
IBM Kenexa BrassRing o...
IBM Kenexa Prove It! O...
Application Performanc...
Installation and Setup
Detect
IBM TRIRIGA UX Framework
Jazz for Service Manag...
Endpoint Protection
Web Reports and Custom...
Collaboration Network
Cast Iron Web Manageme...
RDi - Rational Develop...
IBM ILOG Optimization
Cognos Express
IBM Rational Asset Ana...
Reserved for Testing
Test Forum for Alberto
Lotus Brasil
Greenhouse
IBM Globalization
Tivoli
Tivoli Netcool Perform...
IBM i
Java
InfoSphere Master Data...
IBM Toolbox for Java a...
Part 3 - Challenge #08...
BigFix App for QRadar ...
Công ty thiết kế website
Visualization
IBM Integration Design...
WebSphere Portal and P...
CICS Explorer
WebSphere DataPower XC...
IBM Security Identity ...
QRadar Extensions
Reports
QRadar Incident Forens...
QRadar Risk Manager
Transportation Managem...
Business Process Modeling
Learning @ Sterling Co...
Gentran Integration Su...
Education
Gentran Mapping
Gentran Server for Win...
**NEW** Sterling File ...
Connect:Enterprise Gat...
Connect:Direct for UNIX
Miscellaneous
SDK Releases
C3 Configurator
Test Area
Comergent Courses
Upgrade Issues
Release 6.0
Connect:Direct (Educat...
Internationalization a...
Extensibility
WebLogic - JMS
HATS HotSpot
Constraint Programming
Mathematical Programming
Java Visualization Pro...
JRules Trial Support -...
General BRMS Discussion
Форумы WebSphere
Анонсы
Документация по решени...
Storage Management
Tivoli Workload Automa...
IBM Cloud Application ...
IBM i: Backup/Recovery
System z Hardware Mana...
IBM WebSphere Applicat...
Java filter

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile