Thursday 13 July 2017

Tricky sales force Questions 

1. How to delete the User from Salesforce
  salesforce does not allow to delete any user, however you can deactivate the user.

2.If one object in Salesforce have 2 triggers which runs “before insert”. Is there any way to control the sequence of execution of these triggers?

 Salesforce.com has documented that trigger sequence cannot be predefined. As a best practice create one trigger per object and use comment blocks to separate different logic blocks. By having all logic in one trigger you may also be able to optimize on your SOQL queries.

3.How to enable truncate custom object feature in Salesforce ?
Ans : Navigate to “App Setup | User Interface” and select “Enable Custom Object Truncate”.

Sometimes while deleting record it gives error “Object cannot be Deleted”. What is the reason for this kind of error ?

This is generic error message prompted by Salesforce many times, which is not well informative. To get informative message, we can try to delete same record in “Developer Console”. In Developer Console Debug log, we will get exact error message.

Interesting !!!

Example:
Lets say there is one record which is parent of more than 2000 records and grand parent of 5000 records. In such scenario from developer console it gives error something like “record cannot be deleted because it has many associated objects” However in User Interface, it will just display that “Object cannot be deleted."


4.Why CSS is not working in PDF created by Visualforce ?

1.Use “apex:stylesheet” tag to import external CSS file
2.Wrap “Style” tag inside “Head” tag in Visualforce
You have to cross verify the things.If you mentions these propery your css should work

5.whats Test.isRunningTest() ?
Use Test.isRunningTest() in your code to identify that context of class is Test or not. You can use this condition with OR (||) to allow test classes to enter inside code bock. It is very handy while testing for webservices, we can generate fake response easily.


                                                                                                                          Continues ...

1 comment: