Page 1 of 1

LockColumn for Purchase Order Line custom fields

PostPosted: Mon Sep 16, 2024 2:03 pm
by Crowe
I am having issues finding the right event to get GridObject.LockColumn to work for custom fields on Purchase Order Lines.

I have this working for Sales Orders with this in the class LineCustomFieldPlugin:
Code: Select all
public void FormatCell(IJiwaBusinessLogic BusinessLogicHost, JiwaGrid GridObject, IJiwaForm FormObject, int Col, int Row, IJiwaLineCustomFieldValues HostItem,
CustomField CustomField, CustomFieldValue CustomFieldValue)
{
    string pluginName = CustomField.PluginCustomField.CustomFieldCollection.Plugin.Name;
    if (FormObject is SalesOrderEntryForm)
    {
        var salesOrderForm = (SalesOrderEntryForm)FormObject;
        salesOrderForm.LineCustomSettingValuesDisplayed += delegate
        {
            int rowCount = salesOrderForm.grdLines.ActiveSheet.RowCount;
            if (Row >= rowCount) return;
                   
            GridObject.LockColumn(true, string.Format("{0}.{1}", pluginName, "CustomFieldName"), Row);
        };
    }
}


However, Purchase Order doesn't seem to have LineCustomSettingValuesDisplayed and none of the events I tried worked. Is there an equivalent event I can use?

Re: LockColumn for Purchase Order Line custom fields  Topic is solved

PostPosted: Mon Sep 16, 2024 2:51 pm
by Mike.Sheen
You have to do this the long, boring way - which is in each place where a line is displayed, set the lock status.

Some forms have a LineDisplayed event which you could use that - sales orders and quotes do - but unfortunately purchase orders do not.

We've identified this deficiency and have it logged as an improvement : DEV-10656.

I've done up a plugin for the purchase order form (attached) which covers all the events you need to handle to lock or unlock custom line fields - see if that suits your needs.

Re: LockColumn for Purchase Order Line custom fields

PostPosted: Mon Sep 16, 2024 6:01 pm
by Crowe
That worked wonderfully, thank you very much.