'Xrm.Page.getAttribute(...)' is null or not an object
-
2012년 4월 26일 목요일 오후 2:24
I keep the following error message:
<CrmScriptErrorReport>
<ReportVersion>1.0</ReportVersion>
<ScriptErrorDetails>
<Message>'Xrm.Page.getAttribute(...)' is null or not an object</Message>
<Line>3</Line>
<URL>/%7B634710467020000000%7D/WebResources/dcc_Housing_Grants_library.js?ver=1594856534</URL>
<PageURL>/userdefined/edit.aspx?etc=10019&pagemode=iframe&preloadcache=1335450152753</PageURL>
<Function>dcc_customercontactid_onchange()</Function>
<CallStack>
<Function>dcc_customercontactid_onchange()</Function>
<Function>crmForm_window_onload_handler(eventObj,eventArgs)</Function>
<Function>anonymousanonymous(){crmForm_window_onload_handler(Xrm.Page.ui)}</Function>
</CallStack>
</ScriptErrorDetails>When running this on load event code:
function dcc_customercontactid_onchange()
{
lookupContact = Xrm.Page.getAttribute("contactid").getValue();Xrm.Page.getAttribute("assigned").setValue(lookupContact);
Anyone know the problem?
모든 응답
-
2012년 4월 26일 목요일 오후 2:29Please use the below code you have a syntax error in your code
function dcc_customercontactid_onchange()
{
varlookupContact =Xrm.Page.data.entity.attributes.get("contactid").getValue();
Xrm.Page.getAttribute("assigned").setValue(lookupContact);
}
If you need more information please let me know.
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Mubasher Sharif
Check out my about.me profile!
http://mubashersharif.blogspot.com
Linked-In Profile
Follow me on Twitter!
- 편집됨 MubasherSharif 2012년 4월 26일 목요일 오후 2:31
- 편집됨 MubasherSharif 2012년 4월 26일 목요일 오후 2:32
-
2012년 4월 26일 목요일 오후 2:33중재자
Hi,
First make sure you are using correct field names.
Second to set lookup you need to follow below script
var lookup = new Object(); var lookupValue = new Array(); if(Xrm.Page.getAttribute("contactid").getValue()!=null) { lookup.id= Xrm.Page.getAttribute("contactid").getValue()[0].id; lookup.entityType ="contact"; lookup.name =Xrm.Page.getAttribute("contactid").getValue()[0].name; lookupValue[0] = lookup; Xrm.Page.getAttribute("assigned").setValue(lookupValue); }Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- 답변으로 표시됨 JMcCon 2012년 5월 10일 목요일 오후 3:07
-
2012년 4월 26일 목요일 오후 5:12
I saw a similar one. Assuming field names are correct, you might want to try
Xrm.Page.ui.controls.get().getAttribute().getValue
instead of Xrm.Page.getAttribute("contactid").getValue()
I posted a bit more details here:
Alex Shlega, GotchaHunter.Net
- 답변으로 표시됨 JMcCon 2012년 5월 10일 목요일 오후 3:07
-
2012년 4월 27일 금요일 오전 11:27중재자
Hello,
It seems that your custom handler fails. Can you please provide code of dcc_customercontactid_onchange() function from dcc_Housing_Grants_library.js webresource?
Microsoft CRM Freelancer
My blog (english)
Мой блог (русскоязычный)
-
2012년 5월 3일 목요일 오전 8:40
I meet the simlar question when use Xrm.Page.ui.controls.get('xxx') in form load
-
2012년 5월 10일 목요일 오후 3:07
I got this sorted.
I had to ensure there was a default value in the dropdown rather than it being null.