or function doesn't seem to be working as expected

I have this expression rule :

a!localVariables(
  /* Loop checks against passed in value of type to pull values
     from specific requirementActivity match */
  a!forEach(
    items: ri!requirement.requirementActivities, 
    expression: 
    if(contains(fv!item.type, ri!activityType),
      'type!{urn:com:appian:types:UW}UW-Requirement-Activity'(
        key: fv!item.key,
        type: fv!item.type,
        creatorId: fv!item.creatorId,
        creatorFullName: fv!item.creatorFullName,
        createdDate: fv!item.createdDate,
        commentText: fv!item.commentText
    ), 
    {}), 
  ),
),

And I'm using it in my interface :

a!localVariables(
      requirementsResponse: rule!UW_GetRequirementsByCase_RDS("SomeKey"),
      local!requirements: {
        a!forEach(
          items: local!requirementsResponse,
          expression: 
          a!map(
            type: fv!item.name,
            status:fv!item.status,
            orderDate: fv!item.createdTimestamp,
            orderRep: fv!item.requestedBy,
            receiveDate: rule!UW_GetRequirementActivityByType(fv!item, "RECEIVED").createdDate,
            receiveRep: rule!UW_GetRequirementActivityByType(fv!item, "RECEIVED").creatorFullName,
            resolveDate: rule!UW_GetRequirementActivityByType(fv!item, or("WITHDRAWN", "ACCEPTED")).createdDate,
            resolveRep: rule!UW_GetRequirementActivityByType(fv!item, or("WITHDRAWN", "ACCEPTED")).creatorFullName,
            resolutionStatus: rule!UW_GetRequirementActivityByType(fv!item, or("ACCEPTED", "WITHDRAWN")).type,
            resolutionNotes: rule!UW_GetRequirementActivityByType(fv!item, or("ACCEPTED", "WITHDRAWN")).commentText
            )
        )
      },

Which I'm using to help populate fields. Everything works great until I save close out and go back...

Then I end up with this error: "Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!forEach [line 6]: Error in a!forEach() expression during iteration 11: Expression evaluation error at function a!map parameter 7 [line 16]: Invalid index: Cannot index property 'createdDate' of type Text into type List of Variant"

Which is pointing to : resolveDate: rule!UW_GetRequirementActivityByType(fv!item, or("WITHDRAWN", "ACCEPTED")).createdDate,

It's not a fan of how I am using the or function - if I remove it and just pass one of the options all is fine. However I only want these fields populated if one or the other value is found. Is there another way to do this? I feel like this should work and again it does but then it does not.

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data