X++ Exception: Workitem could not be created.

2 05 2012

I have been doing some tests with a new custom workflow and came across the following scenario. (Note: this describes a solution to one of the many issues that may cause this error message)

I developed a custom workflow and its setup its corresponding configuration, I was able to submit and everything but ended up getting the following error in my workflow history when the workflow system tried to assign a workitem to me:

Stopped (error): X++ Exception: Work item could not be created. 
Insufficient rights for user Jonathan.
 at SysWorkflowWorkItem-create 
SysWorkflowWorkItem-createWorkItems 
SysWorkflow-save SysWorkflowQueue-resume 
SysWorkflowMessageQueueManager-executeTask 
SysWorkflowMessageQ

After exploring for a while I found an additional line on my batch server’s event log stating “X++ Exception: The workflow system could not access the business document data. Report this issue to your system administrator.” which once can trace back to line 68 of the SysWorkflowDocument.assertAsUser method.

I reviewed the query linked to my workflow document of my custom template and realized that one of the links or ranges caused no records to be returned, ever. Fixing the query and resuming my workflow caused the workitem to process correctly.

Unfortunately this error message was a bit cryptic for the actual issue at hand, but I hope this will help someone who runs into the same issue in the future.


Actions

Information

13 responses

18 12 2012
Gina Luciano

We are experiencing the exact same problem. what exactly did you need to fix with the query in order to fix the problem? we have found that if the person who is the approver has sys admin rights, they do not get this message. however, with any other security rights, we get this message.

18 12 2012
Gina Luciano

Stopped (error): X++ Exception: Work item could not be created. Insufficient rights for user GLuciano.
at SysWorkflowWorkItem-create
SysWorkflowWorkItem-createWorkItems
SysWorkflow-save
SysWorkflowQueue-resume

This is our error message. almost identical to yours

14 02 2013
Marijana Sneperger

Thank you for the post, it saved me a lot of effort. The error message is quite misleading.

1 05 2013
syedshabab

Hi,
I am getting same error with my Custom workflow, when i am giving sysadmin rights to user it is going through but when i am attaching user role to it i am getting the above error. can you let me know exactly how we can resolve it.

19 05 2013
Samer

any one have solution to above one ?

19 06 2013
Samer

what AX version u are using ? did u add the approval user to privilege workflow essentials ( this will work on line approval )

20 06 2013
Vimal

Hi,
I am getting same error with my Custom workflow, when i am giving sysadmin rights to user it is going through but when i am attaching user role to it i am getting the above error. can you let me know exactly how we can resolve it.

10 07 2013
DK

Thank it helped me. You are correct the error message is very misleading.

Vimal you need to modify your query used for custom workflow creation.

18 10 2013
info@briankinser.com

you can also change the error message to make it more usable…..go to SysWorkflowWorkItem class and find for the create method and there are 2 places where that error label is used, so its not that hard to find….hover over a couple of the labels that are next to a THROW ERROR and you will find it….I think it is around line 230 and line 140…..change these strfrmt and add say menuItem and webMenuItem and it will show you at least the menu items names that are trying to be accessed…..of course you can also try to debug here to see what else is going on…..usually it is a menu item or the workflow document itself….since really whats happening is a workflowdocument.assertpermissions……beware of just commenting this out as you are then allowing anyone to be assigned a task (is that bad?) the only issue I had then is that some of the data may not be visible to the user such as menu items, tables, forms, workflow documents, etc….which you should have been adding permissions to anyway right?? anyway this was my workaround

30 10 2013
Jyotirmay Acharjee

Go to sysworkflowDocument class and find assertAsUser method. This method check permissions for workflow action menu item, display menu item ,web menu item , webmenu url and document query.Provide proper permissions for menu items.

18 05 2017
25 02 2022
Husna Yusuf Nawawi

We are experiencing the exact same problem. what exactly did you need to fix with the query in order to fix the problem?

22 03 2022
Mohamed Mostafa

we solved it by creating a separate role and privilage then adding all action menu items of WF to it then assign the role to the user, it worked

Leave a comment