New Batch#100 (10th Nov 2021) - Salesforce Admin + Dev Training (WhatsApp: +91 - 8087988044) :https://t.co/p4F3oeQagK

Saturday 20 February 2016

Spring '16 Important Features


  1. 1.     Platform Security Health Check
    Spring ’16 provides an interesting new security Health Check feature that enables the current org configuration to be compared against a Salesforce recommended baseline. Any feature that highlights security risk or vulnerability is positive addition and should help mitigate against complacency.
    2.     Lightning Experience – Person Account Compatibility (Beta) enabled
    3.      List View filters can now be edited on-the-fly and record detail pages support inline editing. Both features providing enhancement to the general user experience.
    4.     Lightning Experience – Detect User Experience –
    Support is now provided for Apex script to reliably detect the current user experience, i.e. Salesforce1, Lightning Experience, Salesforce Classic. New Apex methods are available (User.UITheme and UserInfo.getUiTheme()) that provide a standardised approach that replaces the previous use of the sforce.one JavaScript global (and its unsupported approach caveat).
    5.     Apex Unit Tests
    New developers writing Apex Unit tests have suffered for years with the platform constraint that setup and non-setup objects can’t be created in the same Apex transaction (Mixed DML Operation Error). Typically this is problematic where User records are created in the test context alongside test records such as Accounts etc. With Spring ’16 it is now possible to create the setup object via @future method. A second improvement in context is the ability to change record creation date field values using the System.Test.setCreatedDate method. Where record processing logic is temporal in nature this ability will be helpful in writing tests that correctly validate the code logic.
    6.     Enterprise Edition customers now get access to 25 developer sandboxes instead of 1

Thursday 11 February 2016

Moving pick-list values up and down (reordering) in javaScript (Works only chrome, not working for Firefox and IE)

<!-- To switch the picklist values -->
    function arraymove(direction) {
        var optionslist = document.getElementById('select-2').options;
        var selLst = [];
        var unselLst = [];
        var combLstVals = [];
        var combLstLabels = [];
        var combLstSel = [];
        var selStartIndex;
        var count = 0;
        for(i=0;i<optionslist.length;i++) {
            if(optionslist[i].selected) {
                if(count == 0)
                    selStartIndex = i;
                count++;
                selLst.push(optionslist[i]);
            }
            else {
                unselLst.push(optionslist[i]);
            }
        }
        var ovelAllLength = selStartIndex + selLst.length;
            var isApply = false;
            //Down Arrow Logic
            if(direction == 'down') {
                if(selStartIndex != null && (ovelAllLength < optionslist.length || selStartIndex == 0)) {
                    isApply = true;
                    if(selStartIndex != 0) {
                        for(i=0;i<unselLst.length;i++) {
                            if(i == selStartIndex) {
                                combLstVals.push(unselLst[i].value);
                                combLstLabels.push(unselLst[i].label);
                                combLstSel.push(false);
                                for(j=0;j<selLst.length;j++) {
                                    combLstVals.push(selLst[j].value);
                                    combLstLabels.push(selLst[j].label);
                                    combLstSel.push(true);        
                                }
                            }
                            else {
                                combLstVals.push(unselLst[i].value);
                                combLstLabels.push(unselLst[i].label);
                                combLstSel.push(false);
                            }
                        }
                    }
                    else {
                        combLstVals.push(unselLst[0].value);
                        combLstLabels.push(unselLst[0].label);
                        combLstSel.push(false);
                        for(j=0;j<selLst.length;j++) {
                            combLstVals.push(selLst[j].value);
                            combLstLabels.push(selLst[j].label);
                            combLstSel.push(true);        
                        }
                        for(i=1;i<unselLst.length;i++) {
                            combLstVals.push(unselLst[i].value);
                            combLstLabels.push(unselLst[i].label);
                            combLstSel.push(false);
                        }
                    }
                }                          
            }
            //Up Arrow Logic
            else if(direction == 'up') {
                if(selStartIndex != 0 && selStartIndex != null) {
                    isApply = true;
                    if(selStartIndex == 1) {
                        for(j=0;j<selLst.length;j++) {
                            combLstVals.push(selLst[j].value);
                            combLstLabels.push(selLst[j].label);
                            combLstSel.push(true);        
                        }
                        for(i=0;i<unselLst.length;i++) {
                            combLstVals.push(unselLst[i].value);
                            combLstLabels.push(unselLst[i].label);
                            combLstSel.push(false);
                        }
                    }
                    else {
                         for(i=0;i<unselLst.length;i++) {
                            if(i == selStartIndex - 1) {
                                for(j=0;j<selLst.length;j++) {
                                    combLstVals.push(selLst[j].value);
                                    combLstLabels.push(selLst[j].label);
                                    combLstSel.push(true);        
                                }
                                combLstVals.push(unselLst[i].value);
                                combLstLabels.push(unselLst[i].label);
                                combLstSel.push(false);                            
                            }
                            else {
                                combLstVals.push(unselLst[i].value);
                                combLstLabels.push(unselLst[i].label);
                                combLstSel.push(false);
                            }
                        }
                    }
                }
            }      
            if(isApply) {
                for(i=0;i<optionslist.length;i++) {
                    optionslist[i].value = combLstVals[i];
                    optionslist[i].label = combLstLabels[i];
                    optionslist[i].selected = combLstSel[i];
                }
            }
    }

Thursday 4 February 2016

Multiplication pattern with Apex

Multiplication Pattern -

/*     10*2 =20     20*2 =40     40*2 =80     80*2 =160     160*2 =320 */ public class Apptitude {     public static void multiplicationPattern1(Integer num) {         Integer n = num;         for(Integer i=0;i<n;i++) {             system.debug(Integer.valueOf((math.pow(2, i)*10))+'*2 ='+Integer.valueOf((math.pow(2, i)*20))+'\n');         }     } }

Labels