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
Bhakti GujarathiBhakti Gujarathi 

Malformed_Id error while updating a record in testclass

i have writen a test class. in which i have created the test data..now one of the method in the controller for which i have written the test class updates the record created previously. but on the UPDATE statement igive me error: Update failed: first Error Malformed_Id incorrect Id Type.
Vishal Negandhi 16Vishal Negandhi 16
It'd help if you share your code here for us to check and find out the issue. 

However to give you some hints, this usually happens when we sometimes add such codes:

Contact con = new Contact();
con.AccountId = '123456'; // this is not right, 123456 is not a valid id for Accounts
con.LastName = 'test';
insert con;

So check in your code if there are any reference fields that have invalid id assigned. 
Bhakti GujarathiBhakti Gujarathi
i have tried printing the id. it is getting proper Id of 18digits of opportunity. so i guess the problm is not in the format of Id.