Page 1 of 1

Inline evaluation error in OpenKM 5.1.8

PostPosted:Fri Sep 11, 2015 10:12 am
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.

Re: Inline evaluation error in OpenKM 5.1.8

PostPosted:Sun Sep 13, 2015 9:03 am
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 ?