function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kumar5Kumar5 

Exception Error Message and error Id in one lin

Hi Team,
I am trying to catch  the exception message and record id, i  am  able to get both. But two different lines are gettting. Could you please help me with below
 catch(DmlException e)          
        {
        Integer numErrors = e.getNumDml();
        for(Integer i=0;i<numErrors;i++) {
        ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.Error, e.getDmlId(i));
        ApexPages.addMessage(msg);
        // errorMsg += msg;
        errorMsg =  ' [e] ' + msg;
        newpage = null;
        }


Thanks,
Kumar