CRM - Web/ Outlook Conflicts

Hi

We have a custom form called Application Form created on our CRM system. This form is associated on the Details screen under Contacts, where the user can create associated records. Addtionally, under the Workplace->Extensions folder we are showing the view of records for this entity just for ease of user access.  

Our issue is to allow the user to create New records using this form at the Contact parent level but prevent them creating new records at the Workplace->Extensions folder level..
In order to prevent this I've placed the piece of Javascript code in the ApplicationForm
OnLoad()  event.  If the form is opened via the New button at another level besided the Contact level it will give an warning message and then close itself.  

This works fine in the CRM Web inface but fails thru the Outlook one. The error says 'window.opener.parent.document' is null....  

Anyone any ideas how I can adapt this for both installations ?

thanks


var parentForm = window.opener.parent.document.crmForm;
// check whether form being opened from application view of main CRM page, not via Contact form.
if (crmForm.FormType == 1 && parentForm == null) {
   alert("Please created New Application Form via the CRM Contact Form, Not this way!");
  crmForm.detachCloseAlert();
  window.close();    
  return;
}
BigBlueManAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Feridun KadirPrincipal ConsultantCommented:
I think you've discovered one of the issues of using unsupported techniques in Javascript.

Might a better method be to just test whether the parent contact field is empty?  If the user creates the application form in extensions then the parent contact field (the lookup) is blank but if they do it from inside a contact form the lookup field will have the name of the contact and therefore won't be blank. This way you can use supported methods and it should work in Outlook and the Web.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BigBlueManAuthor Commented:
Yeh I should have realised that one... thanks for your help..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.