AnsweredAssumed Answered

how to find value with Groovy

Question asked by AlexeyDmitriev6991 on Jun 14, 2016
Latest reply on Jun 15, 2016 by AlexeyDmitriev6991

Hi guys,

please advise how to find and output cust_JiraTaskId. I need the value of cust_JiraTaskId based on the max number of <externalCode> inside node  <cust_JiraTask> . In this example it'll be 111111.














I managed to find the max externalCode and now i need cust_JiraTaskId value.


My script is below -


// Create an XPath statement to search for the element or elements you care about:

  XPath x;

  x = XPath.newInstance("//cust_JiraTask/externalCode");

  myElements = x.selectNodes(doc);

  String maxvalue = "";


  for (Element myElement : myElements) {

    if (myElement.getValue() > maxvalue)


      maxvalue = myElement.getValue();



props.setProperty("document.dynamic.userdefined.externalCode", maxvalue);


thanks for help.