This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Cannot get Item ID from this.getID()

kylewegener - Monday, December 16, 2013 4:24 PM:


I am new to aras programming. I am trying to fetch the lock status of the current item in the method.

Innovator myInnovator = this.getInnovator();
if (this.fetchLockStatus() != 0) {
          Item myResult = myInnovator.newError("Please unlock MD!");
          CCO.Utilities.WriteDebug("xmltest","MD File is locked, exiting");
          return myResult;
string MDID = "";
MDID = this.getID();

After this portion of of the method is ran, an exception is thrown stating that the 'ID is not set'. Please let me know how I can correct this error. Thank you for your help.

Phil - Friday, December 20, 2013 11:27 PM:

Hey there-

 In order for us to help you, you will have to let us know when you are running this method. 

Based on the C# sharp code, I am assuming you are using a server method, but based on which Server Event you are triggering on, the THIS in this.getID() will have different context.

With that being said, which server event are you using? (onBeforeNew,onBeforeLock,onBeforeGet,etc....)

Usually when you get the 'ID is not set' error , that means THIS is actually out of context and not really referring to the Item you are expecting it to.