Announcements
Hello All,
I want to remove the line from grid if its validation fails in the validatewrite() method of form datasource. How can i achieve this?
Thank you
Hi Jeff,
If the validation fails, then the record won't be written to the table.
You can try calling the FormDataSource.delete() method and check whether it works.
Thanks,
Girish S.
You are correct, the record wont be written to the table. But I want to remove this record.
When I am using FormDatasource.delete() or FormDataSource.deletemarked(), it is removing the other line and not this new draft/uncreated line. Although this new line is checked in the grid.
If the validation fails, try to set the cursor position to the previous last inserted record against the header. You can use findRecord method of the FormDataSource. Also try using positionToRecord of FormDataSource and see if it deletes the error line.
Thanks for the suggestion.
Can you give sample code for this.
Refer to the below blog.
https://community.dynamics.com/ax/b/axhari/posts/form-datasource-find-record-method
http://rohitdynamics.blogspot.com/2017/09/pointing-record-to-current.html
Also try calling the FormDataSourceName.clear(). For example, HcmWorker.clear() or HcmWorker.delete().
I tried calling buffer.delete() as well but its giving the same result i.e. deleting already saved/created line and not the new/draft line.
buffer = formdatsource.cursor()
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SajeedMullaji 312
André Arnaud de Cal... 284 Super User 2026 Season 2
Martin Dráb 258 Most Valuable Professional