I need to update line pricing in a UE BeforeSubmit script.
I'm able to set the 'rate' value, but when I try to change the 'amount' I get:
An unexpected error has occurred. Please click here to notify support and provide your contact information.
(useless!!!!)If I comment out the code that is trying to set 'amount' the operation complete, but when I look at the SO the rate and amount don't match (no bueno)I've tried setting the price_display field as well and that has no effect. I can read it and I can set it from a client script, but not from UE.So my issue is very simple: What magic set of operations need one do to change the price of a line item?Oh, in case the code helps: PricingManager.prototype.SetPricing = function PricingManager_SetPricing() { // First determine if the prerequisites are met: // 1) Has Insurance if(this.hasInsurance() == false) { log('Aborting pricing operation, patient does not have insurance,'); return; } // Loop through the lines and set the price for all items that have the // AutoPrice option checked. var numLineItems = this._salesOrder.getLineItemCount('item'); log('Sales Order has ' + numLineItems + ' lines items'); for(var i = 1; i <= numLineItems; i++) { var requiresAutoPricing = this._salesOrder.getLineItemValue('item', TRANS_COL_FLDS.AUTO_PRICE, i) == 'T'; log('Line item ' + i + ' Auto Price value: ' + requiresAutoPricing); if(requiresAutoPricing == false) { log('skipping item ' + i + ' because the Auto Price option is not set'); continue; } // Get the pricing from the insurance plan, if a negative value is // returned there was an error and we need to suspend further processing // of this order. It will need to be reviewed! var itemID = this._salesOrder.getLineItemValue('item', 'item', i); Guard.NotNullOrEmpty(itemID, 'A valid item ID is required'); var isRental = this._salesOrder.getLineItemValue('item', TRANS_COL_FLDS.IS_RENTAL, i) == 'T'; var priceType = (isRental) ? ITEM_PRICE_TYPE.RENTAL : ITEM_PRICE_TYPE.PURCH; var price = this.getMedicareItemPrice(itemID, priceType); log('price_display: ' + this._salesOrder.getLineItemValue('item', 'price_display', i)); //this._salesOrder.setLineItemValue('item', 'price_display', i, 'Custom'); this._salesOrder.setLineItemValue('item', 'rate', i, price); //this._salesOrder.setLineItemValue('item', 'amount', i, price); } }