Skip to main content Join the Agentforce Virtual Hackathon to build innovative solutions and compete for a $50k Grand Prize. Sign up now. Terms apply.
Group

Salesforce DX

****What is Salesforce DX?**** Salesforce DX is an entirely new way to manage and develop Salesforce apps across the entire lifecycle, enabling new levels of productivity, collaboration, and control. Whether you're an individual developer or working as part of a large team, Salesforce DX provides you with an integrated, end-to-end lifecycle designed for high-performance agile development. And best of all, we've built it to be open and flexible so you can build together with tools and practices you know and love. With Salesforce DX we are bringing modern software development practices to our customers that is enterprise ready out of the box.

Does anyone know an easy way to identify the org settings and features required for package components? And does anyone have general advice for troubleshooting package version create errors?

 

I've been trying to create an unlocked package with components that require custom campaign influence, and it took a long time for me to figure out that I needed to add the appropriate setting in my definition file (scratch org config file): "campaignSettings: {"enableCampaignInfluence2": true}.

 

I was able to create the first package version successfully, but now I'm getting errors on the version create again. The only thing I changed was adding reports and dashboards based on the CustomizableCampaignInfluence report type, which is a standard report type that gets generated when the custom campaign influence is enabled.

 

"ERROR running force:package:version:create: MultiTouchCampaignAttribution/Campaigns_Responses_Timeline_32e: ReportType: CustomizableCampaignInfluence is not available,MultiTouchCampaignAttribution/Revenue_by_Opportunity_Type_nhZ: ReportType: CustomizableCampaignInfluence is not available,MultiTouchAttributionDashboards/caDFoKVGnLTwriPidsJZVCMKlDyojs: In field: report - no Report named MultiTouchCampaignAttributionReports/Campaigns_Responses_Timeline_32e found,MultiTouchCampaignAttribution/Top_Campaigns_SB1: ReportType: CustomizableCampaignInfluence is not available"

 

Is there another org setting or feature I need to add to the definition file? I can't add this report type to the package because it's standard. I tried adding a custom report type that uses the campaign influence object instead, but that didn't work either.

 

I noticed that when I create a new scratch org with that config file, I can't access campaign influence records until I assign my user the Sales Cloud User or CRM user permision set. I tried including this in that config file,

 

"features": ["SalesUser"] 

 

but that just adds the Sales Cloud User permission set to the org, not assign it to my user. Maybe the package version create fails because no user in the scratch org can access the campaign influence object until that permission set is assigned. Do I need to create a script or something to automate the permission set assignment during the scratch org creation process?

2 comments
  1. Yesterday, 4:23 AM

    Joe, there's a separate community group focused on unlocked packages.  I recommend hopping over there.  I've found great advice there.

0/9000

Hey Team !

 

Help!! I am getting Error: CustomField Not in package.xml when defining custom field in child managed 2gp from a custom object created in parent managed2gp under the same namespace

 

I am not able to install a child managed 2gp version that has a custom field created in a custom object defined in its parent managed 2gp (in the same namespace). Getting Error: CustomField Not in package.xml for that custom field when trying to install the package. Creation of the package (even with validations) does not fail. 

 

Steps to reproduce:  

1-Create a parent 2gp managed package A under namespace nmsp, and create a custom object O. Create a new beta version for this package 

2-Create a child 2gp managed package B. Create dependency between package A and B (we are using cumulusCI), and create in custom object O a field F. The field F will be stored in force-app/main/default/objects/nmsp__O/F__c.xml-meta.... 

4-Create new package version for package B with NO validation skip. Package can be created successfully 

5-Install package version in new scratch org empty. CumulusCI is successfully installing all dependencies, but when trying to install metadata, getting the following errors: 

Error: CustomField Not in package.xml, Details: O__c.F__c: Not in package.xml

 

