• Adam Cadman 4
  • 0 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 13
            Database.SaveResult[] srList = Database.insert(conList, false);
            integer size=srList.size();
             system.debug('srList size'+size);
               List<Database.SaveResult> Result=srList;
                //Failed Records
                failedconlist=new List<contact>();
                for (Integer i = 0; i<srList.size(); i++) {
                Database.SaveResult s = Result[i];
                contact origRecord = conList[i];
                  // List<Database.Error> err= s.getErrors();
                    ErrorLog__c log=new ErrorLog__c();
                    log.AccountId__c= origRecord.Accountid;
                    for(Database.Error err : s.getErrors()) {
                    // log.ErrorStatusCode__c=err.getStatusCode();   
                    // log.ErrorMessage__c=err.getMessage();
                   // log.ErrorFields__c=err.getFields();

Hello Experts ,
i have batch class which will insert thousand's of records .so if some records fail  i am trying to insert into error log object .
Help Needed :
1.while i am creating these records into custom object i am not able to insert error messages from DataBase.saveresult .
2.After inserting how to re-process them other than manual process .

Below is my sample code :
when i try to assign errormessage or statuscode to text fileds to not allowing .

Please give me some sample code or suggestion .

Thankyou in advance.


I am trying to upsert multiple objects using API REST call /services/data/v44.0/composite/sobjects (sObject Collection) refercing the objects to External Ids, but so far, I haven't had any luck.

I am doing something like:

    "allOrNone": false,
    "records": [
            "attributes": {
                "type": "Account"
            "MyExternalID__c": "27",
            "LastName": "test-test :( test-tes",
            "PersonEmail": "email@email.com"

But I get al the time this error message:

        "success": false,
        "errors": [
                "statusCode": "MISSING_ARGUMENT",
                "message": "Id not specified in an update call",
                "fields": []

Any clue?

Thanks in advance!


How can i calculate time between last modified date and present modified date and get the time in minutes.
where can i store t, in number field or text field.

thank for suggestion
How to Display 15 Digit ID to 18 Digit ID in Sales force
Hi Experts,
     I would like to know the exact difference between 15 and 18 digits record id. Most of us say, 15 digit(case sensitive) and 18 digit(case insensitive).

Let's consider a small example,
While if you query record from Developer Console you will get 18 digit record id. Consider the below retrieved 18 digit id,

001i000001AWbWuGTA(Retrieved from query)

If 18 digit case insensitive means,

001i000001AWbWugta (this id same to the above retrieved ID)? If yes, then if you queried record with this id means, you will get no result or no rows found..!

So if both 15 and 18 are unique means what is the real time use and difference between these two ID's.

Thanks in advance..!


I am accessing custom setting values in my apex code and its working fine. When I am calling it through test class then No values gets in from Custom Setting. It always blank in test class. Can somebody help me to understand why custom settings values are not accessible in test class.



Vinod Kumar

new here


i am only seeing the first 15 digits id of a record in the url when i choose 1 record. is there a way for me to see the whole 18 digits?



  • January 04, 2012
  • Like
  • 0

Hello. I want to know how can i create a Map<String, CustomObject> where the key will not be the Id of the custom field but the Name field and without using a list and going through each record and puting in the map a pair.

If I use Map<String, CustomObject__c> myMap = new Map<String, CustomObject__c>([Select z.Name, z.Id From CustomObject__c z]); i have a map where the key is my CustomObject.Id and I want it to be CustomObject.Name.

I'm looking for a method that will have a join/implode functionality.


I cannot seem to find an equivalent in the docs.  Does one exist in APEX?



Simply put the following formula into a formula field of type "Text":




This is an optimized version of the code example "BPS: 18 digit external ID within the UI" you can find on the Online Help, but unlike the example provided there, it is small enough to fit into a formula field. Also, this code doesn't contain the error found in the online help example, where the second character byte equivalent of the first 5-character chunk was "4" instead of "2". I'd be more than happy if someone could come up with an even shorter version of this formula...Still, I hope you can use this.



Erik Mittmeyer

Hey guys,


needed a way to convert from a 15 digit ID to an 18 digit one.

Found the javascript version for just such an action here: http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=13148


tried to make my own apex version but the last digit keeps coming out wrong.  Any Ideas?






String id = '001Q0000002NXad'; //a sample id


String suffix = '';

for(integer i=0;i<3;i++){

Integer flags = 0;

for(integer j=0;j<5;j++){
String c = id.substring(i*5+j,i*5+j+1);

if(c >= 'A' && c <='Z'){

flags += 1 << j;

if (flags <= 25) {

suffix += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.substring(flags,flags+1);

}else suffix += '012345'.substring(flags-26,flags-26+1);

System.debug('18-DIGIT:'+Id + suffix);




Message Edited by astro on 05-01-2009 10:04 PM
Message Edited by astro on 05-01-2009 10:10 PM
  • May 01, 2009
  • Like
  • 0

Hi, I am having trouble about the mapping the correct record ID. I got a 18 character case-insensitive id field value for account by using Table query, but when I want to use this 18 character to update a field in a record in a custom object (purchase requisition), it will only pick the first 15 character and update the record with a wrong account name.
How to correct this?