cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
noahvoe
Frequent Visitor

Issue to save a pdf to notes

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.

 
 

 

7 REPLIES 7

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!

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 

 

 

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

@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

 

 

 

Anonymous
Not applicable

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

 

Aedu
Helper II
Helper II

Hi

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

brucebuxton
New Member

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

 

decodeBase64(base64(outputs('Generate_document_from_Word_template')?['body/fileContent']))

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Kudoed Authors
Users online (5,821)