0

I'm having an inline visualforce page (to load a map) within a section of page layout. My requirement is to update a field in the same record once the page is loaded. I have the inline VF page and the standard controller. I had an action function on Apex page to update the value. It works perfectly, but it doesn't display the updated value in the layout. It has to be refreshed to load the value. I tried to use an ActionFunction within Apex:Form. But looks like it doesn't trigger the Action method (No debug). Here's the code

<apex:actionFunction name="updateDistance" action="{!updateRec}" rerender="mainMap" status="myStatus"> 

and my actionmethod is,

public PageReference updateRec(){ try{ system.debug('sId::'+sId); if (sId != NULL && sId != ''){ custom__c Rec = new custom__c(Id=sId); Rec.field__c = value; upsert Rec; } }catch(DMLException dme){ system.debug('Exception dme:::'+dme.getMessage()); return null; } return null; } 

Anyone can suggest a workaround for this?

1
  • 1
    can you add your vf page code? Commented Apr 26, 2017 at 6:24

1 Answer 1

0

I think you need to refresh the page the to see the update.

From <apex:actionFunction> use oncomplete event to refresh the page as follows:

<apex:actionFunction name="updateDistance" action="{!updateRec}" oncomplete = "window.top.location.reload();" rerender="mainMap" status="myStatus"> 
1
  • My issue is it doesnt call the controller method from action function, even though I manually refreshes the page. No debug logs. Commented Apr 26, 2017 at 6:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.