Skip to main content
Community site session details

Community site session details

Session Id : UHKFpeFp9NPAsMl2jNYQSM
Power Automate - Using Connectors
Unanswered

Issue to save a pdf to notes

Like (0) ShareShare
ReportReport
Posted on 20 Apr 2020 09:51:27 by 5

Hello
I builded a flow in Sandbox wich should convert a html into a pdf and then save it into Dynamics 365 notes. It worked fine and as it should. After that I recreated it in the dev-system of the customer, the html creation and convert of this file works perfect, but saving into CRM doesn't.

It throws following error while saving changes to the flow (CDS-Connector is used):

 

Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Fehler beim Speichern des Flows. Code: OpenApiOperationParameterValidationFailed, Meldung: \"Input parameter 'item' validation failed in workflow operation 'Create_a_new_record': The parameter with value '\"@outputs('Get_file_content')?['body']\"' in path 'item/documentbody' with type/format 'String/binary' is not convertible to type/format 'String/bytes'.\"."}}". Code: 0x80060467 InnerError: Type: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Fehler beim Speichern des Flows. Code: OpenApiOperationParameterValidationFailed, Meldung: \"Input parameter 'item' validation failed in workflow operation 'Create_a_new_record': The parameter with value '\"@outputs('Get_file_content')?['body']\"' in path 'item/documentbody' with type/format 'String/binary' is not convertible to type/format 'String/bytes'.\"."}}". StackTrace: at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Update(Entity entity, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, Boolean checkForOptimisticConcurrency, Dictionary`2 optionalParameters) at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.Update(Entity entity, UpdateOption updateOption) at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.UpdateEdmEntity(CrmODataExecutionContext context, String edmEntityName, String entityKeyValue, EdmEntityObject entityObject) at Microsoft.Crm.Extensibility.OData.EntityController.PatchEntityImplementation(String& entityName, String key, EdmEntityObject entityDelta) at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext() InternalException: '.

 

and the following error while saving the PDF to the notest (Dynamics 365 Connector):

Invalid character in field 'documentbody': '
', hexadecimal value 0x0C, is an invalid character.

 
 

 

  • Bruce Buxton - North52 Profile Picture
    4 on 10 May 2022 at 17:04:06
    Re: Issue to save a pdf to notes

    I found that I had to decode the value then re-encode it!

     

    decodeBase64(base64(outputs('Generate_document_from_Word_template')?['body/fileContent']))
  • Aedu Profile Picture
    107 on 21 Mar 2022 at 10:51:34
    Re: Issue to save a pdf to notes

    Hi

    We just struggle over the same problem. Did you find a solution?

  • Community Power Platform Member Profile Picture
    on 19 Aug 2021 at 18:23:39
    Re: Issue to save a pdf to notes

    base64() solves the issue of bypassing the error but when you open the pdf from the notes it fails to open

    ssanthosh94_0-1629397407542.png

     

  • GuravaReddy Profile Picture
    56 on 16 Jul 2020 at 12:23:23
    Re: Issue to save a pdf to notes

    @Noah,

     

    MS support is suggested below option in my scenario and its working fine. 

     

    if I use file content directly in flow system throws an error message .

    1.png

    so they suggested to  use base64 function to convert file content and its working now.

    base64(outputs('Get_file_content_using_path_FAQ')?['body'])

    2.png

     

    Regards,

    Greddy

     

     

     

  • noahvoe Profile Picture
    5 on 30 Jun 2020 at 05:42:17
    Re: Issue to save a pdf to notes

    Hi @GReddy 

     

    We couldn't solve the problem, but it wasn't a really necessary feature, it would just be nice feature to have.

    If we find a solution in the future I'll post it here.

     

    Please inform us if you have solution for the problem.

     

    Regards 

     

    Noah

  • GuravaReddy Profile Picture
    56 on 29 Jun 2020 at 13:38:31
    Re: Issue to save a pdf to notes

    Hi All,

     

    I am also getting same error message. 

    It works fine till last week and suddenly it is throwing error message .

     

    Now , flow is not able to create a note with attachment in D365 CE. In my case, flow is converting word to pdf and creating a note with attachment in D365 CE.  

     

    Error : Invalid character in field 'documentbody': '', hexadecimal value 0x14, is an invalid character.

     

    SC16.png

     

    I tried below scenario to test the issue but getting same error message 

    • Read sample pdf file (Data in pdf : Test flow pdf data) from SharePoint
    • Create Note with Attachment .

     

    SC18.png

    SC17.png

     

    Regards,

    Greddy 

     

     

  • yashag2255 Profile Picture
    24,647 Super User 2024 Season 1 on 21 Apr 2020 at 11:56:34
    Re: Issue to save a pdf to notes

    Hi @noahvoe 

     

    Can you share a screenshot of the error that you are seeing? Can you check after the convert to PDF action, when you are creating the file in the notes for CDS, can you try wrapping the pdf content in a binary function? 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Featured topics

Loading complete