Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Workflow validation on submit button

(1) ShareShare
ReportReport
Posted on by 129
I am trying to add validation before Timesheet workflow submit: 
 
All timesheet-> click on workflow ->submit ->will check if validation pass->workflow submitted successfully.
 
For that I have done:
1. write logic in a class:
class abcTSTimesheetapprovalvalidationworkflow extends WorkflowWorkItemActionManager
{
logic to validate;
}
2. create action menu item and add above class 
what should be the next step in it so that I can use the validation?
 
OR is there any other way for this validation before workflow submit for timesheet?
 
Thankyou.
Ayusri
  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Workflow validation on submit button
    There is a method named validateSubmit on TSTimesheetTable - Just write COC for that method and check whether its suits your scenario.
    Also, there is a method named validate on the TsWorkflowActionManager class which will be called whenever you submit the header workflow. Add COC for that method and add validation there. 
     
    Thanks,
    Girish S.
  • aayushii Profile Picture
    aayushii 129 on at
    Workflow validation on submit button
    Hi Girish,
     
    Thankyou for the quick reply!
    When I tried: cansubmittoworkflow COC method on table: TSTimesheetTable
    it will give this error (validation) everytime I tried  to open this timesheet entry whenever i tried to do other operation like save, it throws this error.
    But, I want this validation only when I click on workflow button not before this step.
     
    thankyou
  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    Workflow validation on submit button
    Hi Ayushri,
     
    I would suggest you to add validation on canSubmitToWorkflow method at table level.
    This method will decide whether to show the workflow submit button based on some condition.
     
    Thanks,
    Girish S.

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.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans