Dear Adrian,
Thanks for your response.I have manage it through extention of salesTable's method cansubmittoworkflow method :
[PostHandlerFor(classStr(FormDataUtil), staticMethodStr(FormDataUtil, canSubmitToWorkflow))]
public static void FormDataUtil_Post_canSubmitToWorkflow(XppPrePostArgs args)
{
Common record = args.getArg(identifierStr(_record));
SalesTable salesTable = record as SalesTable;
SalesLine salesLine;
boolean ret = args.getReturnValue();
if (record.TableId == tableNum(SalesTable))
{
select firstonly salesLine where salesLine.SalesId==salesTable.SalesId;
if (salesTable.TxlWorkflowState == TxlWorkflowState::Draft && salesLine)
{
ret = boolean::true;
}
else
{
ret = boolean::false;
}
}
args.setReturnValue(ret);
}
Then I enabled workflow on SalesTableListPage form like this and it is working fine.
[FormEventHandler(formStr(SalesTableListPage), FormEventType::Initializing)]
public static void SalesTableListPage_OnInitializing(xFormRun sender, FormEventArgs e)
{
FormRun SalesTableListPage = sender;
FormBuildDesign SalesTableListPageDesign = SalesTableListPage.form().design();
SalesTableListPageDesign.workflowEnabled(true);
SalesTableListPageDesign.workflowDatasource(tableStr(SalesTable));
SalesTableListPageDesign.workflowType(workflowTypeStr(TxlSalesOrderWFType));
}
I am trying to enable same workflow in SalesTable form with same procedure in Initializing event of salesTable form but
it is not enabling.can you tell me what could be the reason of this issue.