Teach Me Salesforce

A community approach to learning salesforce.com

Salesforce DX Monoliths: Chipping Away at the Metadata (part 2)

with 4 comments

After carefully removing all the metadata that I do not think I’ll need I got myself to the test of force:source:push again. It seems like I’ll always have to do –forceoverwrite because I always see a conflict with the Business Account record type.

The source:push generated some errors of course. The first two that jump out at me are those related to history-tracked fields:

force-app/main/default/objects/Lead.object-meta.xml The entity: Lead does not have history tracking enabled
N/A The entity: Account does not have history tracking enabled (12:13)

I mistook this for issues with the  true in the object files to accompany the true in the fields’ definitions but it actually appears to be due to true because when I deleted the Record Type History Tracking I was able to avoid the error.

The next error I got seems like it might actually be a bug (I’ll explain after)

N/A Required field is missing: businessProcess (75:18)

Since I’m trying to deploy Leads with a Record Type, you need to have a business process associated with the record type. I did keep the .businessProcess file for this purpose but I noticed that there is no  tag in the Lead’s .recordType file’s XML. I reverted the file back to its original state to make sure I hadn’t inadvertently deleted it. When I added  and the name of the Business Process, that error along with another one that was apparently related was cleared up.

force-app/main/default/permissionsets/My_pSet.permissionset-meta.xml In field: field – no CustomField named Lead.my_field__c found

I’m glad the above error was somehow dependent on fixing the business process because I had no idea why that would be considered missing. Now it seems like it must be due to the compiler’s inability to load the Record Type which defined that picklist’s values for the Record Type.

The next error was coming from the PersonAccounts, which frankly are performing much better than expected given their troublesome history.

force-app/main/default/objects/PersonAccount.object-meta.xml An unknown exception has occurred.

I was able to clear this up by removing  Private from the PersonAccount.object-meta.xml file. I didn’t consider it on my first review but when I was looking at the file now I realized that there is no sharingModel setting for a PersonAccount since it’s not a real object. Account takes care of its sharing model setting.

One error remains!

force-app/main/default/profiles/API.profile-meta.xml invalid cross reference id

The dreaded “invalid cross reference id”! Oh how many times I’ve been stumped by those 4 vague words. I guessed correctly that it’s probably the reference to the PersonAccount.PersonAccount record so I simply deleted it from the profile altogether…and Hooray! I got the metadata to push successfully!

Advertisements

Written by Always Thinkin

January 17, 2018 at 4:38 pm

Posted in Uncategorized

4 Responses

Subscribe to comments with RSS.

  1. I tried to use dx in an huge environment. Created an unmanaged package of one visualforce page and about 50% of the org are in the dependencies. Trying to push that to the scratch org yielded >8000 errors.
    I have no clue how/if integration with dx is even possible here.

    margo

    January 25, 2018 at 2:54 am

    • I hear you, I wouldn’t want to do this on a deadline. I don’t like the idea of breaking up my components into separate packages because I just don’t see enough logical divisions between areas to do it with the ease that Salesforce seems to believe is possible. I could probably divide it between Marketing/Sales/Support but I suspect that even a third of my overall metadata is still going to be unmanageable as a single package. Any more granular than that and it’s really arbitrary; might as well just divided it up into 26 alphabetical categories.

      Always Thinkin

      January 25, 2018 at 2:07 pm

  2. Do you have any clue as to how sfdx remembers components of an object apart from the .object file and the package.xml? In the same project as margo I tried to push only the objects belonging to a VF page, and while I definitely deleted any trace of Validation Rule and List View Sharing, I get errors pertaining to xml Tags that are nowhere to be found inside any of those files. All that while i run sfdx force:mdapi:convert after I prepared the files accordingly. Kinda at wit’s end here.

    dennis

    January 26, 2018 at 8:15 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: