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?

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

1 Answer 1

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .