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
sihmeieossihmeieos 

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? 


If you understand the reason, please tell me.
 
Thanks. 
Best Answer chosen by Admin (Salesforce Developers) 
prageethprageeth

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());

 

Message Edited by prageeth on 02-18-2010 10:02 PM

All Answers

prageethprageeth

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());

 

Message Edited by prageeth on 02-18-2010 10:02 PM
This was selected as the best answer
sihmeieossihmeieos

Hello 

Thanks for you help.

I think I  do careless mistak.

sorry.

 

 

Thank you.