I am automating our salesforce application with Selenium(Java) in eclipse IDE.But not able to figure how to connect to salesforce database from selenium code through eclipse.My requirement is to query from salesforce and check case is created and delete it.
Any help is appreciated.
TIA
(1) I wanted to make sure that Selenium is popular for UI automation of websites.
If you are already have UI auto test developed for Salesforce and would like to check per your question - Create and Delete operations on records then use either 'Workbench'
provided by Salesforce or use 'Salesforce Inspector' plugin.
(2) Salesforce Workbench and Salesforce Inspector - places where you can fire SOQL query and check the records
(3) Try to play around with Salesforce IDs of objects. They are unique IDs which will give you ability to open any record/object directly on browser.
For example we have Opportunity default object in Salesforce:
You can fire SOQL on 'Salesforce Workbench' or 'Salesforce Inspector' -
select id, name from Opportunity limit 50
you will see list of IDs and open in Salesforce.
See link for more info: https://intellipaat.com/blog/tutorial/salesforce-tutorial/salesforce-workbench/
Better to integrate RestAssured with your selenium tests. Suppose we have a scenario where we are want to update particular account in salesforce.
We can follow below steps to automate this test using both Rest Assured and Selenium:
Use Rest Assured to integrate with Salesforce. You can find plenty of resources online to make this work.
Use rest assured to fetch the data(account) and store the name in a variable.
Using selenium to log in to Salesforce instance and open the account.
Perform the changes that are part of your test and Validate.
This is just a high level approach. We can leverage Salesforce APIs to access the data and perform modification using Rest Assured itself. But Rest Assured can also be used to fetch database values.
Related
I need all the data backup storage on a regular basis on Salesforce to local database, so I wrote a program that calls the REST API /services/data/v53.0/sobjects access to all the sobjects, Then respectively according to their name call /services/data/v53.0 sobjects/XXX/describegot fields for each object, but I found that the fields I got did not match the fields in the object manager.
I've also tried using SOQL directly:
SELECT EntityDefinition.QualifiedApiName, QualifiedApiName, DataType
FROM FieldDefinition
WHERE EntityDefinition.QualifiedApiName = 'xxx'
But it still doesn't work, if I need to back up the CRM data to my own local database, what do I need to do? How do I get all the tables and all the fields and export them?
please help me!
There are a few ways to do this, but none of them are easy. In the past I have used addons that connect directly to Salesforce via MSSQL. One such application is purpose built for this use case. Its called DBamp. Unfortunately it is rather pricy. You can also connect to your Salesforce instance with integration software like Jitterbit, Mulesoft, DellBoomi or Talend. That approach would require creating an integration catered to the object you want the backup for.
On free side, you could use Excel to connect to your Salesforce instance and pull down whatever object you want, this is probably not an ideal solution though. Data Tab > Get Data > From Online Service > From Salesforce Object.
enter image description here
I have seen other solution like creating full copy sandboxes every week. The last option is connecting MSSQL to Salesforce via SSIS and an ODBC connector but this has been a pretty bad experience in the past, could just be me though.
how do I write a java program to query an object/table in salesforce and get results in csv?
I haven't found any clear instructions for the same on the internet.
Salesforce has some default APIs that allow external systems interacting with a Salesforce org. Two examples of them are the SOAP API and the REST Api. Both APIs expose methods to interact with the Salesforce Org, allowing operations like creating, updating, deleting records and also querying.
You can use the SOAP Api (more precisely, the query method https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_calls_query.htm) to query the Salesforce database.
You can check this example from the SF documentation that walks you through a JAVA implementation: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_steps_walk_through_code.htm. Also, the rest of the documentation from that Salesforce site is full of Java examples that can help you.
I am working on an existing tool (heavily based on Apache Gobblin) to import data from customers' Salesforce tables into local MySQL databases (one database per customer).
The tool works (as is) for customers who have enabled the Salesforce REST APIs, but one customer does not (and will not) have it enabled, only allowing access to Salesforce via the Salesforce SOAP APIs.
Is it possible to indicate to Gobblin that the data needs to be imported (extracted) from Salesforce using the Salesforce SOAP Apis? (The existing SalesforceExtractor class extends RestApiExtractor; there's no existing SoapApiExtractor to inherit from.
Has anyone added classes to Gobblin to allow it to extract from Salesforce over SOAP, to work this way?
The existing Gobblin documentation indicates that it can work that way, but I don't see the source code that does it.
I basically wrote about 250 lines of calling SOAP object getters feeding their results to REST object setters. Very similar names (for the most part) and rather ugly code, but it works.
I am importing some information (includes accounts and contacts)
Anyone have advice on the best methodology for doing the import?
Any experience with this import in specific or importing data into Salesforce in general would be appriciated.
First, you should decide is it one time migration of data, or it's iterative process which is an integral part of your solution.
In first case you can use any ETL tools that supports Salesforce integration. There are a lot of them - Talend, Pentaho Kettle, Jitterbit and many others. You can find more information about on Awesome Salesforce page.
In second case you need to implement integration API. Salesforce provides few approaches for API:
REST API - Access objects in your organization using REST
SOAP API - Integrate your organization’s data with other applications using SOAP
Bulk API - Load or delete large numbers of records
Streaming API - Provide a stream of data reflecting data changes
in your organization.
I have written a webpage with GWT which contains auto-generated Hyperlinks. These hyperlinks currently dont point to anything, however, I want them to display certain dynamic information based on the name of the hyperlink. For instance if the hyperlink says iPhone, it should open up another URL with dynamic information about the iPhone which I retrieve from my database. I know JSP/Servlets are used to generate dynamic information on webpages, but how can I integrate such functionality into my GWT webpage?
Thanks
Great this certainly helps in giving me an idea on how I can go about my design.
As a follow up though I have a question on how I can access my backend DB. Now I have stored some data in a SQLite DB which I want to be displayed on the webpage. I was able to implement backend access via GWT's RPC, however, it doesnt seem to allow transfer of a ResultSet object returned by a query. How can ResultSets be transferred? In my browsing I have seen a few keywords such as DTO, JPA etc thrown around but I dont quite have a picture on how they will plug in.
How about this:
[CLIENT]: add a ClickHandler to your hyperlinks where you execute the following steps:
[CLIENT]: retrieve token from hyperlink (i.e. iPhone).
[CLIENT]: access the backend (RPC, RequestFactory or normal RequestBuilder) and pass the token (iPhone) to the backend
[SERVER]: On the backend (servlet, python, php, etc) handle the AJAX call from your GWT app and return the dynamic information based on the token.
[CLIENT]: Display the dynamic information returned by the server call (step 3) in a HTMLPanel or SimplePanel