Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Not getting workflow o...
Finance forum
Suggested answer

Not getting workflow option

Posted on by 28
Hi,
 
I had followed this link for implementing the custom workflow
 
 
 I could submit my record to workflow but the submit button stayed in the workflow dropdown. The Cancel and View History buttons did not appear. I could also submit a record as many times as I wanted to, but the buttons did not switch.

At last, I found that the issue was the canSubmitToWorkflow method. It was returning true after it had been submitted and thus did not allow the buttons to switch.
 
[ExtensionOf(formStr(BankReconciliation))]
final class BankReconciliation_Extension
{
    
    /// <returns>boolean</returns>
    public boolean canSubmitToWorkflow()
    {
        boolean canSubmitWorkflow = next canSubmitToWorkflow();
        
        if (BankAccountTrans.WorkflowState != BankAccountWorkflowState::Approved)
        {
            canSubmitWorkflow = true; 
        }
        else
        {
            canSubmitWorkflow = false;
        }
        
        return canSubmitWorkflow;

       
    }
}
 
and also I tried to change the code as below
 
[ExtensionOf(formStr(BankReconciliation))]
final class BankReconciliation_Extension
{
    
    /// <returns>boolean</returns>
    public boolean canSubmitToWorkflow()
    {
        boolean canSubmitWorkflow = next canSubmitToWorkflow();
        
        if (BankAccountTrans.WorkflowState != BankAccountWorkflowState::Submitted)
        {
            canSubmitWorkflow = true; 
        }
        else
        {
            canSubmitWorkflow = false;
        }
        
        return canSubmitWorkflow;

       
    }
}
while using above code the workflow option itself not visible.
 
Thanks & regards,
Lasya
  • Suggested answer
    Ariba Mehdi Profile Picture
    Ariba Mehdi 148 on at
    Not getting workflow option
    Hi there, 

    I suggest you to make the extension of the relevant table and try the below code:
     
    public boolean canSubmitToWorkflow(str _workflowType = '')
    {
            boolean ret;
        
            ret = super(_workflowType);
            if(!(this.WorkFlowStatus == WorkFlowStatus::NotSubmitted))
                  ret = false;
            else
                  ret = true;
            return ret;
    }

Helpful resources

Quick Links

Can you answer this forum question?

You could make someone's day!

Community Newsletter - May 2024

Kudos to our community stars!

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283,676 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 224,910 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Featured topics

Product updates

Dynamics 365 release plans