Lock Custom Field on the Sales Order  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Lock Custom Field on the Sales Order

Postby SBarnes » Mon Sep 26, 2016 1:52 pm

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
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1646
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 182

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

Postby SBarnes » Tue Oct 04, 2016 10:59 am

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);
   }
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1646
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 182

Re: Lock Custom Field on the Sales Order

Postby Crowe » Thu Oct 03, 2024 5:38 pm

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
Crowe
I'm new here
I'm new here
 
Posts: 3
Joined: Wed Jun 14, 2023 4:45 pm


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 9 guests

cron