Skip to Content
Oct 19, 2021 at 04:26 PM

Read the valuemapping fields into Groovy Scritp


Hello All,

Hope All Doing Good....

I am done same to same like below blog because of same requirement currenty I am working on.

Single destination to multipule idoc dispatching

Value Mapping:

Groovy Script:

import java.util.HashMap;
def Message processData(Message message) {
    //Get runtime parameters - IDOC
    def controlSegmentFieldsStr = helperValMap.getMappedValue(runtimeAgency, 'PARAMETER', 'controlSegmentFields' , runtimeAgency, 'VALUE');
    if (controlSegmentFieldsStr == null){ throw new Exception("NF: Control Segment Fields") }
    def controlSegmentFieldsArr = controlSegmentFieldsStr.tokenize(fieldSeparator);
    //Analyse Idoc Control Segment
    def body = msg.getBody();
    def xml  = new XmlSlurper().parseText(body);
    def keySender = [];
    keySender = keySender.join(fieldSeparator);
    //Get Receiver Address
    def keyReceiver = helperValMap.getMappedValue(srcAg, 'SENDER', keySender , tgtAg, 'RECEIVER');
    //Set Property - Receiver Address 
    def map = msg.getProperties();
    msg.setProperty( keyReceiver, "receiverAddr");

Error Details:

javax.script.ScriptException: java.lang.Exception: groovy.lang.MissingPropertyException: No such property: helperValMap for class: script1__Script@ line 22 in script1.groovy, cause: groovy.lang.MissingPropertyException: No such property: helperValMap for class: script1__Script

If possiable based on value mapping screen shot please share the code that would e great help I am not that much familiar in codeing.