Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Why am I getting “Static method cannot be referenced from a nonstatic context: String String.valueOf(Object)”?

Asked by Angela Baker Apr 16, 2021 96 views 1 answer
Share

About this question

 have this static class called from my lightning component, but am getting the error

"Static method cannot be referenced from a non static context: String String.valueOf(Object)"

on the line where I try and calculate a start date from the string passed. What do I need to do to fix this?

@AuraEnabled public static void generatePDF(myRec__c rec, string selquarter){ string selqenddate = selquarter.substringBetween('(', ')'); date startdate = (selqenddate.valueOf(selqenddate)).addMonths(-3).startofMonth; myPDF(rec.id, '', ''); }

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.