Cannot update List of GAI Workflow at 4 keys; length of assign value list (46) does not match length of the list to update (4)

Certified Senior Developer

While executing PM i am getting error how can i resolve ?

a!localVariables(
  local!currGrantWorkflow: rule!GAI_getWorkflow(workflowId: ri!workflowId).data,
  local!refDecTree: if(
    rule!SCO_isBoolNotEmptyAndTrue(
      local!currGrantWorkflow['recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{5febe064-3783-49f6-ac2c-1f69ce22e5b5}isCustomWorkflow']
    ),
    null,
    rule!GAI_getRefWorkflowDecisionTree(
      currStatusId: local!currGrantWorkflow['recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{7cd66171-e9d3-45ae-9967-fe88fbd9f594}fkWorkflowTypeStatusId'],
      taskDecisionId: ri!taskDecisionId
    ).data
  ),
  local!customDecTree: if(
    rule!SCO_isBoolBlankOrEmptyOrFalse(
      local!currGrantWorkflow['recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{5febe064-3783-49f6-ac2c-1f69ce22e5b5}isCustomWorkflow']
    ),
    null,
    rule!GAI_getCustomWorkflowDecisionTree(
      currStatusId: local!currGrantWorkflow['recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{7cd66171-e9d3-45ae-9967-fe88fbd9f594}fkWorkflowTypeStatusId'],
      taskDecisionId: ri!taskDecisionId
    )
  ),
  local!nextStatusId: if(
    rule!SCO_isBoolNotEmptyAndTrue(
      local!currGrantWorkflow['recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{5febe064-3783-49f6-ac2c-1f69ce22e5b5}isCustomWorkflow']
    ),
    local!customDecTree['recordType!{a40eed83-2094-46ce-aef5-fca7da4f29e8}GAI Custom Workflow Decision Tree.fields.{29f44dde-1de1-4125-8363-54dcf85519c6}fkNextWorkflowStatusId'],
    local!refDecTree['recordType!{c50c1c2c-8759-4483-9f95-8c12ba42f4be}GAI Ref Workflow Decision Tree.fields.{3bf65603-7f29-486f-b7cf-1a53d94ed2c0}fkNextWorkflowStatusId']
  ),
  local!newGrantWorkflow: if(
    local!nextStatusId = local!currGrantWorkflow['recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{7cd66171-e9d3-45ae-9967-fe88fbd9f594}fkWorkflowTypeStatusId'],
    null,
    if(
      a!isNullOrEmpty(local!nextStatusId),
      local!currGrantWorkflow,
      a!update(
        local!currGrantWorkflow,
        {
          'recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{559ab16f-8958-4603-84a2-f485f5b0651a}assignedTs',
          'recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{7cd66171-e9d3-45ae-9967-fe88fbd9f594}fkWorkflowTypeStatusId',
          'recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{77ff57c7-14f7-4dfc-a103-81afaee4e8d8}updateTs',
          'recordType!{f8c3f153-12d0-4850-97d9-bd6878795255}GAI Workflow.fields.{f007d4d7-7ee0-4736-98f4-c34f3aac3dfb}updateUsr'
        },
        {
          now(),
          local!nextStatusId,
          now(),
          null
        }
      )
    )
  ),
  a!map(
    currGrantWorkflow: local!currGrantWorkflow,
    newGrantWorkflow: local!newGrantWorkflow
  )
)

An error occurred while evaluating expression: =rule!GAI_getNextWorkflowStatus(  workflowId: pv!workflowId,  taskOwner: pv!taskOwner,  taskDecisionId: pv!taskDecisionId) (Expression evaluation error in rule 'gai_getnextworkflowstatus' at function a!update [line 36]: Cannot update List of GAI Workflow at 4 keys; length of assign value list (46) does not match length of the list to update (4)) (Data Inputs)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    From the described error, it is conveyed that local!currGrantWorkflow is a list of type GAI Workflow and has 46 rows in it (local!currGrantWorkflow is holding the 46 copies of recordType GAI Workflow). And you are trying to update the 4 fields into it. 
    The simple solution would be, if you want to update all the 46 rows then run a forEach() to update the local!currGrantWorkflow as it is holding multiple rows, or specify the index of the local!currGrantWorkflow where you want to update the 4 fields (assignedTs, fkWorkflowTypeStatusId, updateTs, updateUsr)

Reply
  • 0
    Certified Lead Developer

    From the described error, it is conveyed that local!currGrantWorkflow is a list of type GAI Workflow and has 46 rows in it (local!currGrantWorkflow is holding the 46 copies of recordType GAI Workflow). And you are trying to update the 4 fields into it. 
    The simple solution would be, if you want to update all the 46 rows then run a forEach() to update the local!currGrantWorkflow as it is holding multiple rows, or specify the index of the local!currGrantWorkflow where you want to update the 4 fields (assignedTs, fkWorkflowTypeStatusId, updateTs, updateUsr)

Children