Using soapUI with Salesforce to test standard and custom web services response

soapUI is most common tool available to test Soap based web services, it also has capability to test REST web services. soapUI can be used to test Partner WSDL, enterprise WSDL, Tooling API, Metadata API to study capability and response from Salesforce before writing any code in Java, C# or any other language. In this article we will see, how we can leverage this tool to test enterprise WSDL from Salesforce.

You can download latest version of soapUI from here.

Continue reading “Using soapUI with Salesforce to test standard and custom web services response”

Who has Downloaded My Chatter Files ?

Salesforce is evaluating and enhancing the way we use Files with help of Content and Chatter Files. Customer might want to know that who has downloaded Chatter files on their Local System? In this article, I will explain a little hack on identifying name of Users, who  has downloaded Chatter File from Organization.

There is no Out of box functionality provided by Salesforce yet to view names of users, So we are gonna use either Dataloader or Developer Console, which in turn will use SOQL.

In CRM Content, You can see name of users like below image : Continue reading “Who has Downloaded My Chatter Files ?”

How to access ListView in Apex | Using StandardSetController for Pagination

There are scenario in project lifecycle where developer creates SOQL or Dynamic SOQL to return expected result. Also if requirement changes they go back and change existing code to reflect updated SOQL. If you are good developer and avoid to change Apex code at most you will save your SOQL in “Custom Settings” and utilize in Dynamic SOQL.

However, There is very good design Developer can suggest to client. Instead of going to your code and changing code for new requirement, how it sounds if we can utilize existing List View inside Apex or Visualforce only 🙂 ? It will solve lots of problems and if requirement changed, just change or create new Listview and it will reflect in your Visualforce code. We can almost have same functionality like Navigation buttons and Paging without writing any complex code logic, thanks to StandardSetController capabilities.

There is also very good article on Salesforce blog on various approaches suggested for pagination and one of them is using StandardSetController.

To keep article simple, I am posting complete Visualforce and Apex code with Comments inside. Account object is used as an example here. Continue reading “How to access ListView in Apex | Using StandardSetController for Pagination”

Apex Interview Question – Salesforce – Part 16

151. Give Sample Code Snippet of Apex that that will show that how Parent and Child record can be inserted in Single Statement ?
Ans : It can be done with help of External Id.

Date dt = Date.today().addDays(7);
Opportunity newOpportunity = new Opportunity(Name = 'shivasoft', StageName = 'Prospecting', CloseDate = dt);

/*
Create the parent reference. Used only for foreign key reference  and doesn't contain any other fields. If we provide any other value it will give following error

System.DmlException: Insert failed. First exception on row 1; first error: INVALID_FIELD, More than 1 field provided in an external foreign key reference in entity: Account: []
*/

Account accountReference = new Account(MyExtID__c = 'SHIVA1234567');
newOpportunity.Account = accountReference;

//  Create the Account object to insert.  Same as above but has Name field.  Used for the insert.
Account parentAccount = new Account(Name = 'Shiva', MyExtID__c = 'SHIVA1234567');

Database.SaveResult[]
    results = Database.insert(new SObject[] {  parentAccount, newOpportunity });


152 . Which SOQL statement can be used to get all records even from recycle bin or Achieved Activities?
Ans : We will need “ALL Rows” clause of SOQL.
Sample :

SELECT COUNT() FROM Contact WHERE AccountId = a.Id ALL ROWS

153. How can you lock record using SOQL so that it cannot be modified by other user.
Ans : we will need “FOR UPDATE” clause of SOQL.
Sample :

 Account [] accts = [SELECT Id FROM Account LIMIT 2 FOR UPDATE];

Continue reading “Apex Interview Question – Salesforce – Part 16”

Salesforce Interview Questions – Part 10

Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags , , , , with 6 Comments on Salesforce Interview Questions – Part 10

This Part of Salesforce interview question series depict on browser compatibility issue (Internet Explorer 9) and Visualforce normally for AJAX, Group By and Having Clause.


91. How to add the Document Header in Visualforce page?
Ans : Directly there is no way to add the document type in visualforce. However in most of the cases IE9 does not work with Visualforce pleasantly. And then we need to add the Document type in header. So following workaround will work.

<apex:outputText
escape="false"
value="{!'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'}"/>
<html>
    <head>
        <title>test</title>
    </head>
    <body>test</body>
</html>
</apex:page>

Read more in detail in thread – http://boards.developerforce.com/t5/Visualforce-Development/Changing-doctype-of-a-Visualforce-Page/td-p/82397/page/2


92. Onchange event does not work with <apex:actionsupport> in IE9. How to resolve this error?
Ans: If we hide the Header on Visualforce page then it creates lots of problem in IE9. I think there are few java-script library loaded by Header of Salesforce which makes IE9 compatible. So the best solution is to enable the Headre by using “showHeader=true” in Apex page.
Read more in detail in below thread URL : http://boards.developerforce.com/t5/Apex-Code-Development/IE9-requires-header-in-VF-Page/td-p/402997


93. If IE9 is not working with your custom visualforce page then how to tell your visualforce code to run in IE8 compatibility mode?
Ans:
Add following metatag to pages:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />

94. It may happen that above tips will not work as lots of time the page header already sent. then how to achieve same result using Apex?
Ans:
Add below line of code in Apex (Constructor)

Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');

Read more tips and tricks to solve IE9 issue in Salesforce here. Continue reading “Salesforce Interview Questions – Part 10”