官术网_书友最值得收藏!

Schema design and modification impact on Apex development

Previously, we have learned how we can define our data model through the user interface (UI), such as creating new objects and new fields and linking them to each other by creating specific relationships.

When you define objects, fields, and relationships, they become instantly available for you to use in declarative automation features and also in Apex code. Everything defined through the UI can be used programmatically with Apex and Salesforce Object Query Language (SOQL). I'll explain this in more detail in Chapter 4, Apex Basics, under the Working with data in Salesforce section, but, for now, you need to know when objects and/or fields are used/referenced elsewhere in Salesforce.

You won't be able to delete those fields or objects, as Salesforce won't allow that, and it will come up as a big error message telling you where the field or object you are trying to delete is referenced in your code (like in the following screenshot):

This is a good thing, because you could easily delete a field and the existing logic that is in your production org would break if you didn't pay attention.

So, if you want to delete or modify a field or object that is used in the code or elsewhere in Salesforce, you need to follow these steps:

  1. You need to remove the reference.
  2. Then, delete the field or object.
  3. Finally, refactor your code or formulas so that everything can continue to work.
主站蜘蛛池模板: 雷山县| 磐安县| 铜山县| 博白县| 普定县| 东丰县| 襄汾县| 安平县| 邵阳县| 抚顺市| 广西| 灵璧县| 彩票| 浦北县| 宁津县| 南投县| 太原市| 武山县| 顺昌县| 黔南| 长海县| 海安县| 河北区| 南川市| 皮山县| 惠安县| 贵阳市| 沁源县| 靖江市| 元谋县| 九龙坡区| 三亚市| 禹城市| 常州市| 灯塔市| 囊谦县| 马鞍山市| 泰兴市| 滦平县| 贡觉县| 彩票|