How to print something on Change->History tab Agile SDK

Hi, I am trying to execute below  statement in my code which is landing me into API Exception. Change.logAction(“This is a message on History tab”). (Here Change is an object of IChange Type) Reading Oracle’s SDK Guide I understood that we History Table is a read only table but how does it print information on History tab when we try to execute the same statement inside a Custom Action or Event PX.

Why is this not working in a URL PX. Can anyone help me understand the logic behind this.

I also need to know if there is a way we can print a message on a Change’s History tab with a URL PX.

Agile User Asked on July 29, 2019 in Product Collaboration.
Add Comment
2 Answer(s)

Hi Tapan

Can you provide the stack trace for the API exception you are seeing?

Ideally this API

Change.logAction(“This is a message on History tab”). (Here Change is an object of IChange Type)

should work in URL PX as well

– Raj

Agile Professional Answered on July 29, 2019.

I am getting the below stack trace Exception in thread “main” java.lang.NoSuchMethodError: org.apache.log4j.helpers.Loader.loadClass(Ljava/lang/String;)Ljava/lang/Class; at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:247) at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176) at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191) at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523) at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:436) at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1004) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:872) at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:778) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:454) at org.apache.log4j.LogManager.<clinit>(LogManager.java:127) at org.apache.log4j.Logger.getLogger(Logger.java:110) at com.agile.pc.cmserver.base.CMLogger.setLogClass(CMLogger.java:37) at com.agile.util.log.CMLogFactory.getLogger(CMLogFactory.java:72) at com.agile.util.exception.AppException.<clinit>(AppException.java:28) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.sun.proxy.$Proxy4.<clinit>(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.reflect.Proxy.newInstance(Unknown Source) at java.lang.reflect.Proxy.newProxyInstance(Unknown Source) at com.agile.api.pc.EJBRemoteProxy.createRemoteProxy(EJBRemoteProxy.java:59) at com.agile.api.pc.EJBLookup.getRemoteInterface(EJBLookup.java:988) at com.agile.api.pc.EJBLookup.getRemoteInterface(EJBLookup.java:935) at com.agile.api.pc.EJBLookup.getChangeSession(EJBLookup.java:303) at com.agile.api.pc.change.Change.getBean(Change.java:106) at com.agile.api.pc.DataObject$logActionAction.doSdkAction(DataObject.java:1037) at com.agile.api.common.SDKAction.run(SDKAction.java:23) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146) at weblogic.security.Security.runAs(Security.java:61) at com.agile.api.common.WebLogicAuthenticator.doAs(WebLogicAuthenticator.java:111) at com.agile.api.common.Security.doAs(Security.java:54) at com.agile.api.common.Security.doAs(Security.java:109) at com.agile.api.pc.DataObject.logAction(DataObject.java:518) at com.test.RegexTest.main(RegexTest.java:71)  

Have you ever tried printing something in History tab with a simple program and it worked at your end?

on August 1, 2019.

Hi Tapan

Yes, we have used the exact same calls in several programs without any issues

Looking at the stack trace, it seems to be related to some jar . Can you please check the log4j jar you are using in your URL app and see if it is compatible? Starting from RUP releases, Agile now provides the compatible version of 3rd party jars. Here is an example

https://updates.oracle.com/Orion/Services/download?type=readme&aru=23011979

This might give a clue

on August 2, 2019.

That is strange but anyways thanks for sharing the above info.

To be more specific in my case below is my code which is resulting in the exception. —————————————————————————————————-

public static void main(String args[])

try

{

// Creating agile session in variable ‘session’

IChange change = (IChange)session.getObject(IChange.OBJECT_TYPE, <Change_number>);

change.logAction(“This is test message”);

}

catch(Exception e)

e.printStackTrace()

}

—————————————————————————————————-

I am trying to print the message in History tab not with a URL PX but with a simple java program instead. I hope this is no different than a URL PX itself.

Any more comments?

on August 5, 2019.

That’s correct. It is no different in an URL PX except that the Session and Change object you are working on is provided to Agile automatically

 

Question – Are you able to do anything with the session? Like printing the user details of the session to a log. Or, is this is the first statement?  I am thinking that you have a problem getting even the session

on August 6, 2019.

I just ran the exact same piece of code again and it worked now. Not sure what magic happened..!!

I was on vacations for a week, so just touched the code today again.

Anyways, thanks a lot for your help.

on August 14, 2019.

Good that it worked. My guess is your SDK cache got cleared and that helped resolve the issue

on September 4, 2019.
Add Comment

Hi Tapan,

Can you please confirm if  the Agile API.Jar File  used in the URL PX is same picked from Application Server.

Change.logAction(“Message”); should work .

 

Alternately you may use change.send(IUser[] arg0, String arg1) which logs the Message in the Comments Section of History Table.

(This gets captured as Send Action and custom message is displayed in the comments. You may send it to admin. But using this has its own limitations like  requires send Privilege,notifications to admin user etc).

 

Regards,

Karthik

Agile Talent Answered on July 31, 2019.

Hi Karthik,   The AgileAPI.jar file is the same one residing on my app server. Have you tried printing something on history tab with a simple 2 liner sdk program and did that work for you?

on August 1, 2019.

Yes Tapan.

That works and updates History Tab.

 

on August 5, 2019.

To be more specific in my case below is my code which is resulting in the exception. —————————————————————————————————-

public static void main(String args[])

try

{

// Creating agile session in variable ‘session’

IChange change = (IChange)session.getObject(IChange.OBJECT_TYPE, <Change_number>);

change.logAction(“This is test message”);

}

catch(Exception e)

e.printStackTrace()

}

—————————————————————————————————-

I am trying to print the message in History tab not with a URL PX but with a simple java program instead. I hope this is no different than a URL PX itself. Any more comments?

on August 5, 2019.

Hi Tapan,

Are you getting the exception with standalone program as well (or) only in URL PX?

What is the version of Agile you are using?

on August 5, 2019.

Hi Karthik,

I just ran the exact same piece of code again and it worked now…!! This is very surprising for me. I was on vacations for a week, so just touched the code today.

Thanks a lot for your help.

on August 14, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.