BigBlueMan
asked on
CRM Javascript Access Denied Error
Hello
I've seen this issue a few times on various blogs and wondering if the experts can help... I have the following piece of JS below.
What its essentially doing is obtaining the parent objectid of one of our customized entities, application form. The parent form is the Contact form.
With the object id it then runs a little function which send fetchXML query to retrieve a piece of data from a relating form (lead) and bring it back.
This piece of code works find thru the CRM Web Client. However it fails when CRM is used thru Outlook, with a 'Access is Denied' error message.
However, it works for me thru Outlook as I am Domain admin user but fail for a general user..
Some users are also running Windows 7 in case that is related..
thanks
I've seen this issue a few times on various blogs and wondering if the experts can help... I have the following piece of JS below.
What its essentially doing is obtaining the parent objectid of one of our customized entities, application form. The parent form is the Contact form.
With the object id it then runs a little function which send fetchXML query to retrieve a piece of data from a relating form (lead) and bring it back.
This piece of code works find thru the CRM Web Client. However it fails when CRM is used thru Outlook, with a 'Access is Denied' error message.
However, it works for me thru Outlook as I am Domain admin user but fail for a general user..
Some users are also running Windows 7 in case that is related..
thanks
if (crmForm.all.new_fundercasenumber.DataValue == null) {
if ( window.opener) //checks if current window has a parent window
{
var oParentForm = window.opener.parent.document.getElementById('crmForm');
if ( oParentForm == null) {
oParentForm = window.opener.parent.document.crmForm;
}
if ( oParentForm) //This confirms if the parent window is a CRM form
{
// Now try to access a field in the parent form.
if ( oParentForm.ObjectId) //This ensures you have reached the form you're looking for
{
var fundingNumber = getEnquiryFundCaseNumber(oParentForm.ObjectId);
if ( fundingNumber != null) {
crmForm.all.new_fundercasenumber.DataValue = fundingNumber;
}
}
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
// bring in funding case number from enquiry, if its not given.
if (crmForm.all.new_fundercas
var contactLookup = crmForm.all.new_applicanti
if ( contactLookup != null) { //This confirms if the parent window is a CRM form
var fundingNumber = getEnquiryFundCaseNumber( contactLookup[0].id);
if (fundingNumber != null) {
crmForm.all.new_fundercase
}
}
}