Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : rOHAXTZuMC4hEaP+5JdQx8
Small and medium business | Business Central, N...
Suggested answer

Getting Error While uploading .pfx certificate in blob field

Like (7) ShareShare
ReportReport
Posted on 28 Mar 2025 11:40:56 by 12,111 Super User 2025 Season 1
 
I have create Blob field and trying to store .pfx file but getting below 
Error Message: "Loading field Certificate will be skipped because there was an error when reading the data.
To fix the current data, contact your administrator.
Alternatively, you can overwrite the current data by entering data in the field." 
 
procedure ImportCertificate()
    var
        TempBlob: Codeunit "Temp Blob";
        FileManagement: Codeunit "File Management";
        RecordRef: RecordRef;
        FieldRef: FieldRef;
        UploadCertificateFileMsg: Label 'Upload .pfx certificate';
    begin
        if FileManagement.BLOBImportWithFilter(TempBlob, UploadCertificateFileMsg, '', 'PFX Files (*.pfx)|*.pfx', 'pfx') = '' then
            exit;
        Clear(Rec.Certificate);
        RecordRef.GetTable(Rec);
        FieldRef := RecordRef.Field(Rec.FieldNo(Certificate)); // Use FieldRef to reference the field
        TempBlob.ToFieldRef(FieldRef); // Assign TempBlob content to the field
        RecordRef.SetTable(Rec);
        Rec.Modify(true);
    end;
 
Appreciate any suggestion on it.
  • Suggested answer
    YUN ZHU Profile Picture
    79,743 Super User 2025 Season 1 on 30 Mar 2025 at 23:50:41
    Getting Error While uploading .pfx certificate in blob field
    Hi, hope the following can give you some hints.
    Dynamics 365 Business Central: Conversion between Blob data type and Media/MediaSet data type
     
    Thanks.
    ZHU
  • Suggested answer
    Ramesh Kumar Profile Picture
    1,991 on 29 Mar 2025 at 18:56:45
    Getting Error While uploading .pfx certificate in blob field
    Not solution but might good check if Blob has data or not.
     
     // Check if TempBlob contains data
        if TempBlob.Length = 0 then
            Error('No data loaded into the TempBlob.');
     
    Thanks
    Ramesh
     
    If this was helpful, please check the "Does this answer your question?" box and mark it as verified.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    12,111 Super User 2025 Season 1 on 28 Mar 2025 at 12:58:37
    Getting Error While uploading .pfx certificate in blob field
     Thank you So much For the response
    I have checked all these solutions, but none of them are working
  • Suggested answer
    Jainam M. Kothari Profile Picture
    3,170 on 28 Mar 2025 at 12:22:22
  • Suggested answer
    Holly Huffman Profile Picture
    4,128 on 28 Mar 2025 at 11:42:59
    Getting Error While uploading .pfx certificate in blob field
    Hi there! Good morning, evening, or afternoon - depending on where you are :) Hope you are well today! 
     
    The error you're encountering while uploading a .pfx certificate to a Blob field in Dynamics 365 Business Central could be due to several factors. Here's a breakdown of potential causes and solutions:
     
    Possible Causes
    1. File Format or Corruption:
      • The .pfx file might be corrupted or not properly formatted. Ensure the file is valid and can be opened using other tools.
    2. Blob Field Configuration:
      • The Blob field might not be properly configured to handle the .pfx file. Ensure the field is set up correctly in the table schema.
    3. Code Logic Issue:
      • The TempBlob.ToFieldRef(FieldRef) line might not be correctly assigning the Blob content to the field. This could happen if the TempBlob content is not properly initialized or if the FieldRef is not correctly referencing the Blob field.
    4. File Size Limitations:
      • Large .pfx files might exceed the size limit for Blob fields. Check the file size and ensure it is within the allowed limit.
    5. Permissions:
      • The user or service account uploading the file might not have sufficient permissions to modify the record or field.
    Solutions
    1. Validate the .pfx File:
      • Open the .pfx file in a certificate management tool to ensure it is valid and not corrupted.
    2. Debug the Code:
      • Add debugging statements to verify that:
        • The TempBlob is correctly populated with the file content.
        • The FieldRef is correctly referencing the Blob field.
    3. Check Field Configuration:
      • Ensure the Blob field in the table is properly configured to store binary data.
    4. Handle Large Files:
      • If the .pfx file is large, consider compressing it or increasing the allowed size for Blob fields.
    5. Test with a Smaller File:
      • Try uploading a smaller .pfx file to see if the issue is related to file size.
    6. Review Permissions:
      • Ensure the user or service account has the necessary permissions to modify the record and Blob field.
    7. Alternative Approach:
      • If the issue persists, consider using a different method to store the .pfx file, such as saving it to Azure Blob Storage and storing the URL in the database.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,333 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,262 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Loading complete