Does anybody know if I am doing anything wrong here? Can anybody confirm that in package B, the new field should be stored in force-app/main/default/objects/nmsp__O/F__c.xml-meta and not in force-app/main/default/objects/O/F__c.xml-meta ?? For some reason when I try with force-app/main/default/objects/O/F__c.xml-meta it works, but I really do not understand why! The custom object O has been created in package A and not B, therefore if I want to reference it in package B, I need to use the namespace, correct? 

 

Thanks a lot in advance for your support !!

0/9000

We're trying to use data:tree:import. The problem we're having is that we're trying to import records that have a record type. Right now our approach is messy. We have to query the org for a record type, get the ID, and then manually replace all of the references in the data.json files and then we can run our import plan.

 

Is there a way to using just DX commands craft a data plan with records that have a specific record type? Maybe by name?

 

We're trying to get this to work with Health Cloud that ships specific record types we need to leverage.

2 comments
  1. Dec 23, 2024, 3:36 PM

    I noticed the data plan in lwc-recipes supports the concept of saving references and resolving references

     

    The `Account.json` file creates references in the attributes section, like this:

    {

    "Records":[

    {

    "attributes": {

    "type": "Account",

    "referenceId": "AccountRef1"

    },

    "Name": "Alpha Dynamics",

    "Type": "Technology Partner"

    }

    ]

    }

    The `Contacts.json` consumes the references, using an AccountId property assignment like this:

    "AccountId": "@AccountRef1",

    data-plan.json

    [

    {

    "sobject": "Account",

    "saveRefs": true,

    "resolveRefs": false,

    "files": ["Accounts.json"]

    },

    {

    "sobject": "Contact",

    "saveRefs": true,

    "resolveRefs": true,

    "files": ["Contacts.json"]

    }

    ]

    I have not tried this with record types, but will let you know how it goes.

0/9000

I've built a 2GP Package that I am trying to release as a Unlocked Package.

 

I've overcome various validation errors due to missing features or settings in my Scratch Org Definition file. 

 

However my package includes a Sharing Set which depends on the Contact being 'Private' and by default its 'Controlled by Parent', is there a way to define this feature/setting in my Scratch Org Definition File? 

 

@* Experience Cloud * @*Experience Cloud Developers* @Unlocked Packages  @Salesforce DX @* Salesforce Platform *

 

#Salesforce CLI #SFDX CLI #Salesforce Platform #Unlocked Packages #Unmanaged Package #Second Generation Packages #Scratch Org Definition #Experience Cloud #Experience Builder

2 answers
  1. Dec 4, 2024, 2:18 PM

    @Tom Bassett this might help you - https://salesforce.stackexchange.com/questions/218183/sfdx-sharing-settings-scratch-orgs

     

    Is your package ultimately intended for public consumption, or are you just using it internally with your own org(s)?  Deploying sharing-related settings on standard objects can be tricky because the destination org may have valid reasons for how sharing is configured on their standard objects and can't change to support your package.

0/9000

sfdx force:org:create -f config/project-scratch-def.json -s -d 20 -v delia.polocoser@cunning-unicorn-v1tvbw.com

Warning: The force:org:create command is deprecated. Try "org create scratch" or "org create sandbox" instead.

Error (1): A fatal signup error occurred. Please try again. If you still see this error, contact Salesforce Support for assistance

 

Try this:

 

See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_error_codes.htm for information on error code C-9999.

4 answers
0/9000

🚀 New Feature: Async Validation 🚀

 

Unlocked & 2GP Managed Package developers, we're excited to introduce Async Validation on package version creates to speed up your development process!

 

➕ Key Benefits:

 

  • Speed: Get an installable package version quicker than with the default, synchronous process.
  • Efficiency: Start post-package creation steps while validations & Apex tests are in progress.
  • Ease: Easily add this to your CI workflows.

 

💻 How to Use:

Include the --async-validation parameter:

 

sf package version create --async-validation <rest of command syntax>

 

✔️ To check validation status, use the request ID provided by the above command's output:

 

sf package version create report --package-create-request-id 08cxx

 

