General Technical Discussions for Service

Get Involved. Join the Conversation.

Topic

    Hamzeh Al Karmi
    Groovy Script Issue
    Topic posted January 7, 2019 by Hamzeh Al KarmiSilver Medal: 2,000+ Points 
    59 Views, 2 Comments
    Title:
    Groovy Script Issue
    Summary:
    Problem entering a groovy script
    Content:

    Hello all,

    I have the below script that when pressing validate I got the below error. Can anyone help please?

    if (isAttributeChanged('Assigned To') && AssigneePersonName == 'bala.gupta')
    return StatusCd == 'In Progress-Agent'; 
    else
      if (isAttributeChanged('Assigned To') && AssigneePersonName == 'Lisa Jones')
      return StatusCd == 'In Progress-Senior';
    else
      if (isAttributeChanged('Assigned To') && AssigneePersonName == 'John Dunbar')
          return StatusCd == 'In Progress-Manager';

    Error generated when pressing Validate:

    Error(1,1) : An internal compiler error occurred: org.codehaus.groovy.syntax.RuntimeParserException: Cannot use return statement with an expression on a method that returns void . At [3:1] bc4j.null.gs.groovy See the logs for the error stack.

    Comment

     

    • Colby Ross

      Where are you defining StatusCD? Or is that supposed to be StatusID?

    • FNU Preksha

      Hi Al,

       

       hope you were able to resolve this. The StatusCd uses the code rathre than the description of the status. So if you replace each of the status value with the respective code. Then this would work.

       

      Example:

      In Progress-Manager status has the code  IN_PROGRESS_MANAGER

      StatusCd == 'IN_PROGRESS_MANAGER'