Refresh Record View from Interface

Certified Associate Developer

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.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    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,

  • 0
    Certified Associate Developer
    in reply to sushilkapoor2418

    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
    )

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

  • 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.

  • 0
    Certified Associate Developer
    in reply to paschimav

    Thanks, But the rule expression, I am calling  on my Record (view name section) and submit button is on another interface ,So there is no scope of  local!refreshComments on my interface.

  • You can configure it in the parent rule and pass it as a rule input, this way you can reduce the number of times you call the query when it is not needed, refreshAlways:true() will behave as with(), so it calls your query on every interaction with the screen.

Reply Children
No Data