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

Disable the red error message

I have an app that grabs employee photos, and if the employee does not have a photo the app returns that red error message at the top, a 404 error has occured. Can i disable this error message? I can handle the error fine in the app with the IsBlank funtion, but the message still shows for my end users... How can i disable the message?!

18 REPLIES 18
Anonymous
Not applicable

Thank you so much ! If this helps anybody, this solved my problem on a different issue with 502 error message : "the server did not receive a response from an upstream server powerapps"

 

 

Javier1982
Frequent Visitor

I use this, an it work fine, in a gallery

 

If(!IsBlank(ThisItem.Id),IfError(Office365Users.UserPhoto(ThisItem.Id),""),SampleImage)

Javier1982
Frequent Visitor

I use this code inside the gallery an it works, 

 

If(!IsBlank(ThisItem.Id),Office365Users.UserPhotoV2(ThisItem.Id),SampleImage)

When I try this solution, the image does now show up. 

ProgrammerJaDe
Helper I
Helper I

New, more simple solution.

 

This red error message just started showing up for me after working fine for a few months. The fastest solution I came up with was to replace the ThisItem reference with a global variable instead.

 

When a user clicks on the record in my gallery, I added Set(var_UserImage,ThisItem.'Created By'.Email).  

When you use Office365Users.UserPhoto with a global variable instead of a record lookup it works just fine. I was able to remove the IsBlank check as well. It just works now.

 

Office365Users.UserPhoto(var_UserImage)

That's interesting.  Struggling to suppress this error I had the exact same idea to replace that parameter with a global variable (initialized with a valid ID).  I can say for certain that the global variable idea does not work within the context of the OnChange action of a combobox.  I have even gone as far as doing both: attempting to trap the error with IfError and using a global variable:

 

ComboBox OnChange property

 

If(
    IsEmpty(comboCEOselection),
    false,
    Set(
        varIDTemp,
        comboCEOselection.Selected.Id
    );
    IfError(
        UpdateContext({conSelectedCEO: Office365Users.UserProfileV2(varIDTemp)}),
        ""
    )
)

 

 

 Still, every time this app is run the error is seen.  It is so frustrating.

 

JeffTex_0-1654788786063.png

 

The detail of the error in Monitor show:

 

Office365Users.UserProfileV2 failed: The method 'UserProfileV2' has an invalid value for parameter 'id'

 

{
  "status": null,
  "duration": null,
  "dataSource": null,
  "responseSize": null,
  "controlName": null,
  "propertyName": null,
  "nodeId": null,
  "formulaData": {
    "script": "",
    "spanStart": null,
    "spanEnd": null
  },
  "data": {
    "errorContext": {
      "entityName": "comboCEOselection",
      "propertyName": "OnChange",
      "nodeId": 14,
      "id": 3441,
      "diagnosticContext": {
        "formula": "If(\n    IsEmpty(comboCEOselection),\n    false,\n    Set(\n        varIDTemp,\n        comboCEOselection.Selected.Id\n    );\n    IfError(\n        UpdateContext({conSelectedCEO: Office365Users.UserProfileV2(varIDTemp)}),\n        \"\"\n    )\n)",
        "span": {
          "start": 172,
          "end": 211
        }
      }
    },
    "errorMessage": "Office365Users.UserProfileV2 failed: The method 'UserProfileV2' has an invalid value for parameter 'id'",
    "raiseToastNotification": false,
    "wasReported": false,
    "error": {}
  }
}

 

 

And:

 

Unhandled error

 

{
  "status": null,
  "duration": null,
  "dataSource": null,
  "responseSize": null,
  "controlName": null,
  "propertyName": null,
  "nodeId": null,
  "formulaData": {
    "script": "",
    "spanStart": null,
    "spanEnd": null
  },
  "data": {
    "errors": [
      {
        "Kind": 23,
        "Message": "Office365Users.UserProfileV2 failed: The method 'UserProfileV2' has an invalid value for parameter 'id'",
        "Source": "comboCEOselection.OnChange",
        "Observed": "lblCEOselectionInfo.Text",
        "Details": null
      },
      {
        "Kind": 23,
        "Message": "Office365Users.UserProfileV2 failed: The method 'UserProfileV2' has an invalid value for parameter 'id'",
        "Source": "comboCEOselection.OnChange",
        "Observed": "lblCEOselectionInfo.Text",
        "Details": null
      },
      {
        "Kind": 23,
        "Message": "Office365Users.UserProfileV2 failed: The method 'UserProfileV2' has an invalid value for parameter 'id'",
        "Source": "comboCEOselection.OnChange",
        "Observed": "lblCEOselectionInfo.Text",
        "Details": null
      }
    ]
  }
}

 

 

 

 

ProgrammerJaDe
Helper I
Helper I

And to my disappointment it worked fine the day I tested and published the app, now a week later the error message is back. I opted to remove the user photo from this app for the time being. I would rather improve their user experience than to troubleshoot this nonstop.

 

I have a few ideas on more things to test. If I get a solution I'll reply here. 

Exactly the path I am finding myself having to take: reduce the functionality and use of the Office365 connector to preserve the User Experience.  It is a shame.   I would rather a global setting that would allow the suppression of ALL Office365 connector error messages.

JeffTex
Helper I
Helper I

After posting my previous reply with the Monitor info, it came to my attention that the unhandled error was an additional control dependent on the values that would have been captured in the OnChange action of the ComboBox.

 

Encapsulating the Text property of that label shown in Monitor as:

"Observed": "lblCEOselectionInfo.Text",

resolved the error.  I needed the IfError added to both the ComboBox action as well as the downstream controls dependent on the value.  The label's Text Property is now set as:

IfError(
    conSelectedCEO.jobTitle & Char(13)&
    conSelectedCEO.department & Char(13) &
    conSelectedCEO.companyName,
    ""
)

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (6,312)