Creating a new ToDo task via the 'CreateToDoWrapper' API - I can't set the CategorId

We want to use the Workflow to automatically create a new 'ToDo' task but we can't properly set the 'CategoryId' in the API. See attached screen shots.

Here is a 2nd screen shot

Hi John,

as the error message says at the bottom of your expression editor, the GetCategory function that you are using needs to get as parameter the id of the category you are interested in. 

So if you would have some variable called VarCategoryId that holds a category id, you could use GetCategory(VarCategoryId) to retrieve that category, for example you could use GetCategory(VarCategoryId).Category.Name to retrieve the name of that category.

The action CreateToDoWrapper, also takes in the category id as one of the parameters, so really, if you already have the id, just pass it in.

If you don't have the id yet, then you can't use GetCategory().  Can you show some of the context where you want to use this AutomaticActivity ?  How you determine the category you want to give the todo item that you are about to create. (maybe some default ?)  

Dorine


PS.  anyway, the expression you entered now, even if you would have supplied an id as parameter to GetCategory() isn't going to work, the = sign makes it a boolean, but you need an identifier.

Hello John,

You can do it in 2 steps 

1) Fetch the Category you want to set for the Todo. You can use an aggregate and filter it. 

2) Use the CreateToDo action where you set the CategoryId fetched in Step 1. 

Can you elaborate on the workflow part. 

Regards

Solution

Thanks Amol, that sorted the Category Identifier.

Solution

So the issue we have now is WF error [User must be logged in] when using an Activity and the CreateToDo action. The WF Process runs but fails to create the ToDo. 

Here is the Activity 

John Ackery wrote:

Thanks Amol, that sorted the Category Identifier.

Happy to help !!!