Getting error "Null argument not allowed"

Certified Associate Developer

I have below expression to get the country groups without groups ids. It is working fine when I pass the country name without special characters. 

if(
  rule!APN_isBlank(ri!countryName),
  {},
  a!forEach(
    items: ri!countryName,
    expression: rule!APN_replaceNull(
      nullableValue: group(
        tointeger(getgroupbyname("RGRACSLBL_" & fv!item)),
        "groupName"
      ),
      replacementValue: group(
        tointeger(
          getgroupbyname(
            "RGRACSLBL_" & stripwith(
              fv!item,
              joinarray(cons!RGRACSLBL_SPECIAL_CHARACTERS, "")
            )
          )
        ),
        "groupName"
      )
    )
  )
)

But I'm getting below error when I pass a country with special character even though I have special character check in the code. Please help in resolving the error. 

For example the country name with special characters : "Bolivia, Plurinational State of", I should get the group name as "RGRACSLBL_Bolivia Plurinational State of"

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Lead Developer

    The issue here is that the group() function does not like NULL values. If getgroupbyname does not return anything, you run inti this issue. Changing your code like this might help. I can not test it and it might contain typos of missing commas.

    if(
      rule!APN_isBlank(ri!countryName),
      {},
      a!forEach(
        items: ri!countryName,
        expression: group(
          rule!APN_replaceNull(
            nullableValue: tointeger(getgroupbyname("RGRACSLBL_" & fv!item)),
            replacementValue: tointeger(
              getgroupbyname(
                "RGRACSLBL_" & stripwith(
                  fv!item,
                  joinarray(cons!RGRACSLBL_SPECIAL_CHARACTERS, "")
                )
              )
           )
         ),
         "groupName"
      )
    )

Reply
  • +1
    Certified Lead Developer

    The issue here is that the group() function does not like NULL values. If getgroupbyname does not return anything, you run inti this issue. Changing your code like this might help. I can not test it and it might contain typos of missing commas.

    if(
      rule!APN_isBlank(ri!countryName),
      {},
      a!forEach(
        items: ri!countryName,
        expression: group(
          rule!APN_replaceNull(
            nullableValue: tointeger(getgroupbyname("RGRACSLBL_" & fv!item)),
            replacementValue: tointeger(
              getgroupbyname(
                "RGRACSLBL_" & stripwith(
                  fv!item,
                  joinarray(cons!RGRACSLBL_SPECIAL_CHARACTERS, "")
                )
              )
           )
         ),
         "groupName"
      )
    )

Children