Search code examples
sqlsql-serversharepointpowerapps

personalize sharepoint forms with powerapps and SQL Server


I need to customize the forms of a Sharepoint list, using PowerApps. The form should show information from a SQL Server database, but it should only show the information of the user who is authenticated at that moment, which is done through email using the User ().email property. I haven't extracted the data yet, as I can't execute a normal SQL query. any suggestions?

For example, if I am logged into the Sharepoint site, and my email is jhernandez@mycompany.com, the form must extract the data from the SQL Server database, where the mail column is equal to the logged user mail (in this example, jhernandez@mycompany.com), and I It will show my name, surname, date of entry to the company and number of available for take vacations. the form should show only that information and save it directly in the Sharepoint list, and trigger an approval request.

How can I run this query in PowerApps, so that when I open the NewItem form, it only returns the resulting data from that query?

Thank you all


Solution

  • found the answer to my own question...you can personalize your form, and put in every textbox the following code in the datasource property, in order to extract the data from sql database

    LookUp(employees;email_x0020_Sharepoint=User().Email;'employee code')
    

    the lookup function is the same as SELECT function. receives the database, a condition to evaluate and returns a column value, normally one unique value

    if you need the text cannot be changed, you can disable the textbox modifying the displaymode property, setting in Parent.DisplayMode.Disabled or on the visible property, set in false

    IMPORTANT: you need the powerapps premiun plan, in order to use sql server connector