⏰ When to use: Almost always (unless you have no need to promote the version, in which case, consider using --skip-validation). Seriously. Do you have a reason not to? Let us know!

 

Want more detail? Check out the new Async Validation section of this doc (scroll down).

 

🤔 Feedback? Please let us know in thread 🧵⬇️

14 comments
  1. Oct 30, 2024, 7:12 PM

    Hi @James Quinn, thanks for the followup!

     

    Enabling promotion of package versions using scratch org snapshots would improve package version creation time for our (longer-running) feature packages.

    Below I have attached the package version creation metrics for the same packages as in my previous post, using scratch org snapshots:

     

    core package

    3 dependencies:Hi , thanks for the followup! Enabling promotion of package versions using scratch org snapshots would improve package version creation time for our (longer-running) feature packages.Average: 10.5 minutes, 3 minutes longer than without snapshot due to longer build org provisioning (snapshot orgs have significantly longer provisioning times)

     

    feature package

    Our longest running feature package, having 5 managed package dependencies and 5 unlocked dependencies:Screenshot 2024-10-30 at 19.25.11.pngAverage: 17 min, half the time compared without snapshots

     

    Average feature package creation time using snapshots

    • Initializing take 8 minutes on average
    • Verifying Dependencies takes ≈ 3 minutes
      • Note that there are still dependencies to install as our core packages change too frequently to be included in snapshots
    • Verifying Metadata takes ≈ 1-3 minutes

    Thus, for many of our feature packages, the reduction in verifying dependencies stage is currently not compensating for the increase in build org provisioning stage. The more dependencies a feature package has, the better snapshots improves performance. Thus, for our 50 feature packages, 40% of them yields faster creation times (≈ 4 min) with snapshots. And 10% of these has 10+ min faster creation.

    It could go much faster if snapshot orgs could be pre-provisioned, something I brought up on Rohit's webinar. I recall him stating that they are looking into it, but it's probably not the first priority.

     

    To summarize, being able to promote package versions would certainly help for ≈ 40% of our packages. And I hope this will be supported in the future. If snapshot orgs also could be pre-provisioned the remove/reduce the initialization stage, then that could be a powerful & viable alternative to my feature request for --async-validation

    However, given the current state of snapshots, being able to get a package version within 30 seconds after PR merge (using -skip--validation like functionality), install it in our QA sandbox, execute automated UI & Integration tests and get a production-ready package (asynchronously), all within 12-13 minutes on average, is the fastest and most likely alternative.

     

    Here's the Idea btw.

0/9000

LWC Warning: current engine is vx, but template was compiled with vy error.

Please update your compiled code or LWC engine so that the versions match.

 

We get this error from time to time and can't find anything online related to that. Is there a quick fix? It seems to happen only for 1 component at a time.

And right now it's happening while running unit tests using lwc-jest.

 

Anyone has any idea?

3 answers
0/9000

A few days ago, around 13 Feb I update sfdx cli and it changes on how to create the scratch org to this:

sfdx org create scratch

So I use that command for creating new scratch org for dev, but I notices that after the org ready, there's no more "Salesforce email verification" email that needed to verify my email so the scratch org can send e-mail via Apex.

 

I try to use previous command sfdx force:org:create but the results is no different.

 

Anyone can help? Thank you!

4 answers
0/9000

How do I suppress or reduce the number of status messages `sf project deploy start` writes to the console?

 

Using that command in my pipeline, it will output hundreds of 

Status: In Progress | 2/2 Components | 395/976 Tests 434Status: In Progress | 2/2 Components | 395/976 Tests 435Status: In Progress | 2/2 Components | 395/976 Tests 436

messages in the pipeline output.  Is there a way to suppress those messages or at least increase the intervall from 1/sec to 1/10 secs?

 

I currently use the command with `--concise` and have set SF_USE_PROGRESS_BAR=false.

 

Environment Variables

Configuration Variables

sf project deploy start

0/9000