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
Anish Mahadik 1Anish Mahadik 1 

Issue of Argument cannot be null

Hi All,

We have scheduled job and it is getting failed from last  few days with following error.

Cause:null LineNumber:5 Message:Argument cannot be null. StackRace:Class.GenerateHashDigest.generateSHA256HashCode: line 5, column 1

Below is the code line which causing an issue in both of these classes.
      public static String generateSHA256HashCode(String nricNumber){
        Blob targetBlob=blob.valueOf(nricNumber);
        Blob hashValue=Crypto.generateDigest('SHA-256',targetBlob);
        String hasValueNricNumber=EncodingUtil.convertToHex(hashValue);
        return hasValueNricNumber;

string nrHasCusStr = GenerateHashDigest.generateSHA256HashCode(eachTL.NRIC__c);

Need help on above issue. Thanks in advance.

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Anish,

Can you keep the null check where ever you are passing the arguments. The error is occuring mainly because some argument is passing as NULl.

If this solution helps, Please mark it as best answer