Answered by:
Is it possible to ristrict users to enter just Contact in customer field in a case?

Question
-
Hi,
Is it possible to ristrict users to enter just Contact in customer field in a case?
One can enter either an account or a contact name in this filed. I want to ristrict them to enter just the contact name. If any user enters account name in this field, he must receive an error.
Regards,
Monday, February 4, 2008 6:10 AM
Answers
-
You can do this in client-side script in the chane event of the customer field. Try:
if (crmForm.all.customerid.DataValue != null && crmForm.all.customerid.DataValue.length > 0)
{
if (crmForm.all.customerid.DataValue[0].typename != 'contact')
{
alert ('Please enter a contact name');
crmForm.all.customerid.DataValue = null;
}
}
Monday, February 4, 2008 6:35 AMModerator -
David,
I've tried your suggested solution on my test environment. It WORKS
... Thanks alot for your help...
After returning the alert message, it shows an error stating that "Some error has occured. Please contact your system administrator"...
Monday, February 4, 2008 8:23 AM
All replies
-
You can do this in client-side script in the chane event of the customer field. Try:
if (crmForm.all.customerid.DataValue != null && crmForm.all.customerid.DataValue.length > 0)
{
if (crmForm.all.customerid.DataValue[0].typename != 'contact')
{
alert ('Please enter a contact name');
crmForm.all.customerid.DataValue = null;
}
}
Monday, February 4, 2008 6:35 AMModerator -
Hi David,
This code will generate an alert but will not stop saving the case even if user enter an account name. Isn't it so?
Regards,
Monday, February 4, 2008 6:38 AM -
David,
I've tried your suggested solution on my test environment. It WORKS
... Thanks alot for your help...
After returning the alert message, it shows an error stating that "Some error has occured. Please contact your system administrator"...
Monday, February 4, 2008 8:23 AM -
But I didn't understand the logic behind 2nd error message "Some error has occurd....."
Can you help me understand it?
Monday, February 4, 2008 8:25 AM