スキル一覧に戻る
GitalZuriel

create-field

by GitalZuriel

0🍴 0📅 2026年1月21日
GitHubで見るManusで実行

SKILL.md


name: create-field description: 'Create Salesforce custom fields. Use this skill when users request to create a field, add a field, or define a new custom field on any Salesforce object. Handles prefix rules automatically based on target object type.'

Create Custom Field

CRITICAL - Output Type

This skill creates CustomField metadata ONLY.

NEVER create:

  • CustomObjectTranslation files (translations)
  • objectTranslations files
  • Any file with Hebrew labels inside XML

ALWAYS create:

  • CustomField XML files in force-app/main/default/objects/<Object>/fields/
  • Labels must be in ENGLISH ONLY

Prefix Rules for FIELDS (CRITICAL)

NOTE: This skill is for creating FIELDS only, not Objects. For creating Objects, use the create-object skill.

Before creating any field, determine the target object type:

Target Object TypeField API Name FormatExample
Field on Standard Object (Account, Contact, Opportunity, etc.)<PREFIX>_<FieldName>__cVST_Status__c
Field on Custom Object (object name ends with __c)<FieldName>__c (NO prefix for the field)Status__c

IMPORTANT: This rule applies to FIELD names only. Custom Objects themselves ALWAYS require the prefix (see create-object skill).

The PREFIX is defined in copilot-instructions.md

Default Field Type (CRITICAL - DO NOT ASK USER)

When the user does not specify a field type, apply these defaults AUTOMATICALLY without asking:

Missing InformationDefault ValueNotes
Field TypeTextAlways default to Text
Text Length255Standard max for Text
Number Precision16Total digits including decimals
Number Scale0No decimal places by default

Rules:

  1. NEVER ask the user for field type if not specified - use Text(255)
  2. NEVER ask the user for length/precision - use defaults above
  3. NEVER ask the user about decimal places - use scale=0
  4. Only ask if the target object is truly ambiguous (e.g., "Visit" could be multiple objects)

MANDATORY Field Properties by Type (CRITICAL)

ALWAYS include the required properties for each field type. Missing properties will cause deployment errors.

Field TypeRequired PropertiesExample
Text<length> (1-255)<length>255</length>
TextArea<length> (max 131072)<length>32768</length>
LongTextArea<length>, <visibleLines><length>32768</length><visibleLines>5</visibleLines>
Html (Rich Text)<length>, <visibleLines><length>32768</length><visibleLines>10</visibleLines>
Number<precision>, <scale><precision>18</precision><scale>0</scale>
Currency<precision>, <scale><precision>18</precision><scale>2</scale>
Percent<precision>, <scale><precision>5</precision><scale>2</scale>
Checkbox<defaultValue><defaultValue>false</defaultValue>
Date(none required)-
DateTime(none required)-
Picklist<valueSet>See Picklist template below
Lookup<referenceTo>, <relationshipName>See Lookup template below

Common Errors to AVOID:

  • "length must be specified" → Always add <length> for Text fields
  • "RichTextArea is not valid" → Use <type>Html</type> instead of RichTextArea
  • Picklist formula error → Use ISPICKVAL(field, "value") not field = "value"

File Location

force-app/main/default/objects/<ObjectAPIName>/fields/<FieldAPIName>.field-meta.xml

Field Metadata Template

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>{FieldAPIName}</fullName>
    <label>{FieldLabel}</label>
    <type>Text</type>
    <length>255</length>
</CustomField>

Examples

Example 1: Field on Standard Object (Account)

Request: "Create a Status field on Account"

Result:

  • API Name: VST_Status__c (with prefix)
  • File: force-app/main/default/objects/Account/fields/VST_Status__c.field-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>VST_Status__c</fullName>
    <label>Status</label>
    <type>Text</type>
    <length>255</length>
</CustomField>

Example 2: Field on Custom Object

Request: "Create an EndDate field on VST_Visit__c"

Result:

  • API Name: EndDate__c (NO prefix for the FIELD - because it's on a custom object)
  • File: force-app/main/default/objects/VST_Visit__c/fields/EndDate__c.field-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>EndDate__c</fullName>
    <label>End Date</label>
    <type>Date</type>
</CustomField>

Object Existence Check (CRITICAL)

Before creating a field, verify the target object exists in the project:

  1. Check if the object folder exists: force-app/main/default/objects/<ObjectAPIName>/
  2. If the object does NOT exist:
    • DO NOT create the object automatically
    • DO NOT assume the user wants a new object
    • STOP and inform the user: "The object <ObjectAPIName> was not found in the project."
    • Wait for user instructions

Example response when object not found:

The object VST_Visit__c was not found in the project. Please create the object first or specify a different object.

Validation Checklist

Before creating a field:

  • Target object is specified (if not - ASK)
  • Target object exists in the project (if not - STOP and inform user)
  • Object type determined (standard vs custom)
  • Correct prefix rule applied
  • Label is in English (translate Hebrew if needed)
  • Label does NOT contain the prefix
  • All required properties for the field type are included (see table above)

Additional Field Templates

Checkbox Field

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>IsActive__c</fullName>
    <label>Is Active</label>
    <defaultValue>false</defaultValue>
    <type>Checkbox</type>
</CustomField>

Number Field

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Quantity__c</fullName>
    <label>Quantity</label>
    <precision>18</precision>
    <scale>0</scale>
    <type>Number</type>
</CustomField>

Rich Text (Html) Field

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Description__c</fullName>
    <label>Description</label>
    <length>32768</length>
    <type>Html</type>
    <visibleLines>10</visibleLines>
</CustomField>

Picklist Field

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Status__c</fullName>
    <label>Status</label>
    <type>Picklist</type>
    <valueSet>
        <valueSetDefinition>
            <sorted>false</sorted>
            <value>
                <fullName>Draft</fullName>
                <default>true</default>
                <label>Draft</label>
            </value>
            <value>
                <fullName>Active</fullName>
                <default>false</default>
                <label>Active</label>
            </value>
            <value>
                <fullName>Closed</fullName>
                <default>false</default>
                <label>Closed</label>
            </value>
        </valueSetDefinition>
    </valueSet>
</CustomField>

Lookup Field

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Account__c</fullName>
    <label>Account</label>
    <type>Lookup</type>
    <referenceTo>Account</referenceTo>
    <relationshipName>RelatedRecords</relationshipName>
    <relationshipLabel>Related Records</relationshipLabel>
</CustomField>

Formula Field (Checkbox result)

NOTE: When comparing Picklist fields in formulas, ALWAYS use ISPICKVAL() function!

<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>IsReady__c</fullName>
    <label>Is Ready</label>
    <type>Checkbox</type>
    <formula>ISPICKVAL(Status__c, "Active")</formula>
    <formulaTreatBlanksAs>BlankAsZero</formulaTreatBlanksAs>
</CustomField>

WRONG (will cause error): Status__c = "Active" CORRECT: ISPICKVAL(Status__c, "Active")

スコア

総合スコア

45/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です