cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
wi11iamr
Level: Powered On

MS Planner Test App - Pls test in different environment

Hi there,

 

I have another message in this forum trying to resolve an error with ListBuckets method from Microsoft Planner.

In trying to isolate my problem, I have created a Test App that simply calls the ListBucket method from MS Planner connector, and I would appreciate if someone could run this app from within their own environments and tell me if they get the same issue, because as it currently stands, I'm of the opinion that the problem may be on the backend.

 

1 ACCEPTED SOLUTION

Accepted Solutions
wi11iamr
Level: Powered On

Re: MS Planner Test App - Pls test in different environment

Thanks @Pstork1 , I was eventually able to work around the error message.

 

Final solution as follows:

1. In App OnStart property, create 2 collections for Plans and Tasks

ClearCollect(
    myPlans,
    Planner.ListMyPlansV2().value
);
ClearCollect(
    myTasks,
    Planner.ListMyTasksV2().value
)

2. In the Screen's OnVisible property, create a Collection, using an ISEMPTY test 

If(
    IsEmpty(myPlans),
    ClearCollect(
        BrowseBucketDropdown,
        {
            id: "1",
            planid: "1",
            name: "Please select a Plan"
        }
    ),
    ClearCollect(
        BrowseBucketDropdown,
        Sort(
            (Planner.ListBucketsV2(Plan_Browse.SelectedText.id).value),
            name,
            Ascending
        )
    )
)

3. Set the Items property of the Plan_Browse dropdown to the myPlans collection

4. On the Plan_Browse dropdown's OnChange property, set it to the same code as per point 2 above.

5. Set the Items property of the Bucket_Browse dropdown to the BrosweBucketDropdown collection

 

And there we go - In short then it seems that the timing/sequencing of the app's logic when loading initial screens means that the ListBuckets method runs before, or simultaneously to the ListMyPlans method and as such the ListBuckets method does not receive a valid PlanID. If this is the case, then it is understandable that ListBuckets returns the error that it does.

 

That said, I've not been able to see a situation where the myPlans collection is in fact empty and doesn't have a PlanID to pass to the ListBuckets method, however I'm beyond trying to understand the inner mechanics of PowerApp's sequencing of function calls etc, and am happy it is now resolved!

 

Thanks again @Pstork1 for the effort and guidance you've provided!

9 REPLIES 9
Super User
Super User

Re: MS Planner Test App - Pls test in different environment

I was able to get your sample working.  Here's the issue. ListMyPlans and ListMyBuckets both return an array of objects. That makes it almost impossible to get Both the Title and the ID value bound to the Dropdowns.  So instead I created a Collection onStart of the app using the following.

ClearCollect(myPlans,ForAll(Planner.ListMyPlansV2().value,{ID:id,Title:title}))

That creates a collection of records that contain the ID and Title as fields.  Now I can bind the Plans dropdown to MyPlans.Title 

Then I set the Buckets Dropdown to 

Planner.ListBucketsV2(First(Filter( myPlans,Title = Plan.SelectedText.Title)).ID).value

This uses the myPlans Collection to retrieve the ID value that matches the selected text in the Plans dropdown.

 

If anyone has a better way to parse an array of objects to a dropdown, please add to the conversation.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Super User
Super User

Re: MS Planner Test App - Pls test in different environment

One Quick update.  I found an easier way to load the array of objects into the collection.  Use the following:

ClearCollect(myplans2,Planner.ListMyPlansV2().value)  

You don't need the ForAll or the implicit record declarations



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
wi11iamr
Level: Powered On

Re: MS Planner Test App - Pls test in different environment

Thanks @Pstork1  for the effort, and at first I was excited as it looked like it was going to work, however I neglected to elaborate in this request that the ListBuckets error message only appears when accessing the published app via a mobile device. I.e. when I test within the PowerApps IDE or web.powerapps.com, I don't seem to get any errors, however even after creating the Collection at the app's OnStart, I still get the error.
Are you able to test/confirm that you don't still get the error when accessing via a mobile device?

Super User
Super User

Re: MS Planner Test App - Pls test in different environment

I just tested on my Mobile app and my sample works fine. I've attached an export of my sample that you can import to look at all the specific code.

 



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
wi11iamr
Level: Powered On

Re: MS Planner Test App - Pls test in different environment

Thanks again @Pstork1 . I imported your app version and opened it on my phone, and received the same error message about the

Planner.ListBucketsV2 failed: The method 'ListBucketsV2' has an invalid value for parameter 'id'

 

Is there any sense in the thinking that perhaps there is something different/wrong within my Office365 environment? (I'm on the east coast of Australia).

 

Super User
Super User

Re: MS Planner Test App - Pls test in different environment

Sorry, I don't know what to tell you.  It works fine for me.  If you run it in the web can you see the id in the collection?  There might be something wrong with a specific Planner bucket or plan.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
wi11iamr
Level: Powered On

Re: MS Planner Test App - Pls test in different environment

Thanks @Pstork1
The funny thing is that even though I get the ListBuckets error, all the methods and dropdowns work just fine. I’ve never had a problem with the dropdowns not working - just the very irritating error message when the app opens.
I was thinking to try and test the value of the Plan Id being passed to the ListBuckets method, and if it is empty or something weird/incorrect, to pass a static value of some sorts so as to actually avoid whatever error condition is causing the alert to be displayed.

I haven’t yet managed to properly test the value if ID being passed - would you perhaps have any thoughts on such an approach?
Super User
Super User

Re: MS Planner Test App - Pls test in different environment

Usually for this I add an If statement to the Items declaration of the Gallery so when I first enter the app and the dropdowns are empty that it either loads the gallery with a blank table or with all the records before filtering. That may be where your error is coming from.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
wi11iamr
Level: Powered On

Re: MS Planner Test App - Pls test in different environment

Thanks @Pstork1 , I was eventually able to work around the error message.

 

Final solution as follows:

1. In App OnStart property, create 2 collections for Plans and Tasks

ClearCollect(
    myPlans,
    Planner.ListMyPlansV2().value
);
ClearCollect(
    myTasks,
    Planner.ListMyTasksV2().value
)

2. In the Screen's OnVisible property, create a Collection, using an ISEMPTY test 

If(
    IsEmpty(myPlans),
    ClearCollect(
        BrowseBucketDropdown,
        {
            id: "1",
            planid: "1",
            name: "Please select a Plan"
        }
    ),
    ClearCollect(
        BrowseBucketDropdown,
        Sort(
            (Planner.ListBucketsV2(Plan_Browse.SelectedText.id).value),
            name,
            Ascending
        )
    )
)

3. Set the Items property of the Plan_Browse dropdown to the myPlans collection

4. On the Plan_Browse dropdown's OnChange property, set it to the same code as per point 2 above.

5. Set the Items property of the Bucket_Browse dropdown to the BrosweBucketDropdown collection

 

And there we go - In short then it seems that the timing/sequencing of the app's logic when loading initial screens means that the ListBuckets method runs before, or simultaneously to the ListMyPlans method and as such the ListBuckets method does not receive a valid PlanID. If this is the case, then it is understandable that ListBuckets returns the error that it does.

 

That said, I've not been able to see a situation where the myPlans collection is in fact empty and doesn't have a PlanID to pass to the ListBuckets method, however I'm beyond trying to understand the inner mechanics of PowerApp's sequencing of function calls etc, and am happy it is now resolved!

 

Thanks again @Pstork1 for the effort and guidance you've provided!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 242 members 2,375 guests
Please welcome our newest community members: