You need to sign in to do that
Don't have an account?
Sharmila Sahoo
I want to call a javascript remote function and pass wrapper class property as parameter. I am not able to call that function and pass parameter. Please provide solution as it is really urgent and affecting our implementation
//Function in Visualforce Page function getChildRecordsForLeftNavigation(recordId) { var recordIdTemp=recordId; var wrapper = new Object(); alert(recordId); Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.iNeed_MyTravelDetailsController.getChildRecordsForLeftNavigationDisplay}', recordIdTemp, function(result, event) { if (event.status) { console.log(result); } else if (event.type === 'exception') { console.log(event.message); } else { console.log(event.message); console.log(event.where); } }, {escape: true} ); } > // Method Call in Visualforce Page In this temp is Wrapper class object <apex:outputpanel rendered="{!(temp.travelDocWrapperList.size!=0 || temp.sfdcObject['Article_Number__c']!='')}"> <apex:outputLink value="{!$Page.iNeed_MyTravelDetails}" rendered="{!Not(temp.docRecordId==$CurrentPage.parameters.SelectedHeader)}" onclick="javascript:getChildRecordsForLeftNavigation('{!temp.docRecordId}');" > {!temp.docTitle} <apex:param name="SelectedHeader" value="{!temp.docRecordId}"/> </apex:outputLink> <apex:outputText value="{!temp.docTitle}" rendered="{!(temp.docRecordId==$CurrentPage.parameters.SelectedHeader)}"/> </apex:outputpanel> //Remote Method in Controller Class @RemoteAction global static List<TravelDocumentWrapper> getChildRecordsForLeftNavigationDisplay(Id pickAvailObjId) { system.debug('inside remote method'); system.debug('pickAvailObjId in global method'+pickAvailObjId); //system.debug('contentId in remote method'+iNeed_MyTravelDetailsController.contentId); User us=[Select ContactId from User Where Id=:UserInfo.getUserId()]; System.debug('User Value in remote method' +us); System.debug('User Contact in remote method ' +us.ContactId); //returnContentPackIDs(us.ContactId); iNeedContentPackUtility ic=new iNeedContentPackUtility(); Set<Id> contentIdForLeftNavigation=ic.returnContentPackIDs(us.ContactId); system.debug('contentId in remote method'+contentIdForLeftNavigation); Picklist_Values_Available__c pickAvailObjTemp=[select id,Picklist_Value__c,Picklist_Value__r.Parent__c,Picklist_Value__r.Parent__r.Parent__c,iNeed_Content_Pack__c,Picklist_Value__r.Picklist_Type__c,Picklist_Value__r.Label__c,picklist_Value__r.Navigation_Level__c,Picklist_Value__r.Order_Number__c,Picklist_Value__r.Navigation_Image__c,Picklist_Value__r.Url__c,Picklist_Value__r.Description__c,Picklist_Value__r.Enlarged_Navigation_Image__c,Picklist_Value__r.Detailed_Description__c,iNeed_Content_Pack__r.Description__c,Picklist_Value__r.Article_Number__c from Picklist_Values_Available__c where id=:pickAvailObjId and Picklist_Value__r.Picklist_Type__c='Navigation' and iNeed_Content_Pack__c in:contentIdForLeftNavigation]; system.debug('pickAvailObjTemp in remote method'+pickAvailObjTemp); List<TravelDocumentWrapper> tempChildRecordWrapperList=new List<TravelDocumentWrapper>(); List<Picklist_Values_Available__c> childPickRecordsList=[select Picklist_Value__r.Picklist_Type__c,Picklist_Value__r.Label__c,picklist_Value__r.Navigation_Level__c,Picklist_Value__r.Order_Number__c,Picklist_Value__r.Navigation_Image__c,Picklist_Value__r.Url__c,Picklist_Value__r.Description__c,Picklist_Value__r.Enlarged_Navigation_Image__c,Picklist_Value__r.Detailed_Description__c,iNeed_Content_Pack__r.Description__c,Picklist_Value__r.Article_Number__c from Picklist_Values_Available__c where Picklist_Value__r.Parent__c=:pickAvailObjTemp.Picklist_Value__c and Picklist_Value__r.Picklist_Type__c='Navigation' and iNeed_Content_Pack__c in:contentIdForLeftNavigation order by Picklist_Value__r.Order_Number__c] ; system.debug('childPickRecordsList'+childPickRecordsList); List<Id> childCountrecordIds=new List<Id>(); for(Picklist_Values_Available__c tempChildPickForArticle:childPickRecordsList){ childCountrecordIds.add(tempChildPickForArticle.Picklist_Value__c); } List<Picklist_Values_Available__c> childCountPicklistValues=new List<Picklist_Values_Available__c>(); childCountPicklistValues=[select Picklist_Value__c,Picklist_Value__r.Parent__c,Picklist_Value__r.Picklist_Type__c,Picklist_Value__r.Label__c,picklist_Value__r.Navigation_Level__c,Picklist_Value__r.Order_Number__c,Picklist_Value__r.Navigation_Image__c,Picklist_Value__r.Url__c,Picklist_Value__r.Description__c,Picklist_Value__r.Enlarged_Navigation_Image__c,Picklist_Value__r.Detailed_Description__c,iNeed_Content_Pack__r.Description__c,Picklist_Value__r.Article_Number__c from Picklist_Values_Available__c where Picklist_Value__r.Parent__c in:childCountrecordIds and Picklist_Value__r.Picklist_Type__c='Navigation' and iNeed_Content_Pack__c in:contentIdForLeftNavigation order by Picklist_Value__c,Picklist_Value__r.Order_Number__c] ; for(Picklist_Values_Available__c childPickObj:childPickRecordsList){ TravelDocumentWrapper tempchildPickObj=new TravelDocumentWrapper(childPickObj); tempchildPickObj.sfdcObject=childPickObj.Picklist_Value__r; TravelDocumentWrapper countTempChild; List<TravelDocumentWrapper> countTempChildList=new List<TravelDocumentWrapper>(); for(Picklist_Values_Available__c tempChildCountPicList:childCountPicklistValues){ if(tempChildCountPicList.Picklist_Value__r.Parent__c==childPickObj.Picklist_Value__c ){ countTempChild=new TravelDocumentWrapper(tempChildCountPicList); countTempChildList.add(countTempChild); } } tempchildPickObj.travelDocWrapperList=countTempChildList; tempChildRecordWrapperList.add(tempchildPickObj); } system.debug('tempChildRecordWrapperList in global '+tempChildRecordWrapperList); return tempChildRecordWrapperList; } //Wrapper Class global class TravelDocumentWrapper { global TravelDocumentWrapper(Picklist_Values_Available__c pickObj) { docTitle=pickObj.Picklist_Value__r.Label__c; docArticle=new Information__kav(); docLevel=pickObj.Picklist_Value__r.Navigation_Level__c; isCurrentActive=false; docRecordId=pickObj.id; parentRecId=pickObj.Picklist_Value__c; travelDocWrapperList=new List<TravelDocumentWrapper>(); briefSummary=''; sfdcObject=pickObj.Picklist_Value__r; } global Sobject sfdcObject{get;set;} global String parentRecId{get;set;} global String docTitle{get;set;} global Information__kav docArticle{get;set;} global String docLevel{get;set;} global Boolean isCurrentActive{get;set;} global String docRecordId{get;set;} global List<TravelDocumentWrapper> travelDocWrapperList{get;set;} global String briefSummary{get;set;} }