Custom script contains function not working


Hi, I am attempting to read data from an excel spreadsheet into Workfusion and then run a custom script to compare the text values from the excel spread sheet. Right now the only value i am attempting to compare the text functions to is “OPEN”, however every single time the contains function in the custom script does not pick up the “OPEN” value within the text from excel. If i just use the normal StringContains method from within the workfusion studio list it will pick it up but for some reason the custom script groovy .contains function does not. Does anyone have advice on this?

HI @shuan.vanhuyssteen why do you use a custom action? You can use a built-in If-Else condition action for that.

Hi, because i will probably need 180 if functions for it (as there are that many variations to test), i would rather just build a switch custom function or create a reference table to compare the values to. But if the contains formula does not work with this simple test then that solution is not viable

In essence what I am trying to do is compare one value that is read from an excel file to 200 other values and then returning a result based off of which of the 200 values the input is equal to

@shuan.vanhuyssteen you need to delete ==true from the If statement:

def customScript() {

         if (v_status.contains("OPEN")) {
         
         v_isaccount = RString.of ("Yes")
         
         }
         
         else {
         
         v_isaccount = RString.of ("No")

         }

    }

Thank you very much!

1 Like

Glad it helped !