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

How do we tell if field is "display" required in the new 2.5 SForce API?


It seems that the new 2.5 API only tells us in the meta data that a field is not nullable but does not tell us if the field is "display" required.  For example, the field "ActivityDate" is a display required field when creating an event. 

My first question is, can we get the "display" required fields?

I saw another posting that indicated we can use the 2.0 API to get the display required fields.  However, the describe response in the new API returns different field names from the describe response in the old API.  For example, the custom field names no longer have the custom field id embedded in the field name and some field names like "dueDateOnly" have been changed to "ActivityDate" (I'm assuming this is the same field looking at the label) 

My second question is, how can we use the workaround to get the display required fields if the field names have changed?  I assume the label cannot be used because the label is probably not necessarily a unique value.

Any help with this issue is greatly appreciated.


I guess I'm going to reply to my own posting... I tried getting the "display" required fields and isSelectable access rights from the meta data returned from the old 2.0 API, matched up the old fields to the new fields using the label, and to my pleasant surprise found that the workaround works and that if a user tries to create custom fields through the Salesforce website, it ensures that labels are unique.

So now I'm talking to myself on this board, but I have to respond to my earlier posting that the workaround using the old API to get meta data works because it really doesn't. 

There is a mismatch between labels for the Event entity in the old API (2.0) and the new API (2.5). 

The 2.0 API has the two fields "dueDateTime" and "dueDateOnly" with the labels "Date" and "Time" respectively.

The 2.5 API has the two equivalent fields "ActivityDate" and "ActivityDateTime" with labels: "Due Date Only" and "Due Date Time".

I'm using these labels to figure out the new field's equivalent in the old metadata so that I can get information such as which fields are "display" required fields or selectable fields, but since the labels don't match I don't know that "ActivityDate" and "ActivityDateTime" are display required fields.

I'm assuming that this is a bug with the 2.5 API, because on the Salesforce web site these two fields are labeled "Date" and "Time" which is what the 2.0 API returns.



Just an FYI.  Same problem with the Opportunity Name field, the new 2.5 API describes the field with the label "Name" instead of what it should be "Opportunity Name".