Good morning all,
This question is regarding the Salestable form.
We have an intercompany setup. When a salesline is delivered in the supply chain company, I would like to make the salesline readonly in both the supply chain company as the sales company.
I tried to add the following code (COC extension of the salesline formdatasource):
[ExtensionOf(formDataSourceStr(SalesTable, SalesLine))]
final class ELCWDSalesTableSalesline_Extension
{
public void init()
{
switch (element.args().dataset())
{
case tableNum(Salesline) :
Salesline localSalesline = element.args().record();
SalesLine saleslineSCNL;
SalesStatus salesstatus;
if(localSalesline.isInterCompanyOrder()==false)
{
ELCWDOnHandInfoClass onhandclass;
DataAreaId sccompany;
Purchline localpurchline;
//Get Supply Chain Company DataAreaId
onhandclass = new ELCWDOnHandInfoClass();
sccompany = onhandclass.returnSCCompany();
select firstonly localpurchline where localpurchline.InventRefTransId == localSalesline.InventTransId;
changecompany(sccompany)
{
select firstonly saleslineSCNL where saleslineSCNL.SalesId==localSalesline.salesid && saleslineSCNL.inventtransid == localpurchline.InterCompanyInventTransId;
salesstatus=saleslineSCNL.SalesStatus;
}
if(salesstatus != SalesStatus::Backorder || salesstatus != SalesStatus::None)
{
allowEditFieldsOnFormDS_W(element.dataSource(formDataSourceStr(SalesTable, Salesline)), false);
allowEditFieldsOnFormDS_W(element.dataSource(formDataSourceStr(SalesTable, SalesTable)), false);
allowEditFieldsOnFormDS_W(element.dataSource(formDataSourceStr(SalesTable, InventDim)), false);
allowEditFieldsOnFormDS_W(element.dataSource(formDataSourceStr(SalesTable, WHSLoadLine)), false);
allowEditFieldsOnFormDS_W(element.dataSource(formDataSourceStr(SalesTable, WHSSalesLine)), false);
}
}
break;
case tableNum(salestable) :
salestable localSalestable = element.args().record();
//For testing/dubugging purposes
info(localSalestable.salesid);
break;
}
next Init();
}
}
It seems args gets a SalesTable dataset.
Also: the dataset does not update.
As a second option I looked at the Salesline datasources' Active method, but this method seems not te be extendable with COC.
What am I missing here? I hope someone can put me in the right direction.