EDIT POST: I have solved the issue I had, it was a Javascript syntax mistake.
I can't find an option to delete this post so I am just editing this. If there is any admin around, please close and delete this post.
Thanks
EDIT POST: I have solved the issue I had, it was a Javascript syntax mistake.
I can't find an option to delete this post so I am just editing this. If there is any admin around, please close and delete this post.
Thanks
Hi Pablo,
Thank you very much for taking your time, I had already edited the post before your answer saying that I found the error.
You are right, it was the foreach causing the problem because I was using await inside the callback of the foreach, which wasn't an async function, hence Dynamics just threw that error that script was not loaded because of this syntax error.
Once I changed it to a for loop it worked.
As I said before, thank you very much for your time in order to help me with my problem.
Greetings.
Hi Loym ,
What if you change the forEach function by simple for statement in patientPurchasesOnDemand
// this
obj.Purchases.forEach(function (purchase) {
var invoiceRetrieved = await Ab.SharedLogic.retrieveRecordFromWebAPI("invoice", purchase.purchaseId, "?$select=" Ab.SharedLogic.Entities.InvoiceFields.IdAbInvoice, Xrm);
if (invoiceRetrieved === null) {
await this.insertInvoiceInCrm(formContext, purchase);
console.log("Fin insercion");
}
});
//By
var len = obj.Purchases.length;
for(var i = 0 ;i< len;i ){
var purchase = obj.Purchases[i];
var invoiceRetrieved = await Ab.SharedLogic.retrieveRecordFromWebAPI("invoice", purchase.purchaseId, "?$select=" Ab.SharedLogic.Entities.InvoiceFields.IdAbInvoice, Xrm);
if (invoiceRetrieved === null) {
await this.insertInvoiceInCrm(formContext, purchase);
console.log("Fin insercion");
}
}
regards.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156