cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
guyinazo
Advocate V
Advocate V

Adding a new SharePoint record on startup

I am tasked with putting together a simple and quick PowerApp for our organization that will be giving COVID vaccinations in a few weeks.  I want to log everything that is done including people that even start the application.  I have the following code that should be at least creating an entry in a SharePoint table, but it is not.  What might I be doing wrong? And this is in the main forms OnVisible event

 

Set(v, false ); //set the visible variable for the container
//Prepare the variables for the log
Set(thisEmployee, lblEmail.Text);
Set(n, Today());
Set(descrip, "Logged in");
//Save this to the log
IfError(Patch('COVID vaccines',Defaults('COVID vaccines'),
{Employee: thisEmployee},
{Logged: Today()},
{Notes: "Opened the application"}
),Notify(ErrorResult,NotificationType.Error),Notify("Saved",NotificationType.Success));

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @guyinazo ,

Although your code looks fine, try dissecting it - first does this work

Patch(
   'COVID vaccines',
   Defaults('COVID vaccines'),
   {
      Employee: "Test Employee",
      Logged: Today(),
      Notes: "Opened the application"
   }
)

If so, add the variables back in (thisemployee first) and then the error bits.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

2 REPLIES 2
WarrenBelz
Super User III
Super User III

Hi @guyinazo ,

Although your code looks fine, try dissecting it - first does this work

Patch(
   'COVID vaccines',
   Defaults('COVID vaccines'),
   {
      Employee: "Test Employee",
      Logged: Today(),
      Notes: "Opened the application"
   }
)

If so, add the variables back in (thisemployee first) and then the error bits.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

That does work.  I tied the code to a button and it works.  I tied the original code (changed Today() to Now() to capture the time also) and with the button it works.  It seems like it is not triggering when tied to the OnVisible event

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (42,973)