Skip to Content
avatar image
Former Member

How to change the long text dynamically based on the payload in the Alert configuration


Hi Experts,

Currently I am working on the scenario in which I need to send the number of records available in the xml file in the mail using Alert configuration.

I am getting a file like this

<HEADER></HEADER>

<RECORD></RECORD>

<RECORD></RECORD>

<RECORD></RECORD>

<TRAILER><RECORD_COUNT>3</RECORD_COUNT></TRAILER>

If number of records present in the file doesn't matches with the RECORD_COUNT present in the trailer, I am not mapping the root node, so message mapping is getting failed and triggering an Alert.

In this Alert mail, I need to send the RECORD_COUNT present in the file and actual number of the record by counting the record node as well.

E-mail will be "Number of records doesn't matches with the RECORD_COUNT".

Please provide suggestions on how to get these values dynamically in the long text of the Alert.

Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 09, 2015 at 02:35 PM

    Vaibhav,

    Put this logic in UDF, when mapping root node. Add Error message in alert configuration. Alert email will contain correct error message.

    if (Records!=Record_Count){
                throw new RuntimeException("Number of records doesn't matches with the RECORD_COUNT." + "Number of Records in input is"+ Records +"But RECORD_COUNT is " + Record_Count);
            }
    
    

    Another option,

    Trigger email from UDF. Link.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Raghu Vamseedhar Reddy KadipiReddy

      Hi Raghu,

      Thanks for the response.

      Issue is resolved now with the UDF for the message mapping, link which you have provided.