Hi Guys,
Having trouble figuring how to retrieve a SharePoint ID back to my App, I've read a few threads but none seem to hold the answers for my particular query.
I have built an Audit app which patches the scores to a Sharepoint List. The columns in my SP list are
Name, Site, Question, ID, Scores, Comments.
The ID is the auto sharepoint generated one - The Name, Site, Question & Scores are mandatory fields in my app which will produce an answer every time the app is submitted. The 'Comments' field will only be populated if a question receives a 'Fail' mark.
This is because if a questions is a 'fail', the app sends out a generic email to a colleague to make this failed question into a 'Pass'. In the email notification, it has a link to a page in the app where the colleague will enter the comments needed to make it up to a 'Pass'. When they press submit, I need the comments entered to update the 'Comments' field in my SP list for that record.
So I need to get the ID of the failed question(s) back into PowerApps so I can have it displayed in the email notification which goes out.
Any help would be appreciated.
Thanks.
JD.
Solved! Go to Solution.
Unfortunately with a DataTable there is no way to format the columns as you wish. It will only display data as it is defined in the underlying datasource connected to it.
Not sure exactly what type of field your date is (is it a true date field or a string?) - I am assuming it to be a real date field for the following:
What you would need to do in this case is to utilize the AddColumns function.
Change your Items for the DataTable as such:
AddColumns(youSharePointDataSourceAndFilter, "VisitDate", Text(DateOfVisitColumnName, "dd/mm/yyyy"))
Then, go back to your DataTable and view the fields- you will now see the new one in there. Uncheck the old one, and check the "VisitDate" field.
You can go to that column and give it the same DisplayName of "Date of Visit" to be consistent in your table if you want.
That will give you a formatted column.
Keep in mind...if you want to tie any Item in a From somewhere to the Selected item while using the underlying data source...you will need to Drop that column in the Item formula of the EditForm.
Hope this help.
You can capture the ID from two ways (actually three, but third not worth mentioning).
One, If you are dealing with an Edit Form, just look at the Form.LastSubmit property. It will be the record last submitted successfully and will have the SharePoint ID.
Two, if you are dealing with a Patch formula, you can set a variable to the Patch results:
Set(latestRecord, Patch(datasource, Defaults(datasource), {...your values here... })
In this case, latestRecord will have the SharePoint ID if the Patch was successful.
Hope this helps some.
Hi @RandyHayes ,
Thanks for your reply, I will use this solution in my other form.
For this one, I figured out a different way to do it just after I posted on here..
I inserted a data table which recalls the scores from Sharepoint and produces the SP ID which I need - this works fine for me.
However I just have one slight issue I cant work out - The 'Date of Visit' column in my data table is showing as mm/dd/yyyy, I need it to be dd/mm/yyyy.
In my sharepoint list it is in the correct format so I'm unsure how to change it in my data table, as below.
I have also changed my date picker to show as dd/mm/yyyy so it is just in my data table where I need it to change.
Do you know how to do this ?
Thanks for your help.
Unfortunately with a DataTable there is no way to format the columns as you wish. It will only display data as it is defined in the underlying datasource connected to it.
Not sure exactly what type of field your date is (is it a true date field or a string?) - I am assuming it to be a real date field for the following:
What you would need to do in this case is to utilize the AddColumns function.
Change your Items for the DataTable as such:
AddColumns(youSharePointDataSourceAndFilter, "VisitDate", Text(DateOfVisitColumnName, "dd/mm/yyyy"))
Then, go back to your DataTable and view the fields- you will now see the new one in there. Uncheck the old one, and check the "VisitDate" field.
You can go to that column and give it the same DisplayName of "Date of Visit" to be consistent in your table if you want.
That will give you a formatted column.
Keep in mind...if you want to tie any Item in a From somewhere to the Selected item while using the underlying data source...you will need to Drop that column in the Item formula of the EditForm.
Hope this help.