2

So my problem is that I just moved to the company and they want to implement CI in way of work with salesforce. So what we did is promote to Enterprise ( it includes scratch orgs package in it ) and no we start to create proper way of work. But there are some changes on production made in past. Is there any good way od moving them in to package ( cause I am going to enforce package development system as Salesforce advice ) without first deleting them from production ( it woudl cause lose of that.

So question is how to make some of already existing features be part of our packages or how to work with them easy way. I would that starting each scrarch org with manualy impelementing those solutions to it to work on base of that is stupid. Maybe one of you did had similar issue and have some idea for solution.


Update: 01.03.2019

I did find this : Salesforce description of how to do it But i will first test it and then will provide it as answer :) if any one is interested.


Update 05.03.2019

So what i did is:

  1. I did create unmanaged package on my dev hub org so i could use it as dependencie for future packages. It had all of the objects that are already on production included so that i could build on them.
  2. I did create scratch org and since my unmanaged package is dependent from Propel appExchange app i did install both of them on scratch org and developed two random fields on object from appexchange package and my.
  3. Pulled changes ( downloaded layouts and profiles as well but i did remove them )
  4. Then i started creation of test unmanaged package. When i tried to create new version including my changes, I did get error:

Error I did get

My project file looks like that:

{
    "namespace": "",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "sourceApiVersion": "45.0",
    "packageDirectories": [
        {
            "definitionFile": "config/ossurCommonCore.json",
            "package": "amsZeroState",
            "default": true,
            "versionNumber": "0.0.0.NEXT",
            "versionName": "Version 0.0",
            "path": "force-app",
            "dependencies": [
                {
                    "package": "Propel"
                },
                {
                    "package": "amsZeroState"
                }
            ]
        },
        {
            "path": "force-app",
            "package": "amsZeroStateTest1",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT",
            "default": false
        }
    ],
    "packageAliases": {
        "Propel": "04t1S000000XzOQQA0",
        "amsZeroState": "---",
        "amsZeroStateTest1": "----"
    }
}

If any one know why it doesn't see objects from dependencies let me know. If i will find anything will let you know guys.


06.03.2019

I found out that package might not be generated if you have wrong order of elements in xml file. I will provide you with order that worked for me:

{
    "sourceApiVersion": "45.0",
    "sfdcLoginUrl": "https://login.salesforce.com",
    "namespace": "",
    "packageDirectories": [
        {
            "definitionFile": "config/ossurCommonCore.json",
            "package": "amsZeroStateTest1",
            "default": true,
            "versionNumber": "0.0.0.NEXT",
            "dependencies": [
                {
                    "package": "Propel",
                    "subscriberPackageVersionId":"04t1S000000XzOQQA0"
                },
                {
                    "package": "amsZeroState",
                    "subscriberPackageVersionId":"---"
                }
            ],
            "versionName": "Version 0.0",
            "path": "force-app"
        },
        {
            "path": "force-app",
            "package": "amsZeroStateTest1",
            "versionName": "ver 0.1",
            "versionNumber": "0.1.0.NEXT",
            "default": false
        }
    ],
    "packageAliases": {
        "Propel": "---",
        "amsZeroState": "---",
        "amsZeroStateTest1": "---"
    }
}

06.03.2019

After I have created package i have one problem. I can't install package build on the one from production ( the unmanaged package made from elements of production ) on nay sandbox even though they are copies of production. It always says there is no depnded package. But if i will try to install it on sandbox i get error cause elements of that package already exist ... How to go with that?

0

So the whole problem can be solved like that:

Get meta data from production. Convert them to format that SFDX and scratch orgs like and use. Now create package and new version of it. Now if you will install it on sandbox the metadata in sandbox will get included in package and no data will be changed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.