Wednesday, February 11, 2015

Webservice Callouts

One-way SSL

In one-way SSL, the server alone presents the certificate to the client and the client doesn’t provide any certificate to the server to prove the identity. For e.g. when a user does a transaction with ebay.com, it is the server who has to prove its identity to the client; hence the server has to be secured with the certificate and present it to client. The modern browser clients will accept the certificate and show the status in green if the certificate is signed by public CA and is valid. If it is a self-signed certificate or signed by private CA, then the browsers will show the warning.

Two-way SSL

In two-way SSL, both the server and the client proves their identity by exchanging the certificates. This type of security is mostly needed where both the server and the client needs to establish their identities to each other. By exchanging the certificates, both the client and server proves their identities. The digital certificate is used as the identity and this digital certificate should be signed by the Certificate Authority. The Force.com platform only supports certificates signed by public CA such as Verisign, DigiCert, Thawte, etc, when making HTTP/REST/WSDL requests to third party/enterprise server(s). A complete list of the public CA that Force.com platform supports can be found in the saleforce wiki. When making outbound web service callouts, the Salesforce can use either, a certificate signed by public CA or self-signed certificates to present it to the third party/enterprise server(s). We will cover more on this later.

link - https://krishhari.wordpress.com/2012/02/04/making-authenticated-web-service-callouts-from-salesforce-to-ibm-cast-iron-using-sslcertificatespart-i/

Tuesday, August 19, 2014

Links for useful bolgs

Hi All,

Here I am providing you some links of important blogs. It took my much time to find out the solution of some problems now I don't want some other to suffer with the same things. So its an effort to consolidate all the links together :

Blog on how to customize blog : 


  • How to add code snippet in your blog :     http://kasun86.blogspot.in/2011/07/posting-code-snippets-to-blogger.html
  • http://www.salesforcehacker.com/2014/06/choose-your-own-adventure-with-custom.html - custom permission

Tuesday, May 20, 2014

How Parent and Child record can be inserted in Single Statement : Use of External id field

Date dt = Date.today().addDays(7);
2Opportunity newOpportunity = new Opportunity(Name = 'shivasoft', StageName ='Prospecting', CloseDate = dt);
3
4/*
5Create 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
6
7System.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: []
8*/
9
10Account accountReference = new Account(MyExtID__c = 'SHIVA1234567');
11newOpportunity.Account = accountReference;
12
13//  Create the Account object to insert.  Same as above but has Name field.  Used for the insert.
14Account parentAccount = new Account(Name = 'Shiva', MyExtID__c = 'SHIVA1234567');
15
16Database.SaveResult[]
17    results = Database.insert(new SObject[] {  parentAccount, newOpportunity });
Note : parent object should be included before the child object in list otherwise you will get following error : 
 INVALID_FIELD, Foreign key external ID: SHIVA1234567 not found for field  MyExtID__c  in entity Account: []

Friday, January 3, 2014

Salesforce Tips

If we remove "Modify All Data" permission from a user then there is some other permissions are also removed with this.
Ex - after removing modify all data user can not edit apex classes. Even after applying modify all data still user can not edit apex classes.

Reason : Apex Author permission is also removed from the profile when we remove Modify all data.
Solution : check Apex author checkbox on profile level then you are able to edit apex classes again.

Sunday, December 15, 2013

Error during deployment

  •  Error :  "Entity is not org-accessible" error while deployment or saving the classes.
          Cause of the error - You have written a code that share a record and sharing model is not set to  private.

          Solution :  set sharing model to private for the object you are applying sharing rule in your code.
Security control -.> Sharing Settings -> select object -> Set OWD private

  •  Error : APEX deploy fails "Package Version number does not exist" while saving the classes and pages.
          Cause : Classes are dependent on installed package. Your org has lower package version installed and the classes you want to deploy are in higher package version.

You can check your installed package version in your org:
App Setup -> Installed Packages_>click on your package ->see the Version Number

Package version of the class can be checked by version setting or by metadata file in eclipse.

Solution : 1. Upgrade the package of your org.
                 2. Try setting your project to work offline.Edit the metadata file and remove the dependencies on the manage package, then deploy straight to the target org.

Go to your project in eclips -> force.com -> work offline -> remove the dependancy of your classes and pages on package then deploy to server.