Expression evaluation error at function a!gridField : A grid component has an invalid value for "userFilters". "userFilters" and "showSearchBox" may only be specified when the when "data" is sourced from record type

I am getting above error, I have a doubt for now I am using record data function to get the data and using it as a source for grid component.  i tried changing source to result to queryrecordtype  instead of recorddata also . so as this message suggest  Do I need to directly reference the recordtype in the data field of grid component?

  Discussion posts and replies are publicly visible

  • This is the variable I am saving the result 

     local!data:rule!WMS_AllTasksBasedOnRequest(
        clientId: ri!wmsClient['recordType!{f4cd7e71-921f-4b1a-b85d-75f79a3f5fad}WMS Client.fields.{98e00a2b-6fa6-4873-a07f-94b7aa3e111b}clientId'],
        requestID: ri!requestID
      ),
    This the code inside the rule

    if(
      and(
        a!isNotNullOrEmpty(ri!requestID),
        a!isNotNullOrEmpty(ri!clientId)
      ),
      a!recordData(
        recordType: 'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task',
       
        filters: a!queryLogicalExpression(
          operator: "AND",
          logicalExpressions: {
            a!queryLogicalExpression(
              operator: "OR",
              logicalExpressions: {
                a!queryLogicalExpression(
                  operator: "AND",
                  filters: {
                    a!queryFilter(
                      field: 'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.relationships.{d360027c-a72d-4cf4-8da1-64e5fc391a77}aoRequestMaster.fields.{f91b1837-e0b1-40ce-b1ed-82c5575133e8}clientId',
                      operator: "=",
                      value: ri!clientId
                    ),
            )
            }
    ),
    
    a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: 'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{7bd950c9-0815-4b17-9142-2d3c80fc8a27}statusId',
                  operator: "not in",
                  value: {
                    cons!WMS_REF_ID_TASK_STATUS_NOT_APPLICABLE,
                    cons!WMS_REF_TYPE_ID_TASK_STATUS_COMPLETED
                  },
                  
                )
              }
            ),
            a!queryLogicalExpression(
              operator: "AND",
              filters: {
                a!queryFilter(
                  field: 'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{9c423b5a-38cd-40f9-bf2e-40ec57a2c572}entityId',
                  operator: "=",
                  value: ri!requestID,
                  
                ),
                
              }
            ),
            
          },
          filters: {}
        ),
        
      ),
      null
    )

    This is where I am using that result

     a!gridField_24r3(
          labelPosition: "ABOVE",
          data: local!data,
          a!gridColumn(
              label: cons!WMS_LABEL_TASK_STATUS,
              value: rule!WMS_DisplayTags(
                fv!row['recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.relationships.{9c3378ff-9320-498b-80f3-f2c1e21cad09}wfmRefLookupTaskStatus.fields.{6f78955b-86b9-4b45-9319-b5e8ecb6c42c}value']
              ),
              align: "START"
            ),
             a!gridColumn(
              label: cons!AO_LABEL_ASSIGNEE,
              sortField: 'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{5dae0b96-9faf-45a6-956a-da18b35909aa}assignedToUser',
              value: if(
                a!isNotNullOrEmpty(
                  fv!row['recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{5dae0b96-9faf-45a6-956a-da18b35909aa}assignedToUser']
                ),
                rule!WMS_getUserFullName(
                  fv!row['recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{5dae0b96-9faf-45a6-956a-da18b35909aa}assignedToUser']
                ),
                if(
                  a!isNotNullOrEmpty(
                    tointeger(fv!row['recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{699be1a8-928c-4f3b-9858-eff2fa68a5c2}assignedToGroup'])
                  ),
                  if(
                    fv!row['recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{699be1a8-928c-4f3b-9858-eff2fa68a5c2}assignedToGroup'] = - 1,
                    group(
                      tointeger(cons!WMS_GRP_ALL_USERS),
                      "groupName"
                    ),
                    group(
                      tointeger(
                        fv!row['recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{699be1a8-928c-4f3b-9858-eff2fa68a5c2}assignedToGroup']
                      ),
                      "groupName"
                    )
                  ),
                  "Not Assigned"
                )
              )
            ),
          initialSorts: a!sortInfo(
            field: 'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.fields.{c81dc625-972c-4d3c-83a1-6a50b02bf11b}updatedOn',
            ascending: false()
          ),
          validations: {},
          refreshAlways: true(),
          refreshAfter: "RECORD_ACTION",
          userFilters: {
            'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.filters.{73fa1c28-e15f-48b9-a484-c036362f960f}Task Status',
            'recordType!{8ad84fc9-2626-4a24-96c1-facc97b02acf}WMS Task.filters.{e5aae71f-5fc9-43a1-9905-ffbddd031bf8}Assignee'
          },
          showSearchBox: true(),
          showRefreshButton: true(),
          showExportButton: true(),
          emptyGridMessage: "No Data Found",
          showWhen: a!isNotNullOrEmpty(local!data),
          
        )
      }

  • 0
    Certified Lead Developer

    Your rule might returns null when conditions aren't met. The grid's data parameter must always have record-sourced data when using userFilters/showSearchBox.
    Never return null from your rule. Always return a!recordData(), even if it's filtered to return zero records when conditions aren't met.

  • Okay, then can I just remove the condition and add the ignoreFiltersWithEmptyValues set to true. 

  • 0
    Certified Lead Developer
    in reply to iswaryan3520

    Yes, But Make sure, It will return ALL records (or records matching remaining filters) when values are empty.
    Test the rule properly to ensure it returns recordData instead of null.

  • 0
    Certified Lead Developer
    in reply to Shubham Aware

    Let me know if this works for you..

  • 0
    Certified Lead Developer
    in reply to iswaryan3520

    I never tried to store a!recordData into a local and put that local into the grid. I think the idea is to use a!recordData directly in the grid data parameter. My understanding is, that the internal logic of the grid directly interacts with a!recordData.

  • okay, I will take this in mind. Thank you Stefan.

  • 0
    Certified Lead Developer
    in reply to iswaryan3520

    In the 'data' of the grid you should configure the a!recordData() code directly. You can remove the local!data as well as the rule having a!recordData. Whatever filters you need to apply you can configure all that in the a!recordData() corresponding to 'data' of grid. The filter/logical expressions should have ignoreFIltersWithEmpty values so that a!recordData() returns data when filters are empty.