Skip to main content
ankitt714102
June 30, 2021
Question

Refresh Record View from Interface

  • June 30, 2021
  • 6 replies
  • 0 views

I am working on a interface where in top of header of interface I am showing count of any column data for eg: comments(15), and it fetch from data record view .I want to refresh this record view when I will click on submit button on my present  interface, but refreshing is not working for record view.

Please suggest the best way to implement this functionality.

    6 replies

    csteward
    June 30, 2021

    Can you share a few more details on your configuration/SAIL setup?  How are the counts obtained?  Is the interface a process start form?  "Submitting" an interface generally takes you away from it, but you are staying on the same interface with the counts?

    sushilk061231
    June 30, 2021

    Hello ankit0001,

    please share the code snippet how you are using a!refreshVariable() , are you using refreshAlways or  refreshAfter?, hopefully this parameter suites your requirement,

    ankitt714102
    July 1, 2021

    Hi, Following code I am using.I am using refreshAlways:true() .

    Expression Rule: Test_GetUnreadCommentCount

    ////////////////////////////////////////////////////////////////////////////////////////

    a!localVariables(
    local!unreadMsgCount:
    a!queryEntity(
    entity: cons!TEST_REQUEST_COMMENTS,
    query: a!query(
    selection: {},
    logicalExpression:
    a!queryLogicalExpression(
    operator: "AND",
    filters: {
    a!queryFilter(
    field: "requestid",
    operator: "=",
    value: ri!requestId
    ),
    a!queryFilter(
    field: "isreadcomments",
    operator: "=",
    value:"N"
    ),
    a!queryFilter(
    field: "createdby",
    operator: "<>",
    value:tostring(loggedInUser())
    )
    }
    ),
    pagingInfo: a!pagingInfo(1,-1,{})
    )
    ).totalCount,

    " Comments (" & local!unreadMsgCount & ")",
    )

    //////////////////////////////////////////////////////////////////////////////////////////

    Another one when I am calling this rule on my Record Type =>  Record View Name Section is following:

    a!localVariables(
    local!unreadComment:
    a!refreshVariable(
    value:rule!Test_GetUnreadCommentCount(requestId:rv!identifier),
    refreshAlways: true,
    ),
    local!unreadComment
    )

    ///////////////////////////////////////////////////////////////////////////////////////

    July 1, 2021

    Hi Ankit,

    Remove the local variables inside the expression Rule: Test_GetUnreadCommentCount. If the identifier does not change, the query rule will not refresh if you have it inside local variables, so if you have the query directly, your count will be refreshed.

     a!queryEntity(
        entity: cons!TEST_REQUEST_COMMENTS,
        query: a!query(
          selection: {},
          logicalExpression: a!queryLogicalExpression(
            operator: "AND",
            filters: {
              a!queryFilter(
                field: "requestid",
                operator: "=",
                value: ri!requestId
              ),
              a!queryFilter(
                field: "isreadcomments",
                operator: "=",
                value: "N"
              ),
              a!queryFilter(
                field: "createdby",
                operator: "<>",
                value: tostring(loggedInUser())
              )
            }
          ),
          pagingInfo: a!pagingInfo(1, - 1, {})
        )
      ).totalCount

    If you just want to refresh the data on clicking submit, use the refreshOnVarChange parameter and configure a local variable that changes its value on button click.

    You can configure your local variables like this:

    a!localVariables(
      local!refreshComments:now(),
      local!unreadComment: a!refreshVariable(
        value: rule!Test_GetUnreadCommentCount(requestId: rv!identifier),
        refreshOnVarChange: local!refreshComments
      ),
      local!unreadComment
    )

    And configure the button saveInto parameter with local!refreshComments

      

    a!buttonWidget(
      label: "Submit",
      saveInto: {
        ri!saves,
        a!save(
          local!refreshComments,
          now()
        )
      }
    )

    Thanks.