Difference between revisions of "Making Company Standard Fields Mandatory"

From SmartWiki
Jump to: navigation, search
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
To make company standard fields mandatory, you must create a custom field of type [[Custom Field Type: Special – Browser Script]] and place it on the same entity that you'll be using it. For companies, you'll want to put the custom field in via Global Settings > Branch & Account Settings > Account Custom Fields
+
# Go to the [[Contact and Account Standard Fields|Company Standard Fields]] settings page from the [[Global Settings]] page. (Global Settings--Organizations--Standard Fields)
 +
# Select the standard field you want to make mandatory.
 +
# Check off the "Mandatory" checkbox.
 +
# Hit Save.
  
<pre>
+
----
function additionalCheckingOnSubmit(){
+
-''Alternate Method:'' Create a custom field of type [[Custom Field Type: Special – Browser Script]] and place it on the same entity that you'll be using it. For companies, you'll want to put the custom field in via [[Global Settings]] > [[Branch & Account Settings|Branch & Account Settings]] > Account Custom Fields
    var frm=document.frmcompany;
 
    var element=frm.address;
 
    if(element&&element.value.length==0){
 
        alert("Address is empty!");
 
        return false;
 
    }
 
    element=frm.phone;
 
    if(element&&element.value.length==0){
 
        alert("Phone is empty!");
 
        return false;
 
    }
 
    element=frm.city;
 
    if(element&&element.value.length==0){
 
        alert("City is empty!");
 
        return false;
 
    }
 
    element=frm.country;
 
    if(element&&(element.value.length==0||element.value=="0")){
 
        alert("Country is empty!");
 
        return false;
 
    }
 
    return true;
 
}
 
  
function savefunc(){return additionalCheckingOnSubmit();}
+
<pre>function savefunc(frm){
</pre>
+
  var element=frm.address;
 +
  if(element&&element.value.length==0){
 +
      alert("Address is empty!");
 +
      return false;
 +
  }element=frm.phone;
 +
  if(element&&element.value.length==0){
 +
      alert("Phone is empty!");
 +
      return false;
 +
  }element=frm.city;
 +
  if(element&&element.value.length==0){
 +
      alert("City is empty!");
 +
      return false;
 +
  }element=frm.country;
 +
  if(element&&(element.value.length==0||element.value=="0")){
 +
      alert("Country is empty!");
 +
      return false;
 +
  }return true;
 +
}</pre>
 +
 
 +
==See Also==
 +
* [[Contact_and_Account_Standard_Fields#Mandatory|Contact and Account Standard Fields]]
 +
* [[Making Contact Standard Fields Mandatory]]
 +
* [[Making Company Mandatory for Contact Records]]
  
 
[[Category: Custom Fields]][[Category:JavaScript]]
 
[[Category: Custom Fields]][[Category:JavaScript]]

Latest revision as of 13:44, 22 August 2018

  1. Go to the Company Standard Fields settings page from the Global Settings page. (Global Settings--Organizations--Standard Fields)
  2. Select the standard field you want to make mandatory.
  3. Check off the "Mandatory" checkbox.
  4. Hit Save.

-Alternate Method: Create a custom field of type Custom Field Type: Special – Browser Script and place it on the same entity that you'll be using it. For companies, you'll want to put the custom field in via Global Settings > Branch & Account Settings > Account Custom Fields

function savefunc(frm){
   var element=frm.address;
   if(element&&element.value.length==0){
      alert("Address is empty!");
      return false;
   }element=frm.phone;
   if(element&&element.value.length==0){
      alert("Phone is empty!");
      return false;
   }element=frm.city;
   if(element&&element.value.length==0){
      alert("City is empty!");
      return false;
   }element=frm.country;
   if(element&&(element.value.length==0||element.value=="0")){
      alert("Country is empty!");
      return false;
   }return true;
}

See Also