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

CustomItem(numeric) is not Integer?
Hi.
I setup CustomObject and CustomItem.
the CustomItem(RevisionLength__c) is numeric value.
the CustomItem(PreRevisionDate__c) is date value.
I create the trigger.
trigger updateDeviceMng on DeviceMng__c (before insert, before update) {
Map<ID, ModelVL__c> model = new Map<ID, ModelVL__c>(
[select Id, Name, RevisionLength__c, LifePeriod__c, ReplacementCycle__c from ModelVL__c]);
for(DeviceMng__c d: Trigger.new){
System.debug(model.get(d.Model__c).RevisionLength__c);
for(Integer i=0; i<m.size(); i++){
d.NextRevisionDate__c = d.PreRevisionDate__c.addYears(model.get(d.Model__c).RevisionLength__c);
}
}
}
When save it, happend the error.
Save error: Method does not exist or incorrect signature: [Date].addYears(Double)
so, I change the code.
d.NextRevisionDate__c = d.PreRevisionDate__c.addYears((model.get(d.Model__c).RevisionLength__c).initValue);
But happend the error.
Save error: Initial term of field expression must be a concrete SObject: Double
Why the CustomItem is Double?(I think it is Integer)
Why don't use initValue?
Hello sihmeieos;
The function is not "initValue" but "intValue()"
Change following line
d.PreRevisionDate__c.addYears((model.get(d.Model__c).RevisionLength__c).initValue);
as below
d.PreRevisionDate__c.addYears((model.get(d.Model__c).RevisionLength__c).intValue());
All Answers
Hello sihmeieos;
The function is not "initValue" but "intValue()"
Change following line
d.PreRevisionDate__c.addYears((model.get(d.Model__c).RevisionLength__c).initValue);
as below
d.PreRevisionDate__c.addYears((model.get(d.Model__c).RevisionLength__c).intValue());
Hello prageeth.
Thanks for you help.
I think I do careless mistak.
sorry.
Thank you.