Announcements
Hello everyone,
I need to create a workflow for which "canSubmitToWorkflow" method needs to be created on standard table which doesn't have canSubmitToWorkflow method but development is to be done using extensions.
In table extensions we can't override standard methods which in-turn can't create "canSubmitToWorkflow" method.
how can we achieve/write canSubmitToWorkflow method without customizing standard table.
*This post is locked for comments
Extension of ‘CanSubmitToWorkflow’ method in standard table which is not overridden by standard:
‘CanSubmitToWorkflow’ is being called from FormDataUtil:: CanSubmitToWorkflow() method for which post event handler can be written, which is purely extension.
Detail example is shared in below post by @satish https://community.dynamics.com/ax/f/33/t/288826
Looks like you are right. I have implemented this on a form that had this method therefore I was able to CoC it.
Stupid me...
Hi Evaldas Landauskas
You can override the method on custom form only. If you are working on standard form and method not already implemented so COC will not work for you.
Hi Sheikh,
If you read my reply carefully you would have noticed that I wrote about a form and not a table.:)
Hey Evaldas Landauskas
COC only work when method implementation already available on the table... But if the method is not implemented You can't implement the COC.
Hi,
There is a solution without overlaying.
You should create/CoC a canSubmitToWorkflow method on the form you are activating the workflow.
1 2 3 4 5 6 7 8 |
public boolean canSubmitToWorkflow(str _workflowType) { boolean ret; ret = next canSubmitToWorkflow(_workflowType); return ret; } |
Cheers :)
I am in agreement that In D365FO extension of canSubmitToWorkflow still not available if not override on actual table. But there is an alternate way on which I have recently worked and its working perfectly on client side.
Please have look this blog and mark this answer as suggested if this will work for you.
community.dynamics.com/.../avoid-over-layering-in-development-of-workflows-on-existing-form
d365technext.blogspot.com/.../avoid-over-layering-in-development-of.html
Hi Hafiz,
I have spent 3 days to solve that problem. I have setup worfklow on InventTransferORder form so I do every pre-requirements( Workflow category, approvalis, tasks, workflow types, menuITems ettc.)at backround without no problem.
However I could not override CansubmitToWorkflow method and so I could not activate my workflow.
What I have done to achieve that problem: (no way without overlayering)
[ExtensionOf(tableStr(InventTransfeTable))]
final class InventTransfeTable_Coc_Extension
{
public boolean canSubmitToWorkflow()
{
boolean ret;
ret = next canSubmitToWorkflow();
if(this.recID && this.WorkflowState == WorkflowState::notSubmitted && this.existLine())
{
ret = true;
}
return ret;
}
}
5. than it works fine and workflow button displayed on form.
Hi Krishna ,
I got the same error when I tried to create canSubmitToWorkflow method in class extension which is not good. I think you need to override method on Custtable and then create pre /Post eventhandler and do you customization. So for now you don't have option but override method on base table and then create event handler.
I tried for one of the existing table Purchtable and it works
/// <summary>
///
/// </summary>
/// <param name="args"></param>
[PreHandlerFor(tableStr(PurchTable), tableMethodStr(PurchTable, canSubmitToWorkflow))]
public static void PurchTable_Pre_canSubmitToWorkflow(XppPrePostArgs args)
{
}
Also you can submit this to Microsoft on following idea site so that they can consider it.
Giving error like below image
Error message is :-
"cannot define an extension method "canSubmitToWorkflow" in extension class "custTable_Extension" targeting type "custTable" because the type already defines a method with same name.
As per above error & my understanding, "canSubmitToWorkflow" method is an override/standard method,
by default every table consists some set of override methods and above method belongs to same.
If i gave different naming also then AX can't identify.
Even i have seen for events which are listed for table extensions as a separate node(Events) and i haven't find any event handler for "canSubmitToWorkflow" method as we have for others(onUpdated,onUpdating...etc)
So,how can i achieve this? as standard table doesn't have above method and now i want to write the cansubmitToWorkflow method to that table (Without overlaying) using extensions .
André Arnaud de Cal...
294,095
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator