You need to sign in to do that
Don't have an account?
Harsha Shri
Error in External object SOQL Query
Hi All,
I am getting following when I am performing DML Operation
This is my code
Please help me in resolving this error
Thanks in Advance
I am getting following when I am performing DML Operation
System.ExternalObjectException: Salesforce System Error: 627698564-15996 (1450171494) (1450171494) : (System Code) Error is in expression '{!Search}' in component <apex:commandButton> in page cpm_lookup1: Class.CustomAccountLookupController.performSearch: line 34, column 1 Class.CustomAccountLookupController.runSearch: line 23, column 1 Class.CustomAccountLookupController.search: line 16, column 1
This is my code
public with sharing class CustomAccountLookupController { public Account account {get;set;} // new account to create public List<externalobj1__x> results{get;set;} // search results public string searchString{get;set;} // search keyword public CustomAccountLookupController() { account = new Account(); // get the current search string searchString = System.currentPageReference().getParameters().get('lksrch'); runSearch(); } // performs the keyword search public PageReference search() { runSearch(); return null; } // prepare the query and issue the search command private void runSearch() { // TODO prepare query string for complex serarches & prevent injections results = performSearch(searchString); } // run the search and return the records found. private List<externalobj1__x> performSearch(string searchString) { String soql = 'select id,externalid from externalobj1__x'; if(searchString != '' && searchString != null) soql = soql + ' where externalid LIKE \'%' + searchString +'%\''; soql = soql + ' limit 25'; System.debug(soql); return database.query(soql); } // save the new account record public PageReference saveAccount() { insert account; // reset the account account = new Account(); return null; } // used by the visualforce page to send the link to the right dom element public string getFormTag() { return System.currentPageReference().getParameters().get('frm'); } // used by the visualforce page to send the link to the right dom element for the text box public string getTextBox() { return System.currentPageReference().getParameters().get('txt'); } }
<apex:page controller="CustomAccountLookupController" title="Search" showHeader="false" sideBar="false" tabStyle="Account" id="pg"> <apex:form > <apex:outputPanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;"> <apex:tabPanel switchType="client" selectedTab="name1" id="tabbedPanel"> <!-- SEARCH TAB --> <apex:tab label="Search" name="tab1" id="tabOne"> <apex:actionRegion > <apex:outputPanel id="top" layout="block" style="margin:5px;padding:10px;padding-top:2px;"> <apex:outputLabel value="Search" style="font-weight:Bold;padding-right:10px;" for="txtSearch"/> <apex:inputText id="txtSearch" value="{!searchString}" /> <span style="padding-left:5px"><apex:commandButton id="btnGo" value="Go" action="{!Search}" rerender="searchResults"></apex:commandButton></span> </apex:outputPanel> <apex:outputPanel id="pnlSearchResults" style="margin:10px;height:350px;overflow-Y:auto;" layout="block"> <apex:pageBlock id="searchResults"> <apex:pageBlockTable value="{!results}" var="a" id="tblResults"> <apex:column > <apex:facet name="header"> <apex:outputPanel >Name</apex:outputPanel> </apex:facet> <apex:outputLink value="javascript:top.window.opener.lookupPick2('{!FormTag}','{!TextBox}_lkid','{!TextBox}','{!a.Id}','{!a.externalId}', false)" rendered="{!NOT(ISNULL(a.Id))}">{!a.externalid}</apex:outputLink> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:outputPanel> </apex:actionRegion> </apex:tab> <!-- NEW ACCOUNT TAB --> <apex:tab label="New Account" name="tab2" id="tabTwo"> <apex:pageBlock id="newAccount" title="New Account" > <apex:pageBlockButtons > <apex:commandButton value="Save"/> </apex:pageBlockButtons> <apex:pageMessages /> <apex:pageBlockSection columns="2"> </apex:pageBlockSection> </apex:pageBlock> </apex:tab> </apex:tabPanel> </apex:outputPanel> </apex:form> </apex:page>
Please help me in resolving this error
Thanks in Advance
I resolved it
external objects does not support 'Like'.
Use '=' in SOQL query where condition (line 31)
All Answers
System.debug(soql);
I resolved it
external objects does not support 'Like'.
Use '=' in SOQL query where condition (line 31)