logObj.MC_LineNumber__c = err.getLineNumber();
Why is it showing an error like "Illegal assignment from Integer to String" ?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityMake sure that destination field type is same as that of the value you are trying to put into it.
If MC_LineNumber__c
is of type string then use
logObj.MC_LineNumber__c = String.valueOf(err.getLineNumber());
Or else, specify return type of method getLineNumber()
same as that of MC_LineNumber__c
.
Try this:
logObj.MC_LineNumber__c = String.valueOf(err.getLineNumber());
EDIT It might also help to consider changing MC_LineNumber__c
to a Number field if it's only ever going to contain numbers.