Error when i refresh page in dynamics crm - javascript

i become an error when i click of the refresh button in Quote Entity.
the Problem does not happen in every record.
here is the error Text:
TypeError: Unable to get property 'getValue' of undefined or null reference at initializeFields
(https://.crm4.dynamics.com/%7b637228466560015635%7d/webresources/Sales/QuoteDetail/QuoteDetail_main_system_library.js:1:8424)
at FormOnLoad (https://.crm4.dynamics.com/%7b637228466560015635%7d/webresources/Sales/QuoteDetail/QuoteDetail_main_system_library.js:2:11491)
at mp.prototype.executeFunction (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:1429:2767)
at mp.prototype.execute (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:1429:2419)
at up.prototype._executeIndividualEvent (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:1426:19561)
at up.prototype._executeEventHandler (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:1426:18254)
at execute (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:1426:15493)
at O.prototype._executeSyncAction (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:881:688)
at O.prototype._executeSync (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:881:294)
at O.prototype.executeAction (https://.crm4.dynamics.com/uclient/scripts/app.js?v=1.4.476-2003.4:881:150)

You get an Error because of Javascript and especially for your function initializeFields
Your Javascript is running onLoad of your Form.
You are fetching some attribute, and trying to get value of it.
But you do not get object itself and hence getValue Error.
Try adding your code here and we can help you further.

Related

Uncaught FirebaseError: Function DocumentReference.set() called with invalid data. Unsupported field value: undefined

I'm creating a e-commerce with Vue & Firebase. Trying to add some cart information from the current logged in user. Strange thing is at the very first time information saved perfectly. When I trying to add some again. That dosent work and show this error.
Uncaught FirebaseError: Function DocumentReference.set() called with invalid data. Unsupported field value: undefined
So I have to refresh that page. Then it work again. I cant understand where is the problem.
Note: If I try to add any other value instead of cart. then it works fine.
checkoutLoggedInUser(){
var db = firebase.firestore();
var user = firebase.auth().currentUser;
db.collection("orders").add({
user_id:user.uid,
cart:this.$store.getters.cart
})
this.$store.commit('emptyCart')
this.$router.push({ name: 'Home'})
}
That error message is saying that one of the fields you're trying to write to a document is undefined in JavaScript. Check the values that you're passing by using console.log or using a debugger to figure out which one is undefined, then change your code to pass something else, or omit the field entirely.
Also bear in mind that the error message is referencing a call to DocumentReference.set(), but the code you're showing is calling DocumentReference.add(), so the error might be in a different location.

Unable to get property '0' of undefined or null reference Lookup field

Recently lookup field in dynamic CRM form started throwing this error:
"Unable to get property '0' of undefined or null reference"
when we tried to change this lookup field. There is no Javascript called on Onchange event
I have attached a screenshot of the error:
In this case, if I did not know where this setaddionalparams function is located, my first move would be to disable all (or one by one) custom events on the form in the Handler Properties dialog that is called when you double click on the event handler in the Form Properties dialog in the Events tab (this one). If the error stops appearing then obviously the function is somewhere in your code.
Good luck!
UPDATE
There can be more reasons why you still see this error, please check scripts attached to the Ribbon, scripts inside HTML Web Resources and IFrames if you have any.
In addition, it may not be a direct call to the attribute by name, it may be a for loop that iterates through all attributes in the form. In this case you will need to search the code by the following keyword getValue()[0]. It seems like someone accesses a lookup attribute without checking if it's null. It should be fixed like this:
var productId = null;
var lookupValue = Xrm.Page.getAttribute("productid").getValue();
if (!!lookupValue && lookupValue.length > 0){
productId = lookupValue[0].id;
}

Opening new url with javascript in a new window but can't read value because it's null

So I have my code but when I enter it into the console in chrome it comes back "TypeError: Cannot read property 'trigger' of null"
It's because con doesn't exist yet. How can I fix it?
var win = window.open("https://www.sitetest2.robloxlabs.com/upgrades/payment?ap=100");
var con = win.document.getElementById("submit-button-wrapper")
function Loop()
{
con.trigger("click")
}
Loop()
You are asking the window to get you an element that does not exist. Once that window is opened if you run the following in the console:
window.document.getElementById("submit-button-wrapper")
Then the return value is null because there is no element on the page with an id of submit-button-wrapper In fact that identifier is not mentioned at all. (as a class even) Even if I wait for the page to fully load that element is never added to the document.
If an element does not exist, you cannot get it. Simple as that.
If the element is created due to an Ajax load then you need to hook into that and get the element after the Ajax load has occurred.

JavaScript error: SCRIPT5007: Unable to get property 'getElementsByTagName'

I am using the following jQuery to get the field value from a Display Form in SharePoint 2013 so I can pass the value along in a URL.
var itemID = $('h3:contains("My ID")').closest('td').next('td').text();
It is working perfectly, but I am getting an error when I inspect the action:
SCRIPT5007: Unable to get property 'getElementsByTagName' of undefined or null reference
File: sp.ui.dialog.js, Line: 2, Column: 22380
This contradicts what is actually occurring, since the code executes. I am running IE11 in IE10 compatibility mode.
I have seen this when the URL being passed to the modal function was invalid. In my case, I has a dynamic URL containing a variable named itemID. I got the error whenever itemID was undefined.
I wish I could elaborate further but all I can comment on is my own observations at this point.

problems getting the value of a field in a Ext.data.Model

I need to set values ​​in a text field, obtaining a data.Model these values​​, but when I run the function anywhere in the code, sends me this error:
Uncaught TypeError: Can not read property 'get' of undefined
But if I run it from a button works fine.
this is the code:
function SetterValues() {
var rec = store_usr.getAt(0);
Ext.getCmp('name_usr').setValue(rec.get("user"));
Ext.getCmp('nom_usr').setValue(rec.get("name"));
Ext.getCmp('ape_usr').setValue(rec.get("LastName"));
}
Help please! because I can not run it from anywhere in my code!
The error message you're receiving indicates that the rec variable is undefined. Are you sure that your store_usr exists, and is loaded? If so, does store_usr.getAt(0) return anything?

Categories