web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Unable to refresh the form automatically using formContext.data.refresh(true)

(1) ShareShare
ReportReport
Posted on by 3
On resolving a case using js, i was unable to refresh the form as soon as the case got resolved using the below syntax
formContext.data.refresh(true);
 
Again hard reload or refresh is required to lock the form as the case is resolved.
 
Any help would be more appreciated.
I have the same question (0)
  • Verified answer
    Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    When a case is resolved, it is automatically locked to read-only status.
    In my testing, I added a column OnChange event to the Status field on the case entity.
    When the case is resolved, the value of the Status field changes to 1 (Resolved), which then triggers the Column OnChange event and refreshes the page.
    The code is below.
     
    function onload(executionContext){
        const formContext = executionContext.getFormContext();
        let status = formContext.getAttribute("statecode").getValue();
        if(status ===1){
            formContext.data.refresh(true).then(
                function success(res){
                    console.log("success")
                },
                function error(err){
                    console.log(err)
                }
            )
        }
    }
     
     
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 86 Super User 2026 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 58 Most Valuable Professional

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 42 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans