0

We have a rest api call where id is passed needs to be cloned in order to get a new record for the object. As the object has multiple record types, so we want to get fields based on the record type. Is it possible to get fields based on record type of an object? The purpose of getting those fields were we do not need to fill few fields while cloning the record.

For example RecordType A has following fields FieldName1 FieldName2 FieldName3 FieldName4

RecordType B has following fields FieldName1 FieldName3 FieldName5

While cloning the record we do not want to copy the FieldName3,FieldName4 value for RecordType A and similarly do not want to copy FieldName3 value for RecordType B.

If I use standard Clone(), then is it possible to avoid cloning few field values?

Thanks in advance.

  • 1
    Fields aren't bound to Record Types. Fields may or may not appear on the Page Layout for a specific Record Type, and fields may appear on the page layouts for many record types. Further, fields that are not on the page layout for a given record type may still be populated. So long story short: are you really sure you want to do it this way? What do you gain by doing so? – David Reed May 31 at 20:48
  • If you do, you'll probably want to call the UI API or the Apex Metadata API to inspect the layout. – David Reed May 31 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.