im having trouble with my webservice when updating my form, when i click update the message service says it has modified the data within salesforce, ive had success doing this abit further up in the form where the prices do update in salesforce but when ive tried to repeat this with the rest of the form it just doesnt update.
static WebService GecoAccountFormOnlyMessage modifyFields(formSubmission mform){
List<AccountProduct__c> getaccountinfofrompicklist = new List<AccountProduct__c>();
List<AccountProduct__c> accountinfoselect = [SELECT id,Name, PriceInitial__c, PriceRecurring__c, Project__c FROM AccountProduct__c WHERE Name = 'ACCPROD00000240'];
for(priceField price : mform.priceFields){
GecoAccountFormOnlyMessage response = new GecoAccountFormOnlyMessage();
for(priceField price1 : mform.priceFields){
for(AccountProduct__c cfd : accountinfoselect){
system.debug('cfd.priceinitial__c =' + cfd.PriceInitial__c);
if (price1.PInitial != cfd.PriceInitial__c){
cfd.PriceInitial__c = price1.PInitial;
system.debug('is this working?');
}
}
for(AccountProduct__c cfd : accountinfoselect){
system.debug('cfd.priceRecurring__c =' + cfd.PriceRecurring__c);
if (price1.PriceRec != cfd.PriceRecurring__c){
cfd.PriceRecurring__c = price1.PriceRec;
system.debug('is this working?');
}
system.debug('outside if statement');
}
}
}
upsert accountinfoselect;
GecoAccountFormOnlyMessage response = new GecoAccountFormOnlyMessage();
response.returnCode = GecoProductFormConnection.STATUS_OK;
response.message = 'Data modified successfully';
return response;
}
the above form updates the both prices no problem and works fine however the below code is where im having problems..
static WebService GecoAccountFormOnlyMessage changeFields(formSubmission formupdate){
List<FieldData__c> getupCogFieldData = new List<FieldData__c>();
List<FieldData__c> CogUpdateFieldValues = [SELECT Value__c FROM FieldData__c];
List<CogFieldDataLink__c> CogFieldValues = [SELECT CogFieldLink__r.FieldID__r.id, FieldData__r.Value__c,CogFieldLink__r.FieldID__r.Name__c FROM CogFieldDataLink__c WHERE AccountProduct__r.name = 'ACCPROD00000240'];
//system.debug('Running WebService?');
String debugstr = '';
for(valueField cog : formupdate.valueFields){
for(CogFieldDataLink__c pls : CogFieldValues){
//system.debug('pls.FieldData__r.Value__c =' + pls.FieldData__r.Value__c);
if (cog.formValue != pls.FieldData__r.Value__c){
pls.FieldData__r.value__c = cog.formValue;
//getupCogFieldData.add(pls);
}
}
}
upsert CogFieldValues;
GecoAccountFormOnlyMessage response = new GecoAccountFormOnlyMessage();
response.returnCode = GecoProductFormConnection.STATUS_OK;
response.message = 'Data modified successfully';
return response;
}
any help would be brilliant thanks