Expression error: Null Arguments are Invalid) (Data Inputs)

Hi All,

I am getting expression error when trying to pass the below rule in the input a user input task. I am passing the correct PV value in every step of my flow. Please suggest if there is anything wrong in this rule. Thanks in advance. 

Expression error: An error occurred while evaluating expression: =rule!REGAL_cdt_getDocumentsFromFolder(pv!caseDocFolder) (Expression evaluation error in rule 'REGAL_cdt_getdocumentsfromfolder' at function 'getdocumentinternalidsfromfolder' [line 2]: Null Arguments are Invalid) (Data Inputs)

REGAL_cdt_getdocumentsfromfolder Rule Code:

load(
local!documentsFromFolder: getdocumentinternalidsfromfolder(
ri!folder,
false()
),
a!forEach(
items: local!documentsFromFolder,
expression: cast(
'type!{urn:com:appian:types}REGAL_documents'(),
{
documentId: tointeger(
fv!item
),
documentName: document(
tointeger(
fv!item
),
"name"
),
createdBy: document(
fv!item,
"lastUserToModify"
),
createDateTime: document(
fv!item,
"dateCreated"
)
}
)
)
)

  Discussion posts and replies are publicly visible

Parents
  • The rule you have listed is fine. From the error, the problem is that 'ri!folder' is null when this SAIL gets evaluated. When testing this rule in an expression rule, make sure the rule input for folder is not null. It's also helpful to have null checking to catch these errors such as:

    local!documentsFromFolder: if(
                                    isnull(ri!folder),
                                    {},
                                    getdocumentinternalidsfromfolder(
                                        ri!folder,
                                        false
                                    )

    It may help to look at process monitoring as well to see if the pv for folder has a value.

Reply
  • The rule you have listed is fine. From the error, the problem is that 'ri!folder' is null when this SAIL gets evaluated. When testing this rule in an expression rule, make sure the rule input for folder is not null. It's also helpful to have null checking to catch these errors such as:

    local!documentsFromFolder: if(
                                    isnull(ri!folder),
                                    {},
                                    getdocumentinternalidsfromfolder(
                                        ri!folder,
                                        false
                                    )

    It may help to look at process monitoring as well to see if the pv for folder has a value.

Children
No Data