Enable workflow on button clicked

Hi,

How i can enable workflow on the clicked method of button in form

I am trying with this code but its not working

void clicked()
{

element.design().workflowEnabled(true);
element.design().workflowDatasource(tableNum(LedgerJournalTable));
element.design().workflowType(‘VendInvoiceRecordingTemplate’);
super();
// LedgerJournalTable_ds.reread();
}

Why do you want to do so?
It seems you are not updating the workflow controls after enabling it.

I just want to enable workflow on the clicked of button … how i can update the workflow control

element.updateWorkflwoControls(), something like this.