# Quiz #3

Published in Quizzes

1. What is the best approach to create an autonumber field like "2018/12-1"({Current_Year} / {Current_Month} - {Sequence_Number})?

1. Create a formula field
2. Create a custom field and implement a process builder
3. Create a custom field and implement an apex trigger
4. Create an autonumber field with the display format "{YYYY}/{MM}-{0}"

Close

You can create an autonumber field with the specified display format. A Display Format allows you to control the appearance of the Auto Number field. A Display Format consists of the substitution variables described below, plus any other characters you wish to include as a prefix or suffix.

Substitution Variables in Display Format

 {0} Required Sequence number. One or more zeros enclosed in curly braces represent the sequence number itself. The number of zeros in the curly braces dictates the minimum number of digits that will be displayed. If the actual number has fewer digits than this, it will be padded with leading zeros. Maximum is 10 digits. {YY}{YYYY} Optional Year. 2 or 4 "Y" characters enclosed in curly braces represent the year of the record creation date. You can display 2 digits (for example, "04") or all 4 digits (for example, "2004") of the year. {MM} Optional Month. 2 "M" characters enclosed in curly braces represent the numeric month (for example, "01" for January, "02" for February) of the record creation date. {DD} Optional Day. 2 "D" characters enclosed in curly braces represent the numeric day of the month (for example, "01" to "31" are valid days in January) of the record creation date.

Examples

 Display Format Sequence Number Formatted Number Comments {0} 12505000 12505000 No formatting. No leading zeros. {000} 12505000 0012505000 With leading zeros padded to 3 digits. {000000} 12505000 000001000250005000 With leading zeros padded to 6 digits. {YYYY}{MM}-{0} 12505000 201807-1201807-250201807-5000 4-digit year and month used as prefix to number. PO# {00000000} 12505000 PO# 00000001PO# 00000250PO# 00005000 Prefix with "PO# " (including space.)

2. How many different sObject types you can create using one DML call?

1. 1
2. 5
3. 10
4. 150
5. Unlimited

Close

You can create records of up to 10 object types in one call. If the sObject array contains more than 10 chunks, Salesforce will throw the exception: "Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking."

Let's see how Salesforce determines the number of chunks. You have a list with 10 items: account1, account2, contact1, account3, contact2, lead1, lead2.

Salesforce splits the records into five chunks:
1. account1, account2
2. contact1
3. account3
4. contact2

As you can see, a chunk is a subset of the input array, where each chunk contains records of one object type. I recommend you to use a sort method, that will rearrange records by object types, for example above you will have only three chunks. You need to make additional calls for processing more than 10 chunks.

3. How many fields can be tracked in the Field History Tracking?

1. 20
2. 25
3. 50
4. 500
5. Unlimited