Wednesday, February 5, 2020

Check type of object in Lightning controller.js

({
    doInit: function(cmp) {
        var recId = cmp.get('v.recordId');
        var recIdSubString = recId.substring(0, 3);
       
        if(recIdSubString=='00U'){
            cmp.set("v.objectType", "Event");
        }
       
        if(recIdSubString=='500'){
            cmp.set("v.objectType", "Case");
        }
    }
})

No comments:

Post a Comment