function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jeremyyjeremyy 

Inline editing not calling controller action methods

I'm trying out inline editing with something like this:

 

<apex:detail subject="{!account.Id}" relatedList="true" inlineEdit="true" relatedListHover="true" showChatter="true" title="true" />

I'm using a controller extension and I've overridden save() and quicksave(). When you perform an indline edit and then click save, neither of the overridden methods are being called. Is there any way to have a controller method called when saving after inline editing?

 

Bhawani SharmaBhawani Sharma

I am not sure, I need to check for this.

But still I would like to know can't you achieve your target trough the trigger ?

jeremyyjeremyy

I would love to do a trigger, but I need to do a callout which is not allowed in triggers.

Bhawani SharmaBhawani Sharma

You can create a future and can define it @callout=true and then can hit this future method from the trigger .

jeremyyjeremyy

No, I can't because I will hit the future limit too quickly, plus I'd like to keep this synchronous. 

AhmedPotAhmedPot

With apex:detail, it will call standard save, edit, cancel methods. May be instead of overwriting save functionality, you can create another custom button and call javascript or VF page.

jeremyyjeremyy

 


AhmedPot wrote:

With apex:detail, it will call standard save, edit, cancel methods. May be instead of overwriting save functionality, you can create another custom button and call javascript or VF page.

 

Are you sure? I'm throwing exceptions in both save() and quicksave() but saving after an inline edit works fine. Here's the log:

 

 

21.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
22:04:58.016|EXECUTION_STARTED
22:04:58.016|CODE_UNIT_STARTED|[EXTERNAL]|066C0000000TgMN|VF: /apex/AccountPage
22:04:58.016|VF_DESERIALIZE_VIEWSTATE_BEGIN|066C0000000TgMN
22:04:58.028|VF_DESERIALIZE_VIEWSTATE_END
22:04:58.146|VF_SERIALIZE_VIEWSTATE_BEGIN|066C0000000TgMN
22:04:58.150|VF_SERIALIZE_VIEWSTATE_END
22:04:58.575|CUMULATIVE_LIMIT_USAGE
22:04:58.575|CUMULATIVE_LIMIT_USAGE_END

22:04:58.157|CODE_UNIT_FINISHED|VF: /apex/AccountPage
22:04:58.157|EXECUTION_FINISHED

 

 

Bhawani SharmaBhawani Sharma

Cann't you use Apex Api's to save ?

I mean you can create a custom button can can add it on the detail page layout , onclick of this invoke salesforce api's to save the record.

jeremyyjeremyy

The standard save button can't be hidden, so that's really not a viable solution.  Also, when the user has done inline editing and clicks save, there is a lot of javascript/UI that has to happen, in addition to saving the record.

 

 

joshbirkjoshbirk

Are tied to apex:detail, or can you use anything else?  Could you use Field Sets with Visualforce as an alternative?

jeremyyjeremyy

 


joshbirk wrote:

Are tied to apex:detail, or can you use anything else?  Could you use Field Sets with Visualforce as an alternative?


In this case, no. The administrator must have the ability to make changes to buttons, related lists, etc., without requiring changes to VF markup.

 

jeremyyjeremyy

It seems that saving after inline editing does not call a controller action method, and currently there's no way around this. 

DevNVDevNV

How did you end up resolving your requirement?  I have the same issue where I want to run some controller code to override the save functionality.  When inline editing is used it doesn't call my method - wondered what your workaround was.

 

Thanks for sharing.

jeremyyjeremyy

I believe I ended up plugging into the javascript event that fires when the inline edit save finishes, and then calling an actionFunction. The javascript is all undocumented, and it's a hack, so beware and YMMV.