• PC2012
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hello all,

I'm running into an error that just doesn't make sense to me. I have a trigger on OrderItem that evaluates related payments to an order to determine if it is paid off. The error claims that a change to the order currency is happening, but that is not the case. I've debugged the before and after object maps to verify that CurrencyIsoCode is unchanged.
 
Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OrderItemTrigger: execution of AfterInsert
caused by: System.DmlException: Update failed. First exception on row 0 with id 8013D0000009C8hQAE; first error: FIELD_INTEGRITY_EXCEPTION, You can't edit the order currency when the order has order products.: Contract Currency: [CurrencyIsoCode]

Here is the trigger handler:
private void evaluatePaidOffStatus(List<OrderItem> orderItems) {
	if (shouldRun('evaluatePaidOffStatus')) {
		methodRunMap.put('evaluatePaidOffStatus', false);
		
		Set<Id> orderIds = new Set<Id>();
		for (OrderItem orderItem : orderItems) {
			orderIds.add(orderItem.OrderId);
		}
			
		OrderTransferService.evaluateOrderPayments(orderIds);
	}
}



and the erroring method:
public static void evaluateOrderPayments(Set<Id> orderIds) {
	Order[] orders = [select Id, Grand_Total__c, Paid_Off__c, (select Id, pymt__Amount__c from Payments__r) from Order where Id in :orderIds];// and Type != 'EDI'];
	for (Order order : orders) {
		Decimal amountPaid = 0.00;
		for (pymt__PaymentX__c payment : order.Payments__r) {
			amountPaid += payment.pymt__Amount__c;
		}

		order.Paid_Off__c = amountPaid >= order.Grand_Total__c;
	}
		
	update orders;
}

Thanks for any insight you all can give
 
Hi Everyone,

Does anyone have experience integrating Cognos with SFDC?  I am looking to initiate a Cognos report from SFDC which will contain both SFDC and external data.  I also need to keep SFDC sharing rules intact.

Thanks in advance.

Win 32 system, XP OS. Using Eclipse Helios, Followed the following URL to do the very basic - install the eclipse plugin for Force.com, but no dice.  Here is the error at 47% everytime.  I don't see any resolution when i searched online.  Not sure if i am doing something wrong, or maybe the install documentation is incorrect, or may be an error in the installation package.  Pls. take a look and let me know what is going on.  Thanks.

 

An error occurred while collecting items to be installed
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 7251ab037ae632a5a9835c7c07210451 and found 7fcf87fad05f91b6c00745869ba36929.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.core,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 44db36699ca7fdd38917fced4e63c3b3 and found 7c211598ddd92347f0671c339fda7ac6.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.documentation,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 6d87eb2e76e7e19f7b709682e5272dfc and found 25a4e7db6ebe25b7a3cbcfd8119d38f2.