Can someone throw in their idea on how we can debug the javascript that we write from the bulk action script from ACCE? I understand that the alert or debug statement may not work there. What are the other options we have?
Asked
Active
Viewed 1,097 times
1 Answers
2
What I do is write the script in java.
The imports are almost the same. Variables need to be redeclared as var instead of String etc. Everything else is pretty much the same.
Some things you might want to note: You might need to call refresh right away on ceobject. You will probably want to set up a java class with a method that brings in ceobject just like the JavaScript does.
IBM provides a JavaScript example of Setting document properties. There are other examples on the same page that demonstrate the use of Java api from within ACCE JavaScript.
This is a particularly good example as it shows one of the most common uses of the Bulk Update functionality:
importClass(Packages.com.filenet.api.property.Properties);
importClass(Packages.com.filenet.api.constants.RefreshMode);
function OnCustomProcess (CEObject)
{
CEObject.refresh();
CEObject.getProperties().putValue("DocumentTitle", "Test1");
CEObject.save(RefreshMode.REFRESH);
}
The exact same code written in Java:
import com.filenet.api.property.Properties;
import com.filenet.api.constants.RefreshMode;
import com.filenet.api.core.Document;
public class Java2JavaScript {
public void OnCustomProcess (Document CEObject)
{
CEObject.refresh();
CEObject.getProperties().putValue("DocumentTitle", "Test1");
CEObject.save(RefreshMode.REFRESH);
}
The following differences can be noted:
- import statement syntax is slightly different.
- The CEObject import is not needed for JavaScript, but is needed for Java. However it can be included in the JavaScript. In this case we import Document
import com.filenet.api.core.Document;
however other types of CEObject can be used instead of Document. - Your Java class will need a valid class definition.
- You must declare CEObject in your Java method. Further, any declarations in java (i.e. String someString) need to change to a JavaScript declaration (var someString)
- Java "public void OnCustomProcess (Document CEObject)" simply becomes "function OnCustomProcess (CEObject)". ACCE will only accept "function OnCustomProcess (CEObject)" as the called function.

Christopher Powell
- 714
- 4
- 13
-
probably a simple code snippet would help everyone :) – bajji Sep 15 '17 at 22:18
-
For sure. On my mobile so that won't happen until I'm back at a computer. – Christopher Powell Sep 15 '17 at 22:58
-
I'm waiting for the code snippet to upvote your answer :) – bajji Sep 20 '17 at 13:36
-
There you are sir! – Christopher Powell Sep 21 '17 at 16:24