cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to Read History in Trigger Script.

hruke
1-Newbie

How to Read History in Trigger Script.

Hi,

I execute following CLI in script, which gives me response.

var command = new Packages.com.mks.api.Command("im", "viewissue");

   command.addOption(new Packages.com.mks.api.Option("showHistory"));

   ProjectID = 30300;

   command.addSelection(ProjectID);

  

   var response = api.executeCmd(command);

   if(response != null)

   {

     var status = response.getWorkItems().next();

     //want history here

   }

I don't know how to read History through it, here I want what modification was done on the project 30300 in last few days. 

Is there any method in API Bean instead of CLI ?

3 REPLIES 3
JoeBartlett
21-Topaz I
(To:hruke)

Hi Hanumant,

There is an existing enhancement request asking for item history to be exposed via the trigger beans. See RFC 339587 for details and please contact PTC Technical Support to have your organization added to the request.

In the meantime, the only workaround is to use the API as you are already doing.

Edit: If you want to see the API response you should expect, try running the command through the mksapiviewer. Eg:

mksapiviewer --iplocal im viewissue --showHistory 123

KaelLizak
14-Alexandrite
(To:JoeBartlett)

Hello Hanumant,

If you found Joe's response useful, could you please let us know by clicking on the Correct Answer button on his post?

If Joe's answer wasn't useful, could you let us know, so that we can see if there is something else we could do to help you?

Thanks,

Kael


Kind Regards,
Kael Lizak

Senior Technical Support Engineer
PTC Integrity Lifecycle Manager
ptc-4672132
5-Regular Member
(To:KaelLizak)

Hi Kael,

 

I've come up against the same problem as hruke, but am unsure what should go where they have written

//want history here

 

 

I'm quite happy to use the API as Joe suggested, and have used his mksapiviewer code line to see the response. The response in the command prompt is perfect, listing all of the history etc. However, how can I access this from the response object?

 

I'm really struggling to find the correct method to extract the history field, any help you can give would be much appreciated.

 

Thanks

Top Tags