web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Client side Validation...
Power Apps
Unanswered

Client side Validation on Field Type = File

(0) ShareShare
ReportReport
Posted on by 41

Hello everyone,

Thanks for reading my question.

I've created a Field of type File and place it on the form (model driven app). I need to do basic validation of the file such as File extension and File content. Now, with the help of Dataverse REST Builder I've the code to find the file name/extension & file content but the challenge is if I run the code on the fieldOnChange then the needed information doesn't exist in the database by the time. So, I need to find some other event on which I can trigger the code.

FileOnChange.png

this.fileToProcessOnChange = function(executionContext){ 
 prg_DataTransfer.checkFileExtension(executionContext);
 }

 this.checkFileExtension = function (executionContext){
 $.ajax({
 type: "GET",
 url: Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.2/prg_temporarydatas(cfb732f7-7acd-4193-9bfc-d4b352669f1c)?$select=prg_filetoprocess_name",
 headers: {
 "OData-MaxVersion": "4.0",
 "OData-Version": "4.0",
 "Content-Type": "application/json; charset=utf-8",
 "Accept": "application/json",
 "Prefer": "odata.include-annotations=*"
 },
 async: true,
 success: function (data, textStatus, xhr) {
 var result = data;
 //console.log(result);
 // Columns
 var prg_temporarydataid = result["prg_temporarydataid"]; // Guid
 var prg_filetoprocess_name = result["prg_filetoprocess_name"]; // Text
 console.log("File Name: " + prg_filetoprocess_name);
 },
 error: function (xhr, textStatus, errorThrown) {
 console.log(xhr);
 }
 });
 }
I have the same question (0)
  • Verified answer
    meelamri Profile Picture
    468 on at

    Hi @zohaibukhan 

     

    Unfortunately, the current control does not support a validation. Indeed, once you load your file on the UI, the file is automatically loaded in the database.

    I managed once to manage the validation of a file type column using a plugin. I think it's the best way to do this kind of validation.

    Also, I hope we will have the possibility to create PCF controls for this type of column. This will give more flexibility in the future.

    Please tick Accept as solution if the answer is useful.

    https://xrmtricks.com/

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard