cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shebeerahmmed
Helper I
Helper I

Sorting the ticket in HELPDESK on task status available

Hi,

 

Please help me to sort the ticket according to the taskstatus available in the sharepoint list 
      TaskStatus is Collect(TaskStatus,"NOT STARTED","IN PROGRESS","COMPLETED","PENDING",)

       SPList is Collect(AllTickets,HelpDesk);

I just want to edit this code according to the selection 

 

MyTicketViewGallery: If(isAdmin,Sort(AllTickets,Created,Descending),Sort(Filter(AllTickets,Author.Email = MyProfile.Mail || Author.Claims = MyProfile.UserPrincipalName ),Created,Descending))

 

MyTicketView : 

Refresh(HelpDesk);
ClearCollect(AllTickets,HelpDesk);
If(isAdmin ,
Set(TicketToRunFlow,First(Sort(AllTickets,Created,Descending))),
Set(TicketToRunFlow,First(Sort(Filter(AllTickets,Author.Email = MyProfile.Mail || Author.Claims = MyProfile.UserPrincipalName ),Created,Descending)))
);
If(RunFlow, HelpDeskFlow.Run("'" & TicketToRunFlow.ID & "'"));
If(RunFlow, Set(RunFlow,false))

 

Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

The answer is , change the code in TicketScreenGallery
Use  a combobox, replace the name of combobox
If
(isAdmin,
Sort
(AllTickets,Created,Descending),
Sort
(Filter(AllTickets,Author.Email = MyProfile.Mail And TaskStatus.Value = ComboBox_NAME.Selected.Value || Author.Claims = MyProfile.UserPrincipalName ),
Created,Descending )
)

View solution in original post

6 REPLIES 6
v-yutliu-msft
Community Support
Community Support

Hi @shebeerahmmed ,

Do you want to sort the ticket based on task status?

Could you tell me the sort order that you want?

Whether do you want this order:"COMPLETED","IN PROGRESS","NOT STARTED","PENDING"

                                                or: "NOT STARTED","IN PROGRESS","COMPLETED","PENDING"?

Could you tell me the data type of task status field?

I assume that taskstatus is text type.

1)

order:"COMPLETED","IN PROGRESS","NOT STARTED","PENDING"

Try this formula:

If(isAdmin,Sort(AllTickets,taskstatus,Ascending),Sort(Filter(AllTickets,Author.Email = MyProfile.Mail || Author.Claims = MyProfile.UserPrincipalName ),taskstatus,Ascending))

2)

order: "NOT STARTED","IN PROGRESS","COMPLETED","PENDING"

Try this formula:

If(isAdmin,
Sort(AddColumns(AllTickets,"order",If(taskstatus="NOT STARTED",1,taskstatus="IN PROGRESS",2,taskstatus="COMPLETED",3,taskstatus="PENDING",4)),order),
Sort(AddColumns(
                Filter(AllTickets,Author.Email = MyProfile.Mail || Author.Claims = MyProfile.UserPrincipalName ),
     "order",
     If(taskstatus="NOT STARTED",1,taskstatus="IN
PROGRESS",2,taskstatus="COMPLETED",3,taskstatus="PENDING",4)),order
      )
)

 

 

Best regards,

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

Thanks for the reply, what i am trying to achieve is to get the tickets by choosing the drop-down box. (Sort the ticket according with the choosen taskstatus)

The tickets TaskStatus.value are :"COMPLETED","IN PROGRESS","NOT STARTED","PENDING" and when the admin choose the task status from the drop down it shows the tickets. 

The answer is , change the code in TicketScreenGallery
Use  a combobox, replace the name of combobox
If
(isAdmin,
Sort
(AllTickets,Created,Descending),
Sort
(Filter(AllTickets,Author.Email = MyProfile.Mail And TaskStatus.Value = ComboBox_NAME.Selected.Value || Author.Claims = MyProfile.UserPrincipalName ),
Created,Descending )
)

View solution in original post

I found the answer but it's only showing the user's ticket, I want to show all the ticket when choosing the drop-down box
If
(isAdmin,
Sort
(AllTickets,Created,Descending),
Sort
(Filter(AllTickets,Author.Email = MyProfile.Mail And TaskStatus.Value = ComboBox_NAME.Selected.Value || Author.Claims = MyProfile.UserPrincipalName ),
Created,Descending )
)

I second this request! I've been working on a filter for this app for days with nothing to show for it. Someone else posted a solution to filter the MyTicketScreen and hide the tickets that are marked as "Completed". If that works for you, put this code in Items of the MyTicketsScreenGallery.

 

If(isAdmin,Filter(Sort(AllTickets,DateCreated,Descending),TaskStatus.Value="NOT STARTED"||TaskStatus.Value="IN PROGRESS"||TaskStatus.Value="DEFERRED"||TaskStatus.Value="WAITING ON CSR"),Sort(Filter(Filter(AllTickets,Author.Email = MyProfile.Mail || Author.Claims = MyProfile.UserPrincipalName ),TaskStatus.Value<>"COMPLETED"),DateCreated,Descending))

 

However, the option to use the combo box as shebeerahmmed mentioned (with the added Admin piece referenced above) would be ideal. 

 

Thanks, everyone.

Did anyone get this working? I am struggling to get the combobox to work. its like my TaskStatus collection is not working.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (929)