amtrack / sfdx-browserforce-plugin Goto Github PK
View Code? Open in Web Editor NEWsfdx plugin for browser automation
License: MIT License
sfdx plugin for browser automation
License: MIT License
We no longer need to contact Salesforce to enable PersonAccount
s, but it can't be done via sf
and I can't find a way to do it via API.
lightning/setup/PersonAccountSettings/home
https://help.salesforce.com/s/articleView?id=sf.account_person_enable.htm&type=5
By default, Salesforce does not provide an ability to deploy access entries and in scratch, org users do not have access to Presence Statuses. The only one available is "Offline". It blocks running standard testing and running e2e tests as a real service agent by accepting cases, etc.
As mentioned in the DX@Scale Slack thread, it is worth adding this automation to Browserforce - https://dxatscale.slack.com/archives/CN9N54GF5/p1684482930346419
Some of the flags are unclear in the commands. For instance, sfdx browserforce:plan --help
mentions:
-f
for the definition file, which I think is more relevant for sfdx browserforce:apply
command where a definition file should already exist.-s
flag for the state file, what does the state file accomplish?-o
flag, perhaps it's a typo.After acquiring or changing Salesforce licenses these initially are available only in the production org. To enable new or changed licenses in a sandbox requires to go into the sandbox, navigate to the Company Information page and to press the "Match Production Licenses" button. When using a complex sandbox setup (think DEV+TEST+QA+PREPROD+TRAINING and maybe a second parallel track for application maintenance or multiple/many DEV sandboxes) this can easily lead to sandboxes being forgotten and still working with outdated licenses. This could lead not only to operational problems (due to limits) but also to deployment problems when required licenses are not available in a sandbox.
Provide a command to automate clicking the "Match Production Licenses" button in a sandbox. This would allow to make this process more efficient, this could be scripted and hence would be less prone to human error.
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Delegated Administration groups is one of the most difficult things for us to consistently manage across environments, and it is crucial for user experience. Is there a way to add Delegated Adminstration to this?
Would it be possible to activate the HVS setting within this plugin? Currently, in a scratch org definition file, you can only define the license itself, however, the actual feature doesn't get enabled.
https://help.salesforce.com/articleView?id=hvs_considerations.htm&type=5
"High Velocity Sales can be deployed in scratch orgs, but the settings for the feature can’t be updated through the scratch org definition file. Instead, configure settings directly in the High Velocity Sales app."
Especially in a CI / CD flow that would be great!
UPDATE 12/5/21
The picklist plugin currently supports deletion, activation/deactivation and 'find and replace'. It would be useful to be able to add and update picklist values, as there have been cases where the Metadata API fails to add/update values (e.g. ContractStatus) and the only workaround is browser automation or manual intervention.
We're trying to replace picklist values in the ContractStatus
standard value set, but keep getting "no action necessary" as an output. Is there something we are missing?
Plugin version: 2.5.6
SFDX CLI: 7.99.0
salesforcedx: 51.0.0
Chromium: 91.0.4469.0 (Developer Build) (x86_64)
To replicate:
$ sfdx browserforce:apply -f definition-file.json -u scratchorg
logging in... done
Applying definition file definition-file.json to org scratchorg
[Picklists] retrieving state... done
[Picklists] no action necessary
logging out... done
# definition-file.json
{
"$schema": "https://raw.githubusercontent.com/amtrack/sfdx-browserforce-plugin/master/src/plugins/schema.json",
"settings": {
"picklists": {
"picklistValues": [
{
"metadataType": "StandardValueSet",
"metadataFullName": "ContractStatus",
"value": "In Approval Process",
"newValue": "Pre Creation"
},
{
"metadataType": "StandardValueSet",
"metadataFullName": "ContractStatus",
"value": "Draft",
"newValue": "Queued"
},
{
"metadataType": "StandardValueSet",
"metadataFullName": "ContractStatus",
"value": "Activated",
"absent": false
}
]
}
}
}
l
We need to be able to set the Org currency as the scratch org default, based on our hosting location, defaults to Ireland Euro. So I have created a plugin allowing changing fields on the Company Information section in Setup.
I am struggling with the last part of executing my e2e mocha tests.
When running the command
npm run test:e2e -- --grep "CompanyInformation"
it correctly finds and executes the tests in my file, but comes back with errors.
CompanyInformation
should change currency to "English (Ireland) - EUR":
TypeError: Cannot read properties of null (reading 'toString')
at Context.<anonymous> (src\plugins\company-information\index.e2e-spec.ts:34:58)
at processImmediate (node:internal/timers:476:21)
The .status
and .output
from the spawnSync are null.
Would appreciate pointing me in the right direction to finalise this.
Thanks.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.
mocha
, @types/mocha
)These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/workflows/default.yml
actions/checkout v4
actions/setup-node v4
.github/workflows/preview.yml
actions/checkout v4
actions/setup-node v4
.node-version
node 20
package.json
@mdapi-issues/listmetadata-standardvalueset 2.0.3
@salesforce/sf-plugins-core 4.1.1
p-retry 4.6.2
puppeteer 21.5.1
@salesforce/dev-config 4.1.0
@salesforce/prettier-config 0.0.3
@types/mocha 10.0.4
@types/node 20.9.0
mocha 10.2.0
nyc 15.1.0
oclif 4.0.3
prettier 3.1.0
ts-node 10.9.1
typescript 5.2.2
node >=14.0.0
I am trying to add a picklist value and get the following error message:
ERROR running browserforce:apply: The "url" argument must be of type string. Received undefined
I don't understand which "url" argument the error message is talking about, or what I can do to prevent the problem.
To reproduce, use the following files:
sfdx-project.json
{
"namespace": "",
"sfdcLoginUrl": "https://login.salesforce.com",
"sourceApiVersion": "52.0"
}
config/project-scratch-def.json
{
"country": "US",
"edition": "Developer",
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
}
},
"orgName": "Test",
"adminEmail": "[email protected]"
}
config/project-scratch-browserforce.json
{
"$schema": "https://raw.githubusercontent.com/amtrack/sfdx-browserforce-plugin/master/src/plugins/schema.json",
"settings": {
"security": {
"loginAccessPolicies": {
"administratorsCanLogInAsAnyUser": true
}
},
"picklists": {
"picklistValues": [{
"metadataType": "StandardValueSet",
"metadataFullName": "ForecastCategoryName",
"value": "Most Likely",
"newValue": "Most Likely",
"active": true
}
]
}
}
}
With these files, run the following commands:
$ sfdx force:org:create -s -a scratch -f config/project-scratch-def.json --wait 10
(node:11429) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
Successfully created scratch org: 00D1j000000EP2uECG, username: [email protected]
$ sfdx force:config:set defaultusername=scratch
=== Set Config
Name Value Success
─────────────── ─────── ───────
defaultusername scratch true
$ sfdx browserforce:apply -f config/project-scratch-browserforce.json --targetusername scratch
logging in... done
Applying definition file config/project-scratch-browserforce.json to org [email protected]
[Security] retrieving state... done
[Security] no action necessary
[Picklists] retrieving state... failed
ERROR running browserforce:apply: The "url" argument must be of type string. Received undefined
logging out... done
$
Notice how the security action seems to run fine, whereas the picklist action doesn't.
Is it feasible for this to be added as a plugin?
Since it's unavailable via metadata API it'd be great to be able to create one post scratch org create.
Path: lightning/setup/OrgWideEmailAddresses/home
Hey @amtrack!
Quick question.. I have some unique use cases that I want to automate by applying browserforce. Given these are not as generic as the provided commands here, it is not a good idea to have them public really. How can we port our own settings into your plugin? Only way is to fork the repo and work on our own unique version?
Cheers
I have a use case where I would like to create Scratch Orgs with Opportunity Splits already enabled. I have attempted to follow your instructions in CONTRIBUTING.md. I seem to be having an issue when it comes to trying it out. The suggested command:
./bin/run browserforce:apply -f src/plugins/opportunity-splits/enable.json
results in:
Could not find plugin named 'opportunitySplits' in definition: {"$schema":"../schema.json","settings":{"opportunitySplits":{"enabled":true}}}
I did the yarn command and followed your instructions carefully, so I'm not certain what could be missing.
With the standardvaluesets
feature enabled, there still doesn't seem to be support for updating the ForecastCategoryName field. Below is my config file. I've tried multiple ways:
"$schema": "../schema.json",
"settings": {
"picklists": {
"picklistValues": [
{
"metadataType": "CustomField",
"metadataFullName": "Opportunity.ForecastCategoryName",
"value": "Omitted",
"newValue": "Lost"
}
]
}
}
}
output:
[Picklists] retrieving state... failed ERROR running browserforce:apply: Cannot read property 'id' of undefined
"$schema": "../schema.json",
"settings": {
"picklists": {
"picklistValues": [
{
"metadataType": "StandardValueSet",
"metadataFullName": "ForecastCategoryName",
"value": "Omitted",
"newValue": "Lost"
}
]
}
}
}
output:
[Picklists] retrieving state... failed ERROR running browserforce:apply: The "url" argument must be of type string. Received undefined
In our Salesforce org, frequently large number of records get deleted and then are kept in the Recycle Bin for a while. This negatively affects the performance of our reports and dashboards (according to Salesforce Support). Recommendation from Salesforce Support was to frequently empty the recycle bin if these records are no candidates to be undeleted. We currently have no known way of automating this.
Provide a capability to automatically navigate to the Recycle Bin in LEX /lightning/o/DeleteEvent/home
and press the "Empty Org Recycle Bin" button and automatically confirm the following question.
Hi, would it be possible to add an environment variable to allow users to specify an existing browser to run instead of using Chromium which is packaged with puppeteer?
We have strict access controls on our enterprise laptops where only whitelisted applications can be run, and unfortunately Chromium isn't one of them. I am able to edit the code in browserforce.js to launch my existing Chrome install instead.
If this is possible, please could you suggest directions to writing a plugin for this ?
Hey @amtrack
I've been using "SF to SF activation" when spinning up a new scratch in my CI/CD pipeline. It used to work well, but it started to fail.
In the logs, it never complains: Always getting this success message:
[SalesforceToSalesforce] retrieving state... done
[SalesforceToSalesforce] changing 'enabled' to 'true'... done
However, when trying to push my code which has a dependency on the PartnerNetworkRecordConnection object (which is only available once you activate the SF to SF feature in the target org) it fails saying the object doesn't exist.
And when I go manually check if the feature gets activated in the org, it is not. Apparently something wrong happens behind the scenes. So wanted to raise this as you could debug and tackle maybe?
Hi there,
I am looking into this plugin to import password protected JKS cert into a scratch org. I could turn on the Identity Provider but failed to import the cert.
I get "Cannot read property 'Id' of undefined". This is the config json.
Any input please?
{
"$schema": "https://raw.githubusercontent.com/amtrack/sfdx-browserforce-plugin/v1.2.0/src/plugins/schema.json",
"settings": {
"security": {
"certificateAndKeyManagement": {
"importFromKeystore": [
{
"filePath": "./data/config/certificates/google_cloud.jks",
"name": "google_cloud",
"password": "*****************"
}
]
}
}
}
}
Hi,
Tried looking back and forth the Metadata API docs, scratch org settings and browserforce supported settings in the JSON schema but didn't find any traces of "LinkedIn Sales Navigator" anywhere
Seems like it has 2 types of packages, one "legacy" managed package and one native baked straight in SF by default, which got recently implemented I believe, and searching for keywords in how to enable it programmatically leads to nowhere. I'm talking about this:
Seems like it needs to be enabled manually the same way as the Sales Engagement settings (#375)
If anyone got any clues, please feel free to rescue me out 😭
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.