Has anybody had any issues with using formload with a subgrid?
I've a page which runs JavaScript based on a subgrid being updated, and it doesn't seem to be working since we've been forced to move to UI.
Thanks
Lee
Has anybody had any issues with using formload with a subgrid?
I've a page which runs JavaScript based on a subgrid being updated, and it doesn't seem to be working since we've been forced to move to UI.
Thanks
Lee
Hi partner,
Yes, we should select "pass executionContext....." when we add it to events.
I'm so glad that you've resolved your problem.
If my answer helped you, please mark my answer as verified so that we choul help other users with similar issues.
Best Regarsds,
Leo
Got it, the execution context wasn't selected.
I've used F12 development - it's why I can see the console.log hasn't been activated.
The code has been validated in an online validator and is validated correctly.
The code is simply not being called.
Hi partner,
Yes, just add it to form "onload" event.
If there is no outputting, please use F12 to open the development tools and check if there is any error message, you could also debug your code to check if the function triggered.
If the code you provided above is the same in your event, then it miss a "}" at the last position.
Hope it helps.
Best Regards,
Leo
Where do I call this function from?
I've added it to my form's onload and it's not calling the function. My first line is a console log and it's not outputting.
function subgridOnload(executionContext){
console.log("in subgrid onload");
Hi partner,
Here's a doc for you.
https://docs.microsoft.com/en-us/power-platform/important-changes-coming
Hope it helps.
Best Regards,
Leo
"Xrm.page" is no longer supported in UI
Ah thank you.
Is there a list anywhere of everything that is no longer supported in UI?
We keep finding these things, and we don't have the time or resource to hunt down everything that was working as required in the classic look before being forced onto UI.
Hi partner,
"Xrm.page" is no longer supported in UI, so please use "executionContext" instead like the code I provided above.
Best Regards,
Leo
The only thing I've changed is the switch to Unified Interface. The code was working as expected in classic look.
function formload() {
var GridOnloadFunction = function() {
SubgridModifed();
};
//Check if the grid is loaded and add the event handler to the subgrid.
var checkgrid = window.setInterval(function() {
if (Xrm.Page.getControl("DebitCards") != null) {
Xrm.Page.getControl("DebitCards").addOnLoad(GridOnloadFunction);
window.clearInterval(checkgrid);
}
}, 2000);
var checkgridCredit = window.setInterval(function() {
if (Xrm.Page.getControl("CreditCards") != null) {
Xrm.Page.getControl("CreditCards").addOnLoad(GridOnloadFunction);
window.clearInterval(checkgridCredit);
}
}, 2000);
}
function SubgridModifed() {
firstFunction();
secondFunction();
thirdFunction();
Xrm.Page.data.entity.save();
}
Hi partner,
How did you add js functions to subgrid onload events?
You could try the following code:
Foe example I have an account subgrid on my form.
Note that you need to type in the correct subgrid name, not label.
You could refer to this doc for more details.
Hope it helps.
Best Regards,
Leo
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