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

Using Errors() to get output of Patch on a list with Attachments enabled

Hi - I am trying to use see if there were any errors() thrown by Patch(), but it is giving me incompatible type error. The datasource on which this operation is happening is a SharePoint List with attachments enabled, after disabling the the attachments the compile time error goes away, not sure if this how it is meant to be or it is a bug. Here is the error and code that i am using. Any help would be much appreciated. Thanks - Deepa

dmoorjmalani_0-1608968609528.png

 

 

UpdateContext({ patchresultProject: LookUp( 'Project Reviews', ID=varRecord.ID)});
    Patch(
        'Project Reviews',
        patchresultProject,
        {
            'FieldA': dvFieldA.Text,
            'FieldB': dvFieldB.Text
        }
    );
    If(
        IsEmpty(
            Errors(
                'Project Reviews',
                patchresultProject
            )
        ),
        Navigate(
            ScrScopeQuality,
            ScreenTransition.None
        ),
        First(
            Errors(
                'Project Reviews',
                patchresultProject
            )
        ).Message
    );

 

 

 

 

3 REPLIES 3
Super User III
Super User III

Hi @dmoorjmalani ,

Try this

Patch(
   'Project Reviews',
   {ID:varRecord.ID},
   {
      'FieldA': dvFieldA.Text,
      'FieldB': dvFieldB.Text
   }
);
If(
    IsEmpty(Errors('Project Reviews')),
    Navigate(
       ScrScopeQuality,
       ScreenTransition.None
    ),
    Notify(
      First(
         Errors('Project Reviews')
      ).Message
   )
)

 

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.

Advocate III
Advocate III

Hi @WarrenBelz - Errors() without 2nd argument will return Errors in the entire data source and then i think i will have to use Lookup() to get Error related to the current record, correct? Also I am not sure about the repercussion of using Errors() without second argument on the Performance, specially when dealing with a large data source. Thank you!

@dmoorjmalani ,

That is possibly the case  - how likely is it you will get an error? I tend to "pre-qualify" input before submitting. You can also consider using SubmitForm() then the OnFailure property.

 

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.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (20,663)