Hi:
This is my code:
I am not getting an error with this . The issue is from the date array it is inserting the last date and nothing else with the opportunity ID. It looks like it goes through the loop of the array but ends up placing just the last record of the array into my table. So I am lost on how to get the entire array in with the id.
like if they select 3/2/2007, 3/3/2007,3/4/2007 with the opportunity id 11111. It will place in 3/4/2007 and 11111.
it will not place in the other dates...
Any help would be appreciated thanks
Z
This is my code:
Code:
z_cal.prototype.submitSelections = function ()
//PRIVATE: submit the calendar's selection variables
{
var dtsdate = new sforce.SObject("Holiday_Vacation__c");
//alert(this.selectedDates[0].toJSDate() + "-" + dtsdate.Opportunity__c);
for(var i=0; i<this.selectedDates.length; i++)
dtsdate.Date__c = this.selectedDates[i].toJSDate();
dtsdate.Opportunity__c = "{!Opportunity.Id}";
var result = sforce.connection.create([dtsdate]);
if (result[0].getBoolean("success")) {
alert("new account created with id/Date " + result[0]);
} else {
alert("failed to create account " + result[0]);
}
};
I am not getting an error with this . The issue is from the date array it is inserting the last date and nothing else with the opportunity ID. It looks like it goes through the loop of the array but ends up placing just the last record of the array into my table. So I am lost on how to get the entire array in with the id.
like if they select 3/2/2007, 3/3/2007,3/4/2007 with the opportunity id 11111. It will place in 3/4/2007 and 11111.
it will not place in the other dates...
Any help would be appreciated thanks
Z