BPM process Error while creating a new ToDo Task

This is the error we have in the WF is [User must be logged in] So the process fails when the Automated Activity is trying to execute the 'CreateToDo' action.

Here is the Activity setup

Hi John,


The reason this happens is your own logic at the beginning of the CreateToDoWrapper.  If you followed the tutorial, you will have something like this in there :


This is a security check to see if this action is executed by a user who is at least registered in the system.


You have some options, here's one option :


  • create a dedicated user in your system for this particular process, and only give it the roles it really needs
  • in your process flow, add a login step, where you log this user in
  • if you give each process it's own user, you have good control and traceability


So I'm not sure why you are letting a BPM create todo tasks, but if this would be on behalf of a human user, you would also have to amend the logic of the CreateToDoWrapper, taking in the user who the task is for as in input instead of just assuming that the logged on user is the user the task is for.

  • add an OnBehalfOf input, type is User Identifier
  • change the way UserId is mapped in the CreateToDo step 
    • If(OnBehalfOf.Id <> NullIdentifier(),  OnBehalfOf.Id,   GetUserId())


This is just a suggestion, there are other ways, 

have fun,

Dorine


Oh, by the way, the reason that this creates an error, is that in your process, you don't have any exception handling yet.  Whatever you want to happen in your process instead of an error, after a called action raises an exception for some reason, you will have to add exception flows for that.

Hi Dorine,


Thank you for the feedback. As an FYI we tried running the BPM process with the dedicated 'ToDo_user' but this also failed. I see now we need to review the logic in the Wrapper. 

Why are we creating ToDo Tasks from a process? This is a pattern common in the SharePoint workflows …. 'Workflow Tasks' …. just trying to replicate the pattern in OS and to see if it can support 'mobile device' approval tasks etc that are bound to the parent record.