Mar 25, 2012

Issue of using Onload JavaScript for “create form” of Quote

This is just a simple warning. We all use onload JavaScript for any entity and we simply know how to handle them separately for Create form and Update form, when necessary.  For example, below is a popular way of doing something (for onLoad) just for “create form”.

var CRM_FORM_TYPE_CREATE = 1;     
var CRM_FORM_TYPE_UPDATE = 2;

if (crmForm.FormType == CRM_FORM_TYPE_CREATE)
{
  //some script create form onload
}

Now I am going to use this for Quote entity. Can you guess the issue related to this attempt?

Quote can be created from other entities; for example from Opportunity. This script will not work when we create a quote from opportunity. That’s because, when quote is being created from opportunity, quote is first created in the background before pop-up a form for user. What we really see is an Update form not a create form. In such cases, you may move in to plug-ins than Java Scripts. Actually, you don’t get a create event. Quite tricky! Isn’t it?

No comments:

Post a Comment