Salesforce.com-Tips and Tricks by Greytrix
Greytrix is one of the oldest Sage Development Partner of two decades for Sage product lines and Reseller of Sage ERP and CRM. Greytrix has been awarded "Sage Partner of the Year" numerous times both as developers and resellers. In these blogs, Greytrix will endeavour to share its knowledge with regards to implementation, training, customisation, components and technology and help users to understand in depth techno – functional aspects of Salesforce.com To leverage the Greytrix advantage write to us at salesforce@greytrix.com
Follow us on LinkedIn Follow us on Twitter Follow us on Facebook Follow us on YouTube
Skip to content
  • Home

Calling SOQL Query from JavaScript for validation of Account Name in Salesforce

By Greytrix | June 5, 2013
0 Comment

Recently, we had a requirement from one of our clients, wherein they wanted a page where user had to enter the Account Name. We were required to validate that account name and then do further processing.

In below code snippets, we are checking if the Account name entered by the user is valid by querying on Account table/object directly in the JavaScript code. To simplify the code, we have used the variable AccountName in JavaScript to specify the account name.
———————————————————————-<snip>
<apex:page >
<script language=”JavaScript1.2″ src=”/js/functions.js”></script>
<script src=”/soap/ajax/9.0/connection.js” type=”text/javascript”></script>
<script id=”clientEventHandlersJS” language=”javascript”>
function CallSOQL()
{
sforce.connection.sessionId = ‘{!$Api.Session_ID}’;
try
{
alert(‘Select Name, Id From Account ORDER BY Name’);
var AccountName=” TEST ACCOUNT”;
var qr = sforce.connection.query(“SELECT id,name FROM Account where Name='”+ AccountName +”‘”);
var records = qr.getArray(“records”);
alert(‘qr ‘+qr);
}
catch (error)
{
alert(error.faultstring);
}

if (qr.size == 0)
{
alert(“No Record found.”);
}
else
{
for (var i=0;i<qr.records.length;i++)
{
alert(qr.records[i].Name);
}

}

}
</script>

<input type=”button” onclick=”CallSOQL();” value=”Call SOQL Query”/></apex:page>

———————————————————————-<snip>

By using the above given code, you can query on any object or custom object of Salesforce without writing code on controller side.

Greytrix offers GUMU™ for Salesforce – Sage 300 (Accpac) Integration a best of breed solution for organizations to enhance their customer interaction.

About Us
Greytrix as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offers Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.

Greytrix has some unique solutions for Cloud CRM such as Salesforce integration with Sage Enterprise Management (Sage X3), Sage Intacct, Sage 100 and Sage 300 (Sage Accpac). We also offer best-in-class Cloud CRM Salesforce customization and development services along with services such as Salesforce Data Migration, Integrated App development, Custom App development and Technical Support to business partners and end users.

Greytrix GUMU™ integration for Sage ERP – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information, please contact us at salesforce@greytrix.com. We will be glad to assist you.

Category: GUMU™ Salesforce Tags: Account Name, Custom Object, JavaScript, Query, Salesforce Integration, Salesforce Integration with Sage 300 ERP, Salesforce integration with Sage X3, SOQL Query
Post navigation
Assign custom object permissions to Standard User in Salesforce →

Greytrix Websites and Blogs

  • Greytrix
  • GUMU™ Cloud
  • Greytrix Africa
  • Greytrix Australia
  • Sage X3 – Tips, Tricks and Components
  • Sage 100 & 500 ERP Tips and Tricks
  • Sage 300 – Tips, Tricks and Components
  • Sage CRM – Tips, Tricks and Components
  • Sage Business Cloud – Tips, Tricks and Components
sage enterprise management services

Categories

  • GUMU™ Features
  • GUMU™ Salesforce
  • GUMU™ Tricks & Tips
  • Salesforce Services

Recent Posts

  • How to add Lightning Web Components as Custom Tabs in Salesforce
  • How to set cookies in HTTP Callout (APEX Salesforce)
  • Synching Additional (Order Details) Fields from Salesforce to Sage 300 ERP
  • Promote Quote from Salesforce – Sage 100 Integration using GUMU™ lightning version
  • Promote/Update Salesforce Contact to Sage 100 using GUMU™ Lightning Interface

Popular blogs

  • Thinking of enhancing your business processes? Get the best ERP – CRM connector on Salesforce AppExchange!
  • GUMU™ for Salesforce – Sage ERP Integration
  • Leverage real-time enterprise data for better insights of your Customers with Salesforce – Sage 300 integration
  • GUMU™ Integration for Salesforce with Sage 300

Archives

Awards

Greytrix Top ISV Partner
Greytrix Revenue Growth Enterprise Business
Greytrix Africa Highest Revenue
Greytrix Prtner of the Year
Greytrix Partner Award
Copyright 2019
Salesforce.com-Tips and Tricks
Iconic One Theme | Powered by Wordpress