Dears,
please advise how to lock directly a form data source after submitting the workflow without refreshing the form knowing it's a custom Form and Workflow.
Hi Sylvester,
I'll provide you the sample code which you modify as per your need. On the form level, write a method called editvalues() where we pass the logic for disabling the edit on datasource based on the workflow state.
void editvalues() { ; if(Book.WorkflowState == WorkflowState::Draft || Book.WorkflowState == WorkflowState::Rejected || Book.WorkflowState == WorkflowState::ChangeRequested) {Book_DS.allowEdit(true); } else {Book_DS.allowEdit(false); } }
In the form datasource level call this method in the init & cursornotify methods.
public void init() { super(); element.editvalues(); }
public void cursorNotify(int _event) { super(_event); element.editvalues();
}
If it was helpful, please mark it as verified.
Hello Abdul Wasi,
the code didn't work, i still have to refresh the form in order to lock the DS :(
i used it the same exact way you told me
Hi sylvesterD365,
You should call the editValues method from the primary data source active method. Please check the PurchTable data source active method in PurchTable form as an example.
Call the editvalues() method in the data source active method too.
public int active()
{
int ret;
ret = super();
element.editvalues();
return ret;
both suggestions didn't work :(
Could you share a screenshot of your form data sources and your code for this?
make sure you have added the below code after the if(dialog.parmIsClosedOK()) in the main() method of the submitmanager class
if(FormDataUtil::isFormDataSource(_args.record()))
FormDataUtil::getFormDataSource(_args.record()).research(true);
_args.caller().updateWorkflowControls();
Thanks Abdul Wasi it worked
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 756 Super User 2025 Season 2
CA Neeraj Kumar 678
Martin Dráb 526 Most Valuable Professional