Thursday, 23 January 2014

Custom Financial Dimension Update in Sales order


 Created Custom Dimension and need to Update the value based on  some field modification in sales order

public boolean modified()
{
    boolean ret;
   DimensionAttributeValueSetStorage dimstorage;
    Counter i;
    DimensionAttribute modeofdelivery;
    DimensionAttributeValue modeofdeliveryvalue;
    str 255 dimvalue ="10";
    Name dimName="ModeofDelivery";
    ret = super();
    dimstorage = DimensionAttributeValueSetStorage::find(SalesLine.DefaultDimension);
    modeofdelivery = DimensionAttribute::findByName(dimName);
    if(dimvalue)
    {
       modeofdeliveryvalue = DimensionAttributeValue::findByDimensionAttributeAndValue (modeofdelivery,dimvalue,true,true);
        dimstorage.addItem(modeofdeliveryvalue);
    }
    else
        dimstorage.removeDimensionAttribute(DimensionAttribute::findByName(dimName).RecId);

    SalesLine.DefaultDimension = dimstorage.save();

    return ret;
}

No comments:

Post a Comment