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
AnantGargAnantGarg 

FATAL_ERROR System.NullPointerException: Argument cannot be null.

I am here working on 'Product2' sObject where I have created a custom field mynamespace__post_id__c. Now with a piece of code, I am trying to update this post id. For a short brief of it please see the code.
productId = '01t0v000003SFQYAA4';
list<Product2> pro = [Select Id, Name, IsActive ,mynamespace__post_parent__r.mynamespace__post_id__c,(Select Id,Pricebook2Id,UnitPrice from PricebookEntries),mynamespace__post_id__c from product2 where Id =:productId];
        string postId = 20; 
        pro[0].mynamespace__post_id__c = Integer.valueOf(wooId.trim());
        try {
              List<Database.SaveResult> updateResults = Database.update(pro, true);
              System.debug(updateResults); // This is giving result as (Database.SaveResult[getErrors=();getId=01t0v000003SFQYAA4;isSuccess=true;])
        } catch (Exception e) {
              System.debug('exception in product update: '+e.getMessage());
        }
Now as the try block is showing isSuccess as true, the object is not getting updated. Also, the log is showing up a FATAL_ERROR. Can anyone help out where am I going wrong  
ProlayProlay
The error is in the value conversion. Put this in the try block also
pro[0].mynamespace__post_id__c = Integer.valueOf(wooId.trim());
I suppose something wrong with this variable
wooId.trim()

Check it out.