Prior to User Defined Functions and dynamic object concept, the default Price List Report had database object associated with it. Hence, the User Defined Field added by a TDL Programmer was persisting along with the default methods within the Stock Item Object.
Now, the default Price List Report design is changed which now associates dynamic memory object which does not persist to database as it is. On the acceptance of the Form, all the Price List values entered by the user are updated within the Stock Item Object.
The reason for this change was to enhance the performance. Since all the Stock Items whether Price List was updated or not were getting saved consuming lot of time and memory unnecessarily. This approach has enhanced the performance drastically by allowing the user to choose and save only those Stock Items where the price list were required to be updated.
To update user defined field
Following needs to be done to save UDF within Stock Item :-
1. One needs to alter the UI to add relevant Fields wherever required.
2. Alter the default dynamic object to add relevant storages.
3. Within the default UI Form, on Form Acceptance at end, call an User Defined Function to update only the UDF Values
For example,
[System: UDF]
PLDiscAmt : Amount : 1000
[#Object: MPL Price Level List]
Storage : Discount Amt : Amount
[#Line: MPS Explode]
Add : Fields : PL Disc Amt
[Field: PL Disc Amt]
Use : Amount Field
Storage : Discount Amt
Set as : $(StockItem, #MPSStockItemName).FullPriceList[1,($PriceLevel = ##SVPriceLevel AND $Date = ##SVPriceLevelDate)].PriceLevelList[$$Line].PLDiscAmt
[#Form: Multi Price Set]
Add : On : Form Accept : Yes : CALL : PL Update UDF
[Function: PL Update UDF]
Variable: StockItem : String
Variable: FromQty : Quantity
Variable: ToQty : Quantity
Variable: DiscountAmt : Amount
00 : WALK COLLECTION : Full Price List
10 : SET : StockItem : $StockItemName
20 : WALK COLLECTION : Price Level List
30 : IF : NOT $$IsEmpty:$DiscountAmt
40 : SET : FromQty : $StartingFrom
50 : SET : ToQty : $EndingAt
60 : SET : DiscountAmt : $DiscountAmt
70 : MODIFY OBJECT : (Stock Item, ##StockItem).FullPriceList[1, ($PriceLevel = ##SVPriceLevel AND $Date = ##SVPriceLevelDate)].PriceLevelList[1, ($StartingFrom = ##FromQty AND $EndingAt = ##ToQty)].PLDiscAmt[1].PLDiscAmt : ##DiscountAmt
80 : ENDIF
90 : END WALK
100 : END WALK