Tuesday, 28 February 2017

[#BloggedFormula field to add 1 month exact in close date)

Formula field to add 1 month exact to close date

YEAR(CloseDate) + FLOOR((MONTH(CloseDate) + 1 - 1)/12), 
CASE(MOD(MONTH(CloseDate) + 1, 12 ), 0, 12, MOD(MONTH(CloseDate)+ 1, 12 )), 
CASE(MOD(MONTH(CloseDate) + 1,12), 9, 30, 4, 30, 6, 30, 11, 30, 2, 
IF(MOD(YEAR(CloseDate) + FLOOR((MONTH(CloseDate) + 1)/12), 400) = 0 || (MOD(YEAR(CloseDate) + FLOOR((MONTH(CloseDate) + 1)/12), 4) = 0 && MOD(YEAR(CloseDate) + FLOOR((MONTH(CloseDate) + 1)/12), 100) <> 0 

Monday, 27 February 2017

[#Blogged]Day, Month and Year from Date

Sample Code (Use this in apex class):

Date gettingdate;
Integer dy = gettingdate.day();
Integer monh = gettingdate.month();
Integer yer = gettingdate.year();

Monday, 20 February 2017

[#Blogged]Managed or Unmanaged Packages

Packages come in two forms:
  • Unmanaged
  • Managed


Unmanaged packages are typically used to distribute open-source projects or application templates to provide developers with the rudimentary building blocks for an application.
Once the components are installed from an unmanaged the package, the components can be edited in the organization they are installed in.
The developer who engendered and uploaded the unmanaged package has no control over the installed components, and can't change or upgrade them.


Managed packages are typically utilized by salesforce.com partners to distribute and sell
applications to customers.
These packages must be engendered from a Developer Edition organization.
Utilizing the AppExchange and the License Management
Application (LMA), developers can sell and manage utilizer-predicated licenses to the app.
Manage packages are withal plenarily upgradeable. To ascertain seamless upgrades, certain
destructive changes like abstracting objects or fields may not be performed in a managed
Managed packages additionally offer the following benefits:
  • Astute property auspice for Apex.
  • Built-in versioning support for API accessible components
  • Remote access support (OAuth)
  • The competency to branch and patch an antecedent version
  • The competency to seamlessly push patch updates to subscribers
  • Unique denominating of all components to ascertain conflict free installs

Wednesday, 8 February 2017

[#Blogged] Anonymous Block

An anonymous block is Apex code that does not get stored in the metadata, but that can be compiled and executed using one of the following:

• Developer Console

• Force.com IDE

• The executeAnonymous Web services API call:

ExecuteAnonymousResult executeAnonymous(String
You can utilize incognito blocks to expeditiously evaluate Apex on the fly, such as in the Developer Console or the Force.com IDE, or to indite code that changes dynamically at runtime
Note the following about the content of an incognito block (for executeAnonymous(), the code String):
* Can include utilizer-defined methods and exceptions.
* Utilizer-defined methods cannot include the keyword static.
* You do not have to manually commit any database changes.
* If your Apex trigger consummates prosperously, any database changes are automatically committed. If your Apex trigger does not consummate prosperously, any vicissitudes made to the database are rolled back.
* Unlike classes and triggers, incognito blocks execute as the current utilizer and can fail to compile if the code breaches the utilizer's object- and field-level sanctions.
* Do not have a scope other than local. For example, though it is licit to utilize the ecumenical access modifier, it has no denotement. The scope of the method is inhibited to the innominate block. 
* When you define a class or interface (a custom type) in an incognito block, the class or interface is considered virtual by default when the innominate block executes. This is true even if your custom type wasn’t defined with the virtual modifier. Preserve your class or interface in Salesforce to eschew this from transpiring. Note that classes and interfaces defined in an incognito block aren’t preserved in your organization.