Page 1 of 1

Lock Custom Field on the Sales Order

PostPosted: Mon Sep 26, 2016 1:52 pm
by SBarnes
Hi All,


Is there a way to lock a custom line field on a sales order the following doesn't work?



#region "LineCustomFieldPlugin"
public class LineCustomFieldPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaLineCustomFieldPlugin
{


public void FormatCell(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic BusinessLogicHost, JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm FormObject, int Col, int Row, JiwaFinancials.Jiwa.JiwaApplication.IJiwaLineCustomFieldValues HostItem, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
{
if ( CustomField.PluginCustomField.Name == "ConsolidateHistText")
{

GridObject.ActiveSheet.Cells[Row, Col].Locked = true;
GridObject.LockColumn(true, "ConsolidateHistText",Row);

}
}

}
#endregion

Re: Lock Custom Field on the Sales Order  Topic is solved

PostPosted: Tue Oct 04, 2016 10:59 am
by SBarnes
To answer my own problem and hopefully help others.

You need to add an event handler to the form for LineCustomSettingValuesDisplayed such as

Code: Select all
salesform.LineCustomSettingValuesDisplayed += LineCustomDisplayed;


And then have a function such as the following, note that custom fields are referenced by the PluginName.CustomFieldName.

Code: Select all
   public void LineCustomDisplayed(JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField customField, int Row, ref JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid GridObject)
   {
      
      GridObject.LockColumn(true,"MyPluginName.ConsolidateHistText",Row);
   }

Re: Lock Custom Field on the Sales Order

PostPosted: Thu Oct 03, 2024 5:38 pm
by Crowe
A word of caution for those that come after:

I tried using this and for some still-unknown reason it severely hampers performance when reading or saving the Sales Order.
As an alternative there is a plugin in another thread that doesn't appear to have this problem: viewtopic.php?f=26&t=2429&p=9259