Controller class --
public class FinancialSearchController {
...
...
public Integration_Log__c mainOutboundLog {get;set;}
//Constructor method definition here...
//This is my action function
public void logTransactionDetails () {
String searchService = Apexpages.currentPage().getParameters().get('searchService');
String searchTarget = Apexpages.currentPage().getParameters().get('searchTarget');
mainOutboundLog = new Integration_Log__c();
mainOutboundLog.User__c = System.userInfo.getUserId();
mainOutboundLog.RecordTypeId = [Select SobjectType, Name, IsActive, Id, DeveloperName From RecordType Where SobjectType = 'Integration_Log__c' and IsActive = true and DeveloperName = :UTIL_ErrorConstants.OUTBOUND_LOG_RECTYPENAME Limit 1].Id;
mainOutboundLog.Apex_Class_Name__c = 'FinancialSearchController';
mainOutboundLog.Apex_Method_Name__c = '';
mainOutboundLog.Service_Class_Name__c = '';
mainOutboundLog.Web_Service_Method_Name__c = '';
mainOutboundLog.Integration_Type__c = 'XYZ';
mainOutboundLog.Context__c = searchService;
mainOutboundLog.Remote_System__c = searchTarget;
insert mainOutboundLog;
//The above mainOutboundLog is getting inserted successfully.
}
//Another actionfunction which execute after the above actionFunction
Public void startSearch() {
system.debug(mainOutboundLog); // This is printing Null.
}
Why is the controller variable (mainOutboundLog) which got successfully updated turns null in subsequent usage?
EDIT****VF snippet***
<script type="text/javascript">
function checkValidations() {
...
...
logTransactionDetails('Primary Search', 'XYZ');
getSearchDetails();
}
</script>
<apex:actionFunction name="logTransactionDetails" action=" {!logTransactionDetails}" reRender="FinancialDataSearchForm">
<apex:param name="searchService" value="" />
<apex:param name="searchTarget" value="" />
</apex:actionFunction>
<apex:actionFunction name="getSearchDetails" action="{!startSearch}" reRender="primaryResultsPanel, additionalResultsPanel, FinancialDataSearchForm">
</apex:actionFunction>
<apex:commandButton value="Search" onclick="checkValidations(); return false;" reRender="primaryResultsPanel, additionalResultsPanel"/>
logTransactionDetails
before callingstartSearch
?