• Inline evaluation error in OpenKM 5.1.8

  • OpenKM has many interesting features, but requires some configuration process to show its full potential.
OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #40503  by hariharan.gopal
 
Hi,

I used the below to script in Scripting Tab and got some errors. Below are the details

Scripts:
Code: Select all
import javax.jcr.*;
import com.openkm.core.*;
import com.openkm.bean.*;
import com.openkm.api.OKMDocument;

String userID = session.getUserID();
//if (userID.equals("okmAdmin"))
//    return;          // RRRRRRRRRRRRRRRRRRRRRRReturn

String startPrefix = "2012AP";
int lengthOfPrefix = startPrefix.length(); 
int lengthOfDocPrefix = 10; // 2012APnnnn

String parentDir = com.openkm.util.FileUtils.getParent(eventNode.getPath());

Error:
Code: Select all
Sourced file: inline evaluation of: ``import javax.jcr.*; import com.openkm.core.*; import com.openkm.bean.*; impor . . . '' : Typed variable declaration : Attempt to resolve method: getUserID() on undefined variable or class name: session : at Line: 6 : in file: inline evaluation of: ``import javax.jcr.*; import com.openkm.core.*; import com.openkm.bean.*; impor . . . '' : session .getUserID ( )

So please help me on how to solve this error.

Thanks in Advance.
 #40517  by jllort
 
You are using an older OpenKM version, my first suggestion is upgrade to 6.3.

On which scenario is executing the script ? the user is logged when the script is executing. From where are you executing it, administration or script on some node ?

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.