0

I trying to add new row in Account object. My code :

 if(inputvalues[14].length() > 16)
              {a.ParentId = inputvalues[14].replaceAll('"','').replaceAll(' ','');   }

I read inputvalues[14] from csv file that have string

"Apteka test",...,"", "0015E00000aWUF4QAO"

and i get by select from acccount that id 0015E00000aWUF4QAO is true. But i get issue : Invalid id: 0015E00000aWUF4QAO Where is a problem?

  • 1
    Can you try using trim(), looks like there are invisible spaces. Secondly that a record with that Id should exisit in that enviornment. – Pranay Jaiswal May 24 '18 at 8:23
  • Are you running this in the test environment ? – coderdecoder May 24 '18 at 8:48
  • Thank, Pranary! These were invisible spaces, trim() have helped me – Oleg Savinkov May 24 '18 at 9:47
  • @PranayJaiswal Please add answer as your comment seems to have helped the OP. – Mr.Frodo May 27 '18 at 7:05
0

The string has leading/ trailing whitespaces that made ID to look invalid. Using trim() on that string helps getting rid of those.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.