Hi PrakashJain,
You can delete File from file type field using JS using ajax delete request.
Here is the code:
var requestUrl = "https://[CRM_Domain]/api/data/v9.0/accounts(1519111b-5432-ed11-9db1-002248268032)/new_attachment";
$.ajax({
type: "DELETE",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: requestUrl,
async: false,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
XMLHttpRequest.setRequestHeader("Prefer", "odata.include-annotations=*");
},
success: function (data, textStatus, XmlHttpRequest) {
alert("Deleted successfully");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("error occured");
}
});
In request URL, after API URL, add entity plural name and entity record id in () after that add file type field logical name from which you want to delete file.

You can create JS Web Resource with above code and use this WebResource as per your requirement i.e. form events, Ribbon buttons etc..
I hope it helps,
Thanks.
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Portal.