cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thiemen
Frequent Visitor

Planner Checklist items

Hi,

 

I'm currently building a automated projectplan creation flow. I have a template plan, look up all buckets and tasks and loop through them to copy them to a new create plan through a custom connector. When I try to copy all the checklist items from a task to the new plan's task I encounter a problem. First I get all the template's plan checklist per task, which goes fine, I recieve a JSON representation of objects of the checklist. But I can't loop through these objects to patch the new task checklist items because the the checklists are objects and not stored in an array, can anyone help my with this. I want to be able to loop through the template checklist and the patch them into the new plan's task. Pictures below are the JSON body of the template checklist and the error message I recieve. Thanks in advance.Checklist items json.pngError message.png

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @Thiemen,

 

Is the template checklist is fixed?

If it is, you could restructure the JSON, convert it into an array, for example:

Annotation 2020-05-27 133934.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Hi, 

 

Thanks for your reaction, but the template is not fixed, however I managed to get the titles out of it by converting it to text and splitting/collecting first/last etc. from that text, this way I ended up with an array of titles which I could use when creating the new checklist items.

View solution in original post

9 REPLIES 9
v-litu-msft
Community Support
Community Support

Hi @Thiemen,

 

Is the template checklist is fixed?

If it is, you could restructure the JSON, convert it into an array, for example:

Annotation 2020-05-27 133934.jpg

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Hi, 

 

Thanks for your reaction, but the template is not fixed, however I managed to get the titles out of it by converting it to text and splitting/collecting first/last etc. from that text, this way I ended up with an array of titles which I could use when creating the new checklist items.

View solution in original post

lnoman
Frequent Visitor

Hi Thiemen,

 

I'm receiving the same error you've issued. Can you explain more detailed how have you overcame? Thank you.

Thiemen
Frequent Visitor

Hi @lnoman ,

 

I've done it the following way, I GET the old details (template), and GET the new details from the created new task. Then I PATCH the new task with the old details. 

From the output of the template task GET function I parse JSON the checklist item, using the following JSON Scheme.

###################

{
    "type""object",
    "properties": {
        "@@odata.type": {
            "type""string"
        },
        "isChecked": {
            "type""boolean"
        },
        "title": {
            "type""string"
        },
        "orderHint": {
            "type""string"
        },
        "lastModifiedDateTime": {
            "type""string"
        },
        "lastModifiedBy": {
            "type""object",
            "properties": {
                "user": {
                    "type""object",
                    "properties": {
                        "displayName": {},
                        "id": {
                            "type""string"
                        }
                    }
                }
            }
        }
    }
}
##########################
After this I split this output using the following ->
skip(split(string(body('Parse_JSON_2')), 'title'),1)
This output can be used to itterate on in the next for each, to PATCH all the task details in the specific bucket.
See screen below for details on the flow structure
 
Thiemen_0-1618424569121.png

 

Hope this help, otherwise, let me know.

 

Greetings, 

 

Thiemen

lnoman
Frequent Visitor

Hi @Thiemen, thank you for your response.

 

I followed your instructions, and I'm seeing that the Parse JSON method worked fine, as the raw outcome is a string from the last compose action.

 

However, inputting this string as a 'Dynamic Content' on Checklist.Title in my flow below is returning an error: 

Property checklist in payload has a value that does not match schema.

 

Looking the code below, is an example of what would work:

 

        "body": {
            "description": "@items('Apply_to_each')?['WBS']",
            "checklist": [
                {
                    "title": "@items('exemple')?['exemple']"
                }
            ]
        },

 

But, this is what I have. I guess the property "title" has something to do with the '@output' instead of '@items above'.

 

"body": {
            "description": "@items('Apply_to_each')?['WBS']",
            "checklist": [
                {
                    "title": "@{outputs('Compose_3')}"
                }
            ]
        },

 

 

Could you please help me in this last issue? Thank you.

 

Updated: will this method get the collection of items on checklist? Can it have more than one item on the checklist?

 

lnoman_0-1618494521464.pnglnoman_1-1618494650494.png

 

Thiemen
Frequent Visitor

Hi @lnoman 

 

I see now that there is a new predefined flow connector to update task details, as seen from your screenshot. I did not know this as when I created the flow, there wasn't one, so I used a custom connector by Graph API (Google it if you are unfamiliar to it). The error is probably due to the fact that it expects a string or something and you give an array.

 

From your screenshot I assume you want to update the task details to add the checklist items, just like I did, with this new Flow connector you do NOT need all the parse json nonsense anymore, and you can directly put the output of the GET Template Task details into the Update New Task details. I have created a small test on my side, see screenshot below, it works just fine and copies all checklist items from one task to another task (in another bucket or plan). This by creating a loop on the checklist items.

Let me know if this works for you, and sorry for the confusion.

 

Thiemen_0-1618512422967.png

 

Kind regards,

 

Thiemen

 

lnoman
Frequent Visitor

Hi @Thiemen ,

 

No need to apologize. Actually, I thank you a lot as you gave me a north for this problem.

 

I'm afraid that it didn't work for me. The first time I tried to copy 'Task Details', I used this new connector. It seems real easy and straight forward to the matter. But instead I'm recieving the following error for the screenshot (1st) below:

 

The execution of template action 'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@body('Get_task_details_from_Template_Task')?['checklist']' is of type 'Object'. The result must be a valid array.

 

I also tried to use the checklist Dynamic Content as a collection (2nd screenshot) but it states the following:

 

An unexpected 'StartObject' node was found for property named 'lastModifiedBy' when reading from the JSON reader. A 'PrimitiveValue' node was expected.

 

Raw Inputs from 'Update Task Details':

 

    "body": {
        "description": "2.12.1.3.2",
        "checklist": {
            "28451": {
                "@odata.type": "#microsoft.graph.plannerChecklistItem",
                "isChecked": false,
                "title": "Docnix: Aprovação",
                "orderHint": "8585863207722652781PM",
                "lastModifiedDateTime": "2021-03-09T10:36:13.2279249Z",
                "lastModifiedBy": {
                    "user": {
                        "displayName": null,
                        "id": "3d8364eb-8e45-474a-8758-2c6d2bb0033f"
                    }
                }
            }
        }
    }

 

For those reasons, I searched and found your solution, even though it goes for a alternative route. I'm not sure if I'm not matching the requirements because of the Excel thing I need. I'll launch more tests.

 

Sorry for long using your collaboration, any ideas?

 

lnoman_0-1618571293454.pnglnoman_1-1618571660681.png

 

Best regards,

Lucas.

Thiemen
Frequent Visitor

@lnoman 

I have tried to reconstruct your error, but I do not receive  it and it works fine. So I do not have any clue what the cause might be. My advise, start easy be just copying from one task to another, and later implement the Excel part, that way you might find out more about where the error is coming from, if you take it step by step.

 

Kind regard, and good luck

 

Thiemen

lnoman
Frequent Visitor

Hi @Thiemen ,

 

That's what I'll do. Thank you for your time and collaboration.

 

Best regards,

Lucas.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,674)