Sunday, July 8, 2012

Rollup Summary In Validation: Avoid Trigger

There are certain simple scenarios where we think we have to write code and then again writing apex , test class and coverage..a lot hectic things.But if we thinks Configuration Power so many of such things can be avoided and can be handeled easily.
Here i am disscusssig some configuration Tips though simple but very efficient .

If You want to Validate Parent Object on behalf of Child Records.
Approach : Avoid Trigger
Create RollupSummary ,Set Filter Criteria On Rollup Field.
Use RollUp Summary In Validation Rule on Parent
Its Done.


Use  apex Trigger only when there is complex Scenarion.



Regards
Clouder
Simplifying enterprise architecture







Saturday, February 11, 2012

Hi ,
This is in regarding script statement,Script statement are nothing but Executable Line in Code .

Example :

1):Conditional Statement
2)Assignment
3)For loop
4)While
5)Transaction Statement

Example:


If(Name =='Mohit')
{
Statement 1;
}
Else
{
Statement 2;
}

In This Code Script Statement is 1 since it is conditional Either Statement 1 or Either 2 Statement will Execute.



Some more Illustration for Optimizing Script Statement..Write Effective code

List<account> lstact=[select id ,name from account where name='abc'];
for(integer i=0;i<lstact.size();i++)
{
string str=lstact[i].name;
}
 Result: Please Note Down Number of script Statement: 3











Code Listing 2: Please Note Down here Number of Script Statement :1

for(account varact:[select id ,name from account where name='abc'])
{
string str=varact.name;
}













Try To reduce : Number of Script Statement.Effective Code writing.

If you feel unappropriate please say,this is my first blog for any mistake i apologize.