You need to sign in to do that
Don't have an account?
KC0798
Retrieving date field and adding days to that field
I'm looking to update a date field that I've queried and add days to that field. Anyone can tell me how I can convert the field? The value is just appending as string.
I have the following but can't figure out how to convert:
var opportunities = sforce.connection.query(
// where Progress_Claim_Interval__c is a number value
"SELECT Id, AccountId, Claim_Date__c, Progress_Claim_Interval__c " +
"FROM Opportunity WHERE "+
"Claim_Date__c <> NULL and "+
"Claim_Date__c < today"
);
var rec = opportunities.getArray("records");
for (var i = 0;i<rec.length;i++) {
"FROM Opportunity WHERE "+
"Claim_Date__c <> NULL and "+
"Claim_Date__c < today"
);
var rec = opportunities.getArray("records");
for (var i = 0;i<rec.length;i++) {
alert("Old Claim Date:"+rec[i].Claim_Date__c);
rec[i].Claim_Date__c = rec[i].Claim_Date__c + rec[i].Progress_Claim_Interval__c; //How can I do this?
rec[i].Claim_Date__c = rec[i].Claim_Date__c + rec[i].Progress_Claim_Interval__c; //How can I do this?
alert("New Claim Date:"+rec[i].Claim_Date__c);
}
}
Many Thanks!
werewolf
That field will be in Javascript Date format, so use its methods to add days, like this article describes.
Whyser
What is the Progress_Claim_Interval__c?
Is it in days, months, years???
The line of code in question (// how can I do this) should read something like (assuming Progress_Claim_Interval__c is in days):
KC0798
Great Stuff! That did the trick! Thanks!