Skip to main content

Notifications

Power Automate - General Discussion
Answered

Using compose to get attachment file extension from get attachments fails

Posted on by 70

In this 3-action flow: 

 

tpcolson_0-1713440954548.png

where the compose is

last(split((outputs('Get_attachments')?['body/DisplayName'], '.'))

 

I get 

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'split' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#split for usage details.'.

 

Yet very clearly the body of the output contains the string?!?!!?

 

tpcolson_1-1713441176720.png

 

  • Verified answer
    DJ_Jamba Profile Picture
    DJ_Jamba 2,336 on at
    Re: Using compose to get attachment file extension from get attachments fails

    Hi @tpcolson 

     

    That expression doesn't look quite right.
    First of all the Get attachments action produces an array of records even if there's only one attachment, so you have to select one record.
    Then you can perform the split on the DisplayName.
    So to get the file extension of the last attachment in the array, you can use:

     

    last(split(last(outputs('Get_attachments')?['body'])?['DisplayName'],'.'))

     

     

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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,651

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,727

Leaderboard

Featured topics