I've encountered a major issue with one of my managed solutions. I have a customized workflow that generates multiple custom entities, each with various money fields.
Here's the scenario when I trigger my workflow:
- The custom workflow enters a 'waiting' state and throws a null reference exception.
- While most entities are created successfully, one of them has NULL values in the money fields (which should default to £0.00).
- Upon opening this specific record, I receive the error message mentioned in the title of this post.
There are some key points to consider:
- The system is configured with Pound Sterling as the default currency.
- I have attempted to implement the following JavaScript code in the OnLoad() event of my form, as recommended by sources online:
var lookupData = new Array();
var lookupItem= new Object();
lookupItem.id = "{7bCA916E76-FA28-E211-8C7C-0800273EE9D1}";
lookupItem.entityType = "transactioncurrency";
lookupItem.name = "Pound Sterling";
lookupData[0] = lookupItem;
Xrm.Page.getAttribute("transactioncurrencyid").setValue(lookupData);
If this JS code is present on the form and I try to create a new record, I encounter the error:
Error: 'Xrm.Page.getAttribute(..)' is null or not an object
Could someone offer guidance on how to resolve this issue?
It's worth noting that this error only manifests in the live system, not in the development environment.