Flow Exchange

Please login or click SIGN UP FOR FREE to create your FlowUG account to join this user group.
Expand all | Collapse all

Prevent file names from being created with quotes?

  • 1.  Prevent file names from being created with quotes?

    Bronze Contributor
    Posted Apr 19, 2019 05:06 PM
    I debated which community to post this in, but ultimately I decided that Flow is probably where I need to fix my issue. I have a PowerApps App with a D365 datasource. I am using the Add Picture functionality and then using Flow to attach that file as a note to a D365 record. The Flow runs without issue (I am attempting to add the image with base64(), not sure if that is working yet...), but I cannot see if it is rendering the attachment as an image because it is saving the file with single quotes on either side. In D365 it looks OK, and based on the icon, it reads it as an image, but when I click on it and download, it reads the file as 'Test.jpg' not Test.jpg meaning that it thinks the file extension is .jpg' and the file name is 'Test.
    I originally was embedding the extension in the file name on the Powerapps side, but then tried to tag it on on the Flow side, like so:

    Is there some sort of string conversion I can do in Flow to prevent the single quotes from being passed through?

    ------------------------------
    Audrey Forrest
    Senior Accountant and Business Analyst
    CRMUG Co-Chapter Leader Seattle/PacNW
    Seattle WA
    ------------------------------


  • 2.  RE: Prevent file names from being created with quotes?

    Bronze Contributor
    Posted Apr 22, 2019 10:25 AM
    Oooh, this is a good one!  Following this!

    ------------------------------
    Ed Gonzales
    E-Commerce Manager
    Hampton Products International
    Foothill Ranch CA
    ------------------------------



  • 3.  RE: Prevent file names from being created with quotes?

    Bronze Contributor
    Posted Apr 22, 2019 12:00 PM
    Update - I was able to remove the string quotes by passing through the variable with the filename with .jpg directly in powerapps. In this case, I did not care if there were duplicate filenames, so I set a toggle on the form and if it is true, then it passes the string test1.jpg and if it is false, then it passes the string test2.jpg. Because there is no concatenation of strings by tacking on a file extension later, it is not adding the quotes. However, now I know that Base64() did not encode the image and I am not getting the image to appear in D365. On download I get an error that say "It looks like we don't support this file format".

    ------------------------------
    Audrey Forrest
    Senior Accountant and Business Analyst
    CRMUG Co-Chapter Leader Seattle/PacNW
    Seattle WA
    ------------------------------



  • 4.  RE: Prevent file names from being created with quotes?

    Bronze Contributor
    Posted Apr 22, 2019 05:16 PM
    If anyone else is trying to add images as attachments to notes in D365, I finally achieved this, although not with my ideal scenario. I noticed that with the "Add Image" control, the result is a blob url and not base64.

    If you use the camera control instead, the output it base64, but not in the format that D365 needs. In the document field, I added the split function: split(triggerBody()['CreateaNote_Document'],'base64,')[1] so that I would get everything after the headers (data:image/jpeg;base64,/9j/4AA.....), and this worked out fine. I know there is a possibility to use a Swagger file to convert blob to base64 in PowerApps, but I am not fully clear on the procedure as it is all very Sharepoint specific and there are some broken links. Hopefully Blob conversion in Flow is a future enhancement.

    ------------------------------
    Audrey Forrest
    Senior Accountant and Business Analyst
    CRMUG Co-Chapter Leader Seattle/PacNW
    Seattle WA
    ------------------------------



  • 5.  RE: Prevent file names from being created with quotes?

    Posted Apr 22, 2019 06:13 PM
    Did you try use conversions?

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#conversion-functions


    ------------------------------
    Gustavo Moraes
    CEO
    12981256195
    ------------------------------