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
dn6184dn6184 

Possible to get records values right after inline edit, but before database?

We have inline edit functionality in our system that waits for a response back from our integration on whether the edit was valid or not.
What its supposed to do is send the record with the newly edited value to our apex controller class, then if our system responds with an error, it throws an exception in salesforce that in turn causes the actual edit not to be committed.
That's at least what it used to do. Sometime around March this stopped working and it started just allowing the edit and didnt actually throw the error even though the error was coming back from our system.
I've tweaked it to where its actually throwing the error on the page now, but I have a new issue.
When it calls the "actionSave" function, I'm needing the values for "theObject" to have the values AFTER the inline edit, but currently I don't have any way of getting that. All I can get is the record and its values when it was first loaded (i.e. the constructor for IntegratedObjectController)
If I can somehow push the changed fields values to actionSave, it would fix my issue.
Any ideas?
heres the code for both the opportunity VF page, and the IntegratedObjectController class
OPPORTUNITY VF PAGE:

<apex:page id="page1" standardController="Opportunity" extensions="IntegratedObjectController" >

<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" />

<script>

var $j = jQuery.noConflict();

$j(function() {

    var saved = InlineEditData.prototype.save;

    InlineEditData.prototype.save = function(responseText) {

        //saved.apply(this, arguments);

        $j('input[id$=cmdBtnSave]').click(); 

    };

});

function saved() {

    var errorMessage = $j("#page1\\:form1\\:dynamicOutput").html();

    if (errorMessage.length > 0) {

        alert(errorMessage);

    }

}

function InitializeButtons()

{

   

}   

</script>

<apex:form id="form1">

    <apex:commandButton id="cmdBtnSave" value="Save1" action="{!actionSave}" style="display: none"/>

    <apex:pageMessages />

    <!--<apex:actionFunction name="actionSave" action="{!actionSave}" reRender="dynamicOutput"  oncomplete="saved();"

        />-->

    <apex:outputPanel id="dynamicOutput" layout="block" style="display:none">

    {!ErrorMessage}

    </apex:outputPanel>

    <apex:detail id="currentData" subject="{!Opportunity.Id}" relatedList="true" inlineEdit="true" relatedListHover="true"

        showChatter="true" title="true" />

        <apex:outputText value="{!Opportunity.StageName} {!Opportunity.CloseDate} {!Opportunity.Name} {!Opportunity.CreatedDate} {!Opportunity.Account.FswAccountID__c} {!Opportunity.Account.FswAccountID__c} {!Opportunity.Account.RecordTypeId} {!Opportunity.Owner.FswUserID__c} {!Opportunity.CreatedBy.FswUserID__c} {!Opportunity.LastModifiedBy.FswUserID__c} {!Opportunity.LastModifiedDate} {!Opportunity.IsCommissionable__c}" rendered="false"/>

</apex:form>

<script>

function addLoadEvent(func) {

  var oldonload = window.onload;

  if (typeof window.onload != 'function') {

    window.onload = func;

  } else {

    window.onload = function() {

      if (oldonload) {

        oldonload();

      }

      func();

    }

  }

}

addLoadEvent(InitializeButtons);

</script>

</apex:page>

 

INTEGRATEDOBJECTCONTROLLER CLASS:

/*

** Page Controller for "view" pages. Currently supports Account, Contact and Opportunity.

** Pages must call actionSave() when an inline edit is made.

*/

public with sharing class IntegratedObjectController {

    public sObject theObject {get; private set; }

    private Schema.Sobjecttype sObjectType;

    public String ErrorMessage { get; set; }

    public IntegratedObjectController(ApexPages.StandardController controller) {

        theObject = controller.getRecord();

        sObjectType = theObject.getSObjectType();

        Map<String, String> currentPageParameters =  ApexPages.currentPage().getParameters();

        String ErrorMessage = (String)currentPageParameters.get(Constants.ERROR_MESSAGE);

        if (ErrorMessage != null)

        {

            ErrorMessage = (String)EncodingUtil.urlDecode(ErrorMessage, Constants.UTF_8);

            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,ErrorMessage));

        }

    }

    public PageReference actionSave() {

        PostEditController pe = new PostEditController();

        try

        {

            pe.doIntegration((String)theObject.Id);

        }

        catch (Exception ex) {

 

        }

        return null;

    }

   

}