function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
YMMVYMMV 

How to skip required field when updating a record

Hi there,

We are using SOAP API to update the lead object. One of our customers have two custom fields under lead which is marked as "required" in his custom page layout. Those two fields do come with default value formulas. However, the formulas are not executed when the lead is created by salesforce Web-To-Lead, which seems expected according to this FAQ. In this case, our API update failed with "MISSING_REQUIRED_FIELD" even we do not intend to touch those fields at all. So is there a way to skip required fields during updating?

 

One observation is this customer installed the "salesforce for google adwords". I found the "LeadSource" is updated by "salesforce for google adwords" when the lead is created by "Web-To-Lead". This seems indicating there is a way to do that?

 

help appreciated!

 

thanks,

Jason

Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

There are three levels to making a field required: At the Schema Level, Validation Rule Level, and at the Page Layout level.

 

If a field is marked required in the Schema (Setup -> Customize -> Leads -> Fields -> Click Custom Field (Mark Required) than API calls will require the fields.

 

If a field is marked required in a Validation Rule (Setup -> Customize -> Leads -> Validation Rules (Valdiation Rule for Field) than API calls will require the fields.

 

If a field is marked required in a Page Layout ONLY (Setup -> Customize -> Leads -> PAge Layouts (Mark Field as Required in Layout Editor) than you WILL NOT need to enter it in the API for the SOAP call to work.

 

Note: There are some standard fields which are always required (Like LastName on a Contact) regardless of my help above. 

 

I would recommend the following approach:

 

1. Confirm if the Field is required at the Schema, Field Validation, or Page Layout level. Also confirm if it is a special required field like LeadStatus.

 

2. If this is at the Schema layer, than evaluate if you can turn it off as Required at Schema level and leave it as Required on Page Layout.

 

 

3. If need, change your integration to query / return the Lead object before you update it. That way you can fill in the required fields with what they currently are.

 

If all else fails, if you are performing an UPDATE than I would recommend you pull the Fields for that object that are required from SFDC first, than do the update. Assuming you are doing an UPDATE you should have SFDC ID. Simply pull the Lead via SOAP query, populate the required fields from the result into your new request, then do the UPDATE.

 

Hope that helps.

All Answers

Cory CowgillCory Cowgill

There are three levels to making a field required: At the Schema Level, Validation Rule Level, and at the Page Layout level.

 

If a field is marked required in the Schema (Setup -> Customize -> Leads -> Fields -> Click Custom Field (Mark Required) than API calls will require the fields.

 

If a field is marked required in a Validation Rule (Setup -> Customize -> Leads -> Validation Rules (Valdiation Rule for Field) than API calls will require the fields.

 

If a field is marked required in a Page Layout ONLY (Setup -> Customize -> Leads -> PAge Layouts (Mark Field as Required in Layout Editor) than you WILL NOT need to enter it in the API for the SOAP call to work.

 

Note: There are some standard fields which are always required (Like LastName on a Contact) regardless of my help above. 

 

I would recommend the following approach:

 

1. Confirm if the Field is required at the Schema, Field Validation, or Page Layout level. Also confirm if it is a special required field like LeadStatus.

 

2. If this is at the Schema layer, than evaluate if you can turn it off as Required at Schema level and leave it as Required on Page Layout.

 

 

3. If need, change your integration to query / return the Lead object before you update it. That way you can fill in the required fields with what they currently are.

 

If all else fails, if you are performing an UPDATE than I would recommend you pull the Fields for that object that are required from SFDC first, than do the update. Assuming you are doing an UPDATE you should have SFDC ID. Simply pull the Lead via SOAP query, populate the required fields from the result into your new request, then do the UPDATE.

 

Hope that helps.

This was selected as the best answer
YMMVYMMV

Aha, yes, I missed the fact that the requiredness is actually double enfoced at both schema and layout levels. We removed the requiredness from schema and the update went through. Thanks a lot for the help!