web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Approvals sometimes in...
Power Automate
Unanswered

Approvals sometimes include an attachment

(0) ShareShare
ReportReport
Posted on by 3

I am creating a workflow that is generated from a form, saves all responses to a SharePoint list, initializes the first approval, initializes a 2nd approval, and ultimately emails the appropriate people.  The flow worked until it was determined we need to give the submitter the option of attaching a file to their request.  I've got the workflow working when an attachment is included, however, when the submitter does not include an attachment, I get " The request failed. Error code: 'InvalidAttachmentName'. Error Message: 'The attachment name '' is invalid.'."  

 

Do I have to create a condition where if hasAttachment variable = true run the approval with the attachments and if not, run the approval without the attachment?  Is there some function I'm not aware of that will help handle a null value in the JSON objects for approval attachments?

requestor variable = variables('Request_Data')['Submitter']['Email']

attachment name = variables('Request_Data')['Attachment']['Name']
attachment file = variables('Request_Data')['Attachment']['Full']

wilkiky_0-1674602954533.png

 

Categories:
  • CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @wilkiky 

     

    attachment name = variables('Request_Data')?['Attachment']?['Name']
    attachment file = variables('Request_Data')?['Attachment']?['Full']

     

  • wilkiky Profile Picture
    3 on at
    adding the question marks got me a new error:
    "InvalidTemplate. Unable to process template language expressions in action 'Approval' inputs at line '0' and column '0': 'The template language function 'base64' expects its parameter to be a string, an object or an array. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#base64 for usage details.'."
    So I looked at how to make it a non-null return where I came up with the following:

    coalesce(variables(
    'Request_Data')?['Attachment']?['Name'],'')
    coalesce(variables('Request_Data')?['Attachment']?['Full'],'')

    This get's me empty rather than null however I'm now getting this error:
    The current error I'm getting is "The request failed. Error code: 'InvalidAttachmentName'. Error Message: 'The attachment name '' is invalid.'."


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 321 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 271

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard