1
0
-1

Hi,

I have a problem with hashvariable in notification.

You can see below :

  • configuration for plugin "User notification"
  • the result in a mail


#assignment.processName# = "Départ d'un agent"

If I use #assignment.processName# alone, no problem.

If I use the expression #exp.'{assignment.processName?expression}'.isEmpty()?'empty':{assignment.processName}#, the hashvariable assignment.processName is unknow.


What's wrong ?






    CommentAdd your comment...

    3 answers

    1.  
      1
      0
      -1

      In user notification plugin, I identify this code :

      https://github.com/jogetworkflow/jw-community/blob/50d9017f1d548c6cce76a42fe5b8ecf9261adcd9/wflow-core/src/main/java/org/joget/apps/app/lib/UserNotificationAuditTrail.java


                                              } else {
                                                  String tempEmailMessage = emailMessage;
                                                  if (emailMessage.contains("#assignment.link#")) {
                                                      tempEmailMessage = tempEmailMessage.replaceAll(StringUtil.escapeRegex("#assignment.link#"), StringUtil.escapeRegex(tempLink));
                                                  } else {
                                                      tempEmailMessage = emailMessage + "\n\n\n" + tempLink;
                                                  }
                                                  formattedMessage = AppUtil.processHashVariable(tempEmailMessage, wfAssignment, null, replace);
                                                  
                                                  //TODO: consider replace the next line to platform-wise support parsing of hash variables in the value returned by another hash variable
                                                  formattedMessage = AppUtil.processHashVariable(formattedMessage, wfAssignment, null, replace);
                                                  
                                                  email.setMsg(formattedMessage);


      Is my code in the TODO case ?


        CommentAdd your comment...
      1.  
        1
        0
        -1

        Thank you !

        In fact, I have already changed the expression with quotes to have :

        #exp.'{assignment.processName?expression}'.isEmpty()?'empty':'{assignment.processName}'#

        And the response is

        {assignment.processName}

        1. Ian

          which version are you using? 

        2. Didier Testelin

          I use the last one.

          7.0.34

        CommentAdd your comment...
      2.  
        1
        0
        -1

        add single quotes for the else statement

        from

        #exp.'{assignment.processName?expression}'.isEmpty()?'empty':{assignment.processName}#

        to

        #exp.'{assignment.processName?expression}'.isEmpty()?'empty':'{assignment.processName}'#

          CommentAdd your comment...