Locking or hiding custom fields

Posted:
Fri Jul 15, 2016 12:13 am
by SBarnes
Hi All
Is there a way to lock or even hide custom fields in the sales order screen under specific conditions such as until an order has been saved?
Re: Locking or hiding custom fields 

Posted:
Sun Jul 31, 2016 1:26 pm
by Mike.Sheen
Hi Stuart,
The FormatCell methods of the CustomField and CustomLineField classes can we used to lock cells or hide rows.
Attached is an example.
The important bit is shown below:
- Code: Select all
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.IJiwaCustomFieldValues HostObject, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomField CustomField, JiwaFinancials.Jiwa.JiwaApplication.CustomFields.CustomFieldValue CustomFieldValue)
{
if ( CustomField.PluginCustomField.Name == "Test")
{
// lock custom field if sales order not saved yet
var salesOrder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)BusinessLogicHost;
if (salesOrder.InsertFlag)
{
GridObject.ActiveSheet.Cells[Row, Col].Locked = true;
}
}
}
Mike
Re: Locking or hiding custom fields

Posted:
Mon Aug 01, 2016 11:47 am
by SBarnes
Hi Mike,
Thanks for the help and the example to lock the field, after a little investigation and for the sake of completeness, the row can be hidden by changing
GridObject.ActiveSheet.Cells[Row, Col].Locked = true;
to
GridObject.ActiveSheet.SetRowVisible (Row, false);