2

I needed to create a new Business Process the other day, and I decided to try using a deployment with the metadata api.

After deploying, when I went into the ui, all of the configurations seemed normal at first, but the StageName picklist values avaliable for that Opportunity record type hadn't been update to the new business process. Also, when attempting to add a picklist value to the business process through the ui, it caused the system to gack:

1663773805-3275 (669470794)

I ended up taking the business process out of the deployment and just using the deployment to create the new StageName picklist values. Then I created the new business process through the ui and assigned it to the record type, and everything worked fine.

I am curious though, is it possible to create new (working) Business Processes through a metadata deployment? If anyone has been able to get it to work, can you spot where I went wrong?

Essentially what I deployed was:

./package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>BusinessProcess</name>
    </types>
    <types>
        <members>Opportunity.StageName</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>Opportunity.ExistingRecordType</members>
        <name>RecordType</name>
    </types>
    <version>36.0</version>
</Package>

./objects/Opportunity.object

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <businessProcesses>
        <fullName>NewBusinessProcess</fullName>
        <isActive>true</isActive>
        <values>
            <fullName>NewStage</fullName>
            <default>false</default>
        </values>
        <values>
            <fullName>OldStage</fullName>
            <default>false</default>
        </values>
                     ⋮     (A combination of old and new stage name values)
    </businessProcesses>
    <fields>
        <fullName>StageName</fullName>
        <picklist>
            <picklistValues>
                <fullName>NewStage</fullName>
                <default>false</default>
                <closed>false</closed>
                <forecastCategory>Pipeline</forecastCategory>
                <probability>10</probability>
                <won>false</won>
            </picklistValues>
            <picklistValues>
                <fullName>OldStage</fullName>
                <default>false</default>
                <closed>false</closed>
                <forecastCategory>Pipeline</forecastCategory>
                <probability>20</probability>
                <won>false</won>
            </picklistValues>
                      ⋮     (All old and new stage name values)
            <sorted>false</sorted>
        </picklist>
        <trackFeedHistory>true</trackFeedHistory>
        <trackTrending>false</trackTrending>
        <type>Picklist</type>
    </fields>
    <recordTypes>
        <fullName>ExistingRecordType</fullName>
        <active>true</active>
        <businessProcess>NewBusinessProcess</businessProcess>
        <description>An existing record type getting a new business process.</description>
        <label>Existing Record Type</label>
        <picklistValues>
            (Not StageName)
        </picklistValues>
                ⋮   (Other picklists, not StageName)
    </recordTypes>
</CustomObject>

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.