Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Need to return file from a custom action

Posted on by Microsoft Employee

Hi,

I currently face a weird request. I want to add a button to download files from an external REST API. For some specific reasons I must not calls the service from client side. So I'm trying to use an Plugin registered on a custom action and then call the custom action in JavaScript web resource. My question is how to return a binary from custom action? Did any one face the same need and can help me?

May be my approach isn't the best. Any proposal will be welcome.

*This post is locked for comments

  • RE: Need to return file from a custom action

    Hello Kfranck

    Could you please share your solution,

    I face this issue.

    Thank you in advance.

  • Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: Need to return file from a custom action

    Hi,

    I'm happy to hear that.

    If it's not private can you share your code for future questions? maybe someone will have same question like you.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to return file from a custom action

    Emre,

    Your solution fits well what I need. I try it with FileSaver.js, and I can download my files.

    Thank you for your help.

  • Verified answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: Need to return file from a custom action

    Hi,

    I think you should convert your file to Base64 and return as "string" output parameter from custom action.

    At clientside, you can use FileSaver.js (github.com/.../FileSaver.js)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans