이 오류는 2 주 동안 나를 괴롭 히고 있습니다. 나는 Apex에 익숙하지 않으므로 쉽습니다.Salesforce.com - 기회 항목의 수량 변경이 잘못되었습니다.
나는 기회 갱신 후 방아쇠를 당겼다.
trigger triggerOpportunityCloseInstallDateChange on Opportunity (after update)
{
if(!Validator_cls.IsOpportunityScheduleUpdated())
{
Validator_cls.SetOpportunityScheduleUpdatedDone();
OpportunitySchedule.BuildScheduleAndUpdateDates(trigger.new, true);
}
}
업데이트 당 한 번만 호출되도록 래퍼가 있습니다.
해당 트리거가 실행되면 해당 광고 항목의 일정 날짜가 업데이트되고 해당 광고 항목 일정이 업데이트됩니다. 위에서 볼 수 있듯이
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger triggerOpportunityCloseInstallDateChange caused an unexpected exception, contact your administrator: triggerOpportunityCloseInstallDateChange: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 00kV0000002cHhTIAU; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: unknown (invalid quantity change on opportunity line item): [unknown]: Class.OpportunitySchedule.BuildScheduleAndUpdateDates: line 68, column 1
그 오류가 난을 변경하지 않는거야,이 라인
update ItemsToUpdate;
에 해당 : 나는 기회를 업데이트 할 때
public static void BuildScheduleAndUpdateDates(List<Opportunity> OpportunityList, Boolean DoUpdateItems)
{
system.debug('***********OpportunitySchedule : BuildScheduleAndUpdateDates HIT');
Map<String, Opportunity> OppMap = new Map<String, Opportunity>();
List<OpportunityLineItem> ItemsToUpdate = new List<OpportunityLineItem>();
List<String> IdList = new List<String>();
for (Integer i = 0; i < OpportunityList.size(); i++)
{
IdList.add(OpportunityList[i].Id);
OppMap.put(OpportunityList[i].Id, OpportunityList[i]);
}
List<OpportunityLineItem> lineItems = [Select o.Id, (Select OpportunityLineItemId From OpportunityLineItemSchedules), o.Opportunity.Id, o.Systems_Add_On__c, o.ServiceDate, o.Product_Family__c, o.Schedule_Length__c , o.Monthly_Quantity__c, o.Monthly_Amount__c, o.Quantity
From OpportunityLineItem o
where o.Opportunity.Id in:IdList];
for (OpportunityLineItem item : lineItems)
{
Opportunity opp_new = OppMap.get(item.Opportunity.Id);
Boolean hasSchedule = OpportunityProductLineItems.DoesLineItemHaveSchedule(item.Id);
if (opp_new.Term_Conversion__c != null)
{
item.ServiceDate = opp_new.CloseDate;
}
else
{
if(item.Product_Family__c == 'Systems')
{
if(item.Systems_Add_On__c == true)
{
item.ServiceDate = opp_new.Install_Date__c;
system.debug('***********BuildScheduleAndUpdateDates : Systems With Systems Add On ' + item.ServiceDate);
}
else
{
item.ServiceDate = opp_new.Install_Date__c.addDays(30);
system.debug('***********BuildScheduleAndUpdateDates : Systems With NO Systems Add On ' + item.ServiceDate);
}
}
else if(hasSchedule)
{
item.ServiceDate = opp_new.Install_Date__c.addDays(30);
system.debug('***********BuildScheduleAndUpdateDates : Has Schedule ' + item.ServiceDate);
}
else
{
item.ServiceDate = opp_new.Install_Date__c;
system.debug('***********BuildScheduleAndUpdateDates : No Schedule ' + item.ServiceDate);
}
}
//item.Quantity = 1;
ItemsToUpdate.add(item);
if(hasSchedule && !DoUpdateItems)
{
ProcessSchedule(item);
}
}
if(DoUpdateItems)
{
update ItemsToUpdate;
}
upsert schedulesToUpsert;
}
, 나는이 오류 수량을 계산합니다. 난 너무 혼란 스러워요. 그 행을 주석 처리하면 모든 것이 잘 작동합니다 (일정이 작성되고 업데이트 됨).
수량을 수동으로 설정할 수 있는지 확인하기 위해 item.Quantity = 1;
을 입력했습니다.
이 오류는 무엇을 의미하며, 지나치게 빠져 나갈 수 있습니까?