You need to sign in to do that
Don't have an account?

Constructor not defined: [CustomFields].<Constructor>(String, Date)
How do I define a Date field in the class to call in a Constructor
Here is my class -
public class CustomFields { public String fieldName; public String stringValue; public CustomFields(String fieldName, String stringValue){ this.fieldName = fieldName; this.stringValue = stringValue; }
Here is the constructor
jo.customFields = new List<CustomFields>(); jo.customFields.add(new CustomFields('CX.LEADS360ID', currentOpp.Opportunity_ID__c)); jo.customFields.add(new CustomFields('CX.LEADS360CAMPAIGN', currentOpp.Lead_Source_Name__r.Name)); jo.customFields.add(new CustomFields('Date.CX.LEAD.CREATE.DATE', currentOpp.Legacy_Lead_Date_Added__c)); jo.customFields.add(new CustomFields('CX.CRM.OWNER.EMAIL', currentOpp.Owner.Email));
I cannot add
jo.customFields.add(new CustomFields('Date.CX.LEAD.CREATE.DATE', currentOpp.Legacy_Lead_Date_Added__c));
Because Opp.Legacy_Lead_Date_Added__c is a date field . How do I add a date variable in my class and call it in the constructor
Error I am getting
Constructor not defined: [CustomFields].<Constructor>(String, Date)
How about converting the Date value to a string before adding the Legacy_Lead_Date_Added__c to list, something like this:
jo.customFields.add(new CustomFields('Date.CX.LEAD.CREATE.DATE', string.valueof(currentOpp.Legacy_Lead_Date_Added__c)));
All Answers
How about converting the Date value to a string before adding the Legacy_Lead_Date_Added__c to list, something like this:
jo.customFields.add(new CustomFields('Date.CX.LEAD.CREATE.DATE', string.valueof(currentOpp.Legacy_Lead_Date_Added__c)));