cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brian-C
Frequent Visitor

Leave Request - Changing Data Source

Hello,

 

After coming across the Leave Request template app, I'd like to adapt this to our organization's environment. First off, I'd like to change the data source from the default Excel file that is provided and use a SharePoint list instead. As I understand it, I would just have to use the same columns and data types and then adjust logic accordingly to read from the list. Just wanted to confirm in case there were any specifics that I'm missing. Anyone have experience doing so?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @Brian-C :

Do you want to replace a SharePoint List with the original data source in the Leave Request template (a collection named LeaveCollection)?

If so,I suggest you follow these three steps:

Step1:Create a New SP List(All settings including listname must be exactly the same)

ListName:LeaveCollection

Column (click to edit) Type

TitleSingle line of text
DetailSingle line of text
StartDateDate and Time
EndDateDate and Time
LeaveTypeSingle line of text
RequesterSingle line of text
ApproverSingle line of text
StatusSingle line of text
LeaveIDAll settings including listname must be exactly the sameSingle line of text

Step2:Delete this code from the OnStart property of the app

 

ClearCollect(LeaveCollection, 
     {Title: "Vacation", Detail: "Example vacation request", StartDate: Today(), EndDate: DateAdd(Today(), 6, Days), LeaveType: "Vacation", Requester: _myProfile.UserPrincipalName, Approver: _myProfile.UserPrincipalName, 
     Status: "Pending", LeaveID: _myProfile.UserPrincipalName&Text(Now(), "[$-en-US]mm-dd-yyyy-hh-mm-ss-fff")});

 

Step3:Add the SP list just created as a data source

1.JPG1.JPG

I think this link will help you a lot:

https://www.youtube.com/watch?v=_ECN8QWiNrQ

Best Regards,

Bof

 

View solution in original post

6 REPLIES 6
Pstork1
Dual Super User III
Dual Super User III

Yes, you can switch it to use SharePoint instead of Excel, but it will take a good bit of work to switch everything over.  Pay special attention to the spots where collections are created and where data is saved to the Excel file.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
v-bofeng-msft
Community Support
Community Support

Hi @Brian-C :

Do you want to replace a SharePoint List with the original data source in the Leave Request template (a collection named LeaveCollection)?

If so,I suggest you follow these three steps:

Step1:Create a New SP List(All settings including listname must be exactly the same)

ListName:LeaveCollection

Column (click to edit) Type

TitleSingle line of text
DetailSingle line of text
StartDateDate and Time
EndDateDate and Time
LeaveTypeSingle line of text
RequesterSingle line of text
ApproverSingle line of text
StatusSingle line of text
LeaveIDAll settings including listname must be exactly the sameSingle line of text

Step2:Delete this code from the OnStart property of the app

 

ClearCollect(LeaveCollection, 
     {Title: "Vacation", Detail: "Example vacation request", StartDate: Today(), EndDate: DateAdd(Today(), 6, Days), LeaveType: "Vacation", Requester: _myProfile.UserPrincipalName, Approver: _myProfile.UserPrincipalName, 
     Status: "Pending", LeaveID: _myProfile.UserPrincipalName&Text(Now(), "[$-en-US]mm-dd-yyyy-hh-mm-ss-fff")});

 

Step3:Add the SP list just created as a data source

1.JPG1.JPG

I think this link will help you a lot:

https://www.youtube.com/watch?v=_ECN8QWiNrQ

Best Regards,

Bof

 

View solution in original post

Hi @v-bofeng-msft 

 

When I was going through the OnStart code, I noticed this code was not present

 

ClearCollect(LeaveCollection, 
     {Title: "Vacation", Detail: "Example vacation request", StartDate: Today(), EndDate: DateAdd(Today(), 6, Days), LeaveType: "Vacation", Requester: _myProfile.UserPrincipalName, Approver: _myProfile.UserPrincipalName, 
     Status: "Pending", LeaveID: _myProfile.UserPrincipalName&Text(Now(), "[$-en-US]mm-dd-yyyy-hh-mm-ss-fff")});

 When I check the Leave Balance Screen, I notice the gallery has the source of RequesterBalanceCollection, and I'm not sure where the app is initializing that. I did create a SP List with the columns specified. Do I have to add the SP List to a new collection then?

 

rc2.png

 

Hi @Brian-C :

Q1:About this code

 

ClearCollect(LeaveCollection, 
     {Title: "Vacation", Detail: "Example vacation request", StartDate: Today(), EndDate: DateAdd(Today(), 6, Days), LeaveType: "Vacation", Requester: _myProfile.UserPrincipalName, Approver: _myProfile.UserPrincipalName, 
     Status: "Pending", LeaveID: _myProfile.UserPrincipalName&Text(Now(), "[$-en-US]mm-dd-yyyy-hh-mm-ss-fff")});

 

It is indeed in the OnStart property

1.JPG

Q2:About RequesterBalanceCollection

You can find the relevant code in the "Keep balance visible on screen" property

2.JPG

Best Regards,

Bof

Hi @v-bofeng-msft ,

 

I was able to find and modify the variables and collections accordingly. Thanks for the guidance here!

 

 

zmm14
Helper III
Helper III

Hi @v-bofeng-msft ,

I have an issue as long as I don't "make it my app", I can see and delete this

ClearCollect(LeaveCollection, 
     {Title: "Vacation", Detail: "Example vacation request", StartDate: Today(), EndDate: DateAdd(Today(), 6, Days), LeaveType: "Vacation", Requester: _myProfile.UserPrincipalName, Approver: _myProfile.UserPrincipalName, 
     Status: "Pending", LeaveID: _myProfile.UserPrincipalName&Text(Now(), "[$-en-US]mm-dd-yyyy-hh-mm-ss-fff")});

and the half day option seems to work. Once I try the formula from the template I lost everything.

But the everything disappears as I try to test it

I get this error ... Don't know how to link my manager for approval.

zmm14_0-1625391194242.png

 

zmm14_1-1625391252887.png

 

zmm14_2-1625391393270.png

zmm14_3-1625391448419.png

What am I doing wrong.

Any help is appreciated.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,862)