How to use record links in a paging grid?

Hello,

I am trying to build a paging grid based on a data store entity. So far I have been successful in populating the grid and everything is working as expected. A new requirement was made and now the reqeust name (which is the first column of the grid) should be a link to the record it correspond to (i.e. I click on the request name and I should navigate to the summary view of that record). I've tried a few different approached but haven't been able to get a working solution. Any help will be appreciated. Thanks in advance.

 

Approach #1:

(Only creates a link in the first item in the grid and when clicked navigates to records but errors out "An Error Has Occurred An error was encountered while processing your request. ")

a!gridTextColumn(
              label: "Name",
              field: "contributionRequestName",
              data: index(
                local!datasubset.data,
                "contributionRequestName",
                null
              ),
              links: a!recordLink(
                label: index(
                  local!datasubset.data,
                  "contributionRequestName",
                  null
                ),
                recordType: cons!SCP_CONTRIBUTION_REQUEST_RECORD_TYPE,
                identifier: index(
                  local!datasubset.data,
                  "contributionRequestName",
                  null
                )
              )
            )

Approach #2:

(Only creates a link in the first item in the grid and when clicked navigates to records but errors out "An Error Has Occurred The record data does not exist, has been deleted, or you do not have sufficient privileges to access it.")

a!gridTextColumn(
              label: "Name",
              field: "contributionRequestName",
              data: index(
                local!datasubset.data,
                "contributionRequestName",
                null
              ),
              links: a!recordLink(
                label: index(
                  local!datasubset.data,
                  "contributionRequestName",
                  null
                ),
                recordType: cons!SCP_CONTRIBUTION_REQUEST_RECORD_TYPE,
                identifier:local!datasubset.data.id
              )
            )

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Thank you, I think I am getting closer. As you mentioned, adding the looping function did create a link for every row, however I think the identifier portion is not working as expected as they all get redirected to environment.url/.../summary which results in the following error: "An Error Has Occurred The record data does not exist, has been deleted, or you do not have sufficient privileges to access it." This is the code I used. Thanks again. 

     

    a!gridTextColumn(
                  label: "Name",
                  field: "contributionRequestName",
                  data: index(
                    local!datasubset.data,
                    "contributionRequestName",
                    null
                  ),
                  links: a!forEach(
                    items: local!datasubset.data,
                    expression: a!recordLink(
                      label: index(
                        local!datasubset.data,
                        "contributionRequestName",
                        null
                      ),
                      recordType: cons!SCP_CONTRIBUTION_REQUEST_RECORD_TYPE,
                      identifier: fv!item.id
                    )
                  )
                )

  • Also tried the following with the same result:

    a!gridTextColumn(
    label: "Name",
    field: "contributionRequestName",
    data: index(
    local!datasubset.data,
    "contributionRequestName",
    null
    ),
    links: a!forEach(
    items: local!datasubset.data,
    expression: a!recordLink(
    label: fv!item,
    recordType: cons!SCP_CONTRIBUTION_REQUEST_RECORD_TYPE,
    identifier: fv!item.id
    )
    )
    )

  • Try something like this:

    links: a!forEach(
      items: index(local!datasubset.data, "id", {}),
      expression: a!recordLink(
        recordType: cons!APP_RECORD_TYPE,
        identifier: fv!item
      )
    )

     

    If that doesn't work, verify that the "id" column of your CDT is the primary key for the table, and also verify that you are able to access the record otherwise. Finally ensure that security/access rights are set up correctly on the record as well.

  • I tried this code as well as a similar version using identifier:fv!itemid and none seem to work. I think you are correct in that the issue is in the CDT. The primary key of the CDT is actually the request ID and this field is retrieving the request name. Maybe including the request ID in the query and using it here would work?
  • Correct - I assumed that your datasubset has the values you need (including primary key) and that they can be indexed out.
    Basically you need to ensure that your primary key column is in the query selection (if a selection is specified), and then line 2 of what I sent before should change to index(local!datasubset.data, "requestId", {}) where "requestId" is the CDT field of your primary key.
  • Hello Oscar,

    I added some comments  to the Code

    1) since you are in a for each you need to change this for each item, with "fv!item" that way you will get the value. 

    2) From the cdt what you are displaying, please make sure that the primary key is "id" and not other field. 

    to do this open the CDT and check which filed has the "yellow key" on it, if  the fields is not "id" then please change it in the code "fv!item.idField" or use index as you did with the data [index(fv!item,"idField",null)]

    I hope this still help you. 

     

    a!gridTextColumn(
      label: "Name",
      field: "contributionRequestName",
      data: index(
        local!datasubset.data,
        "contributionRequestName",
        null
      ),
      links: a!forEach(
        items: local!datasubset.data,
        expression: a!recordLink(
          label: index(
            fv!item, /*(1)*/
            "contributionRequestName",
            null
          ),
          recordType: cons!SCP_CONTRIBUTION_REQUEST_RECORD_TYPE,
          identifier: fv!item.id /* (2)*/
        )
      )
    )

     

    Jose

  • Thank you all, it was all of great help! I finally got it working.
  • 0
    A Score Level 2
    in reply to Ashvin Kapur

    Hi Ashvin,

    Was struggling with this, found your solution and it worked perfectly.

    Thanks
    Dave