-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1574 from alexed1/CheckBlankFields
CheckBlankFields
- Loading branch information
Showing
23 changed files
with
305 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status | ||
# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm | ||
# | ||
|
||
package.xml | ||
|
||
# LWC configuration files | ||
**/jsconfig.json | ||
**/.eslintrc.json | ||
|
||
# LWC Jest | ||
**/__tests__/** | ||
**/tsconfig.json | ||
|
||
**/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run precommit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Salesforce DX Project: Next Steps | ||
|
||
Now that you’ve created a Salesforce DX project, what’s next? Here are some documentation resources to get you started. | ||
|
||
## How Do You Plan to Deploy Your Changes? | ||
|
||
Do you want to deploy a set of changes, or create a self-contained application? Choose a [development model](https://developer.salesforce.com/tools/vscode/en/user-guide/development-models). | ||
|
||
## Configure Your Salesforce DX Project | ||
|
||
The `sfdx-project.json` file contains useful configuration information for your project. See [Salesforce DX Project Configuration](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm) in the _Salesforce DX Developer Guide_ for details about this file. | ||
|
||
## Read All About It | ||
|
||
- [Salesforce Extensions Documentation](https://developer.salesforce.com/tools/vscode/) | ||
- [Salesforce CLI Setup Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_intro.htm) | ||
- [Salesforce DX Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_intro.htm) | ||
- [Salesforce CLI Command Reference](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm) |
13 changes: 13 additions & 0 deletions
13
flow_action_components/CheckBlankFields/config/project-scratch-def.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"orgName": "Demo company", | ||
"edition": "Developer", | ||
"features": ["EnableSetPasswordInApi"], | ||
"settings": { | ||
"lightningExperienceSettings": { | ||
"enableS1DesktopEnabled": true | ||
}, | ||
"mobileSettings": { | ||
"enableS1EncryptedStoragePref2": false | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
flow_action_components/CheckBlankFields/force-app/main/default/aura/.eslintrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"plugins": ["@salesforce/eslint-plugin-aura"], | ||
"extends": ["plugin:@salesforce/eslint-plugin-aura/recommended"], | ||
"rules": { | ||
"vars-on-top": "off", | ||
"no-unused-expressions": "off" | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
flow_action_components/CheckBlankFields/force-app/main/default/classes/CheckBlankFields.cls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
public class CheckBlankFields { | ||
|
||
public class Input { | ||
@InvocableVariable(required=true) | ||
public SObject record; | ||
@InvocableVariable(required=true) | ||
public String fieldApiNames; | ||
} | ||
|
||
public class Output { | ||
@InvocableVariable | ||
public String blankFieldsListString; | ||
} | ||
|
||
@InvocableMethod(label='Check Blank Fields') | ||
public static List<Output> checkBlankFields(List<Input> inputList) { | ||
List<Output> outputList = new List<Output>(); | ||
for (Input input : inputList) { | ||
SObject record = input.record; | ||
String fieldApiNames = input.fieldApiNames; | ||
if (record != null && fieldApiNames != null) { | ||
List<String> fieldApiNameList = fieldApiNames.split(','); | ||
List<String> blankFieldsList = new List<String>(); | ||
for (String fieldApiName : fieldApiNameList) { | ||
Schema.SObjectField field = record.getSObjectType().getDescribe().fields.getMap().get(fieldApiName); | ||
if (field != null && (record.get(fieldApiName) == null || String.valueOf(record.get(fieldApiName)).trim() == '')) { | ||
blankFieldsList.add(field.getDescribe().getLabel()); | ||
} | ||
} | ||
Output output = new Output(); | ||
output.blankFieldsListString = String.join(blankFieldsList, ', '); | ||
outputList.add(output); | ||
} | ||
} | ||
return outputList; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
..._components/CheckBlankFields/force-app/main/default/classes/CheckBlankFields.cls-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>61.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
27 changes: 27 additions & 0 deletions
27
...ction_components/CheckBlankFields/force-app/main/default/classes/CheckBlankFieldsTest.cls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@isTest | ||
public class CheckBlankFieldsTest { | ||
|
||
static testMethod void testCheckBlankFields() { | ||
// Create an account with some blank fields | ||
Account acct = new Account(Name='Test Account', Industry=''); | ||
insert acct; | ||
// Update Industry to be blank | ||
acct.Industry = ''; | ||
update acct; | ||
// Create the input object | ||
CheckBlankFields.Input input = new CheckBlankFields.Input(); | ||
input.record = acct; | ||
input.fieldApiNames = 'Industry'; | ||
// Create a list of inputs | ||
List<CheckBlankFields.Input> inputList = new List<CheckBlankFields.Input>(); | ||
inputList.add(input); | ||
// Call the checkBlankFields method | ||
List<CheckBlankFields.Output> outputList = CheckBlankFields.checkBlankFields(inputList); | ||
// Verify the output | ||
System.assertEquals(1, outputList.size()); | ||
CheckBlankFields.Output output = outputList.get(0); | ||
System.assertEquals('Industry', output.blankFieldsListString, 'Expected: Industry, Actual: ' + output.blankFieldsListString); | ||
|
||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
...ponents/CheckBlankFields/force-app/main/default/classes/CheckBlankFieldsTest.cls-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>61.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
14 changes: 14 additions & 0 deletions
14
flow_action_components/CheckBlankFields/force-app/main/default/lwc/.eslintrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": ["@salesforce/eslint-config-lwc/recommended"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.test.js"], | ||
"rules": { | ||
"@lwc/lwc/no-unexpected-wire-adapter-usages": "off" | ||
}, | ||
"env": { | ||
"node": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config'); | ||
|
||
module.exports = { | ||
...jestConfig, | ||
modulePathIgnorePatterns: ['<rootDir>/.localdevserver'] | ||
}; |
36 changes: 36 additions & 0 deletions
36
flow_action_components/CheckBlankFields/manifest/package.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<types> | ||
<members>*</members> | ||
<name>ApexClass</name> | ||
</types> | ||
<types> | ||
<members>*</members> | ||
<name>ApexComponent</name> | ||
</types> | ||
<types> | ||
<members>*</members> | ||
<name>ApexPage</name> | ||
</types> | ||
<types> | ||
<members>*</members> | ||
<name>ApexTestSuite</name> | ||
</types> | ||
<types> | ||
<members>*</members> | ||
<name>ApexTrigger</name> | ||
</types> | ||
<types> | ||
<members>*</members> | ||
<name>AuraDefinitionBundle</name> | ||
</types> | ||
<types> | ||
<members>*</members> | ||
<name>LightningComponentBundle</name> | ||
</types> | ||
<types> | ||
<members>*</members> | ||
<name>StaticResource</name> | ||
</types> | ||
<version>61.0</version> | ||
</Package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "salesforce-app", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "Salesforce App", | ||
"scripts": { | ||
"lint": "eslint **/{aura,lwc}/**/*.js", | ||
"test": "npm run test:unit", | ||
"test:unit": "sfdx-lwc-jest", | ||
"test:unit:watch": "sfdx-lwc-jest --watch", | ||
"test:unit:debug": "sfdx-lwc-jest --debug", | ||
"test:unit:coverage": "sfdx-lwc-jest --coverage", | ||
"prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", | ||
"prettier:verify": "prettier --check \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", | ||
"postinstall": "husky install", | ||
"precommit": "lint-staged" | ||
}, | ||
"devDependencies": { | ||
"@lwc/eslint-plugin-lwc": "^1.1.2", | ||
"@prettier/plugin-xml": "^3.2.2", | ||
"@salesforce/eslint-config-lwc": "^3.2.3", | ||
"@salesforce/eslint-plugin-aura": "^2.0.0", | ||
"@salesforce/eslint-plugin-lightning": "^1.0.0", | ||
"@salesforce/sfdx-lwc-jest": "^3.1.0", | ||
"eslint": "^8.11.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-jest": "^27.6.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^15.1.0", | ||
"prettier": "^3.1.0", | ||
"prettier-plugin-apex": "^2.0.1" | ||
}, | ||
"lint-staged": { | ||
"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ | ||
"prettier --write" | ||
], | ||
"**/{aura,lwc}/**/*.js": [ | ||
"eslint" | ||
] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
flow_action_components/CheckBlankFields/packaging/CreateNewUnlockedPackage.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@echo off | ||
if "%1" neq "" set packageName=%1 | ||
@echo on | ||
sfdx package:create -v lexhost --name "%packageName%" --path force-app --package-type Unlocked |
4 changes: 4 additions & 0 deletions
4
flow_action_components/CheckBlankFields/packaging/CreateNewVersion.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@echo off | ||
if "%1" neq "" set version=%1 | ||
@echo on | ||
sfdx package:version:create -v lexhost -w 20 -x -c -n %version%.0 -d force-app\ |
5 changes: 5 additions & 0 deletions
5
flow_action_components/CheckBlankFields/packaging/Details.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@echo off | ||
if "%1" neq "" set packageName=%1 | ||
if "%2" neq "" set version=%2 | ||
@echo on | ||
sfdx package:version:report -v lexhost --package "%packageName%@%version%" |
5 changes: 5 additions & 0 deletions
5
flow_action_components/CheckBlankFields/packaging/Promote.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@echo off | ||
if "%1" neq "" set packageName=%1 | ||
if "%2" neq "" set version=%2 | ||
@echo on | ||
sfdx package:version:promote -v lexhost --package "%packageName%@%version%" |
9 changes: 9 additions & 0 deletions
9
flow_action_components/CheckBlankFields/packaging/SetPackageName.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@echo off | ||
if "%1" neq "" goto skipprompt | ||
set /p packageName="Set Package Name: " | ||
goto exit | ||
:skipprompt | ||
set packageName=%1 | ||
:exit | ||
echo Package Name: %packageName% | ||
@echo on |
9 changes: 9 additions & 0 deletions
9
flow_action_components/CheckBlankFields/packaging/SetVersion.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@echo off | ||
if "%1" neq "" goto skipprompt | ||
set /p version="Set Version Number: " | ||
goto exit | ||
:skipprompt | ||
set version=%1 | ||
:exit | ||
echo Version: %version% | ||
@echo on |
4 changes: 4 additions & 0 deletions
4
flow_action_components/CheckBlankFields/packaging/ShowVersion.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@echo off | ||
echo Package Name: %packageName% | ||
echo Version: %version% | ||
@echo on |
10 changes: 10 additions & 0 deletions
10
flow_action_components/CheckBlankFields/scripts/apex/hello.apex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Use .apex files to store anonymous Apex. | ||
// You can execute anonymous Apex in VS Code by selecting the | ||
// apex text and running the command: | ||
// SFDX: Execute Anonymous Apex with Currently Selected Text | ||
// You can also execute the entire file by running the command: | ||
// SFDX: Execute Anonymous Apex with Editor Contents | ||
|
||
string tempvar = 'Enter_your_name_here'; | ||
System.debug('Hello World!'); | ||
System.debug('My name is ' + tempvar); |
6 changes: 6 additions & 0 deletions
6
flow_action_components/CheckBlankFields/scripts/soql/account.soql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Use .soql files to store SOQL queries. | ||
// You can execute queries in VS Code by selecting the | ||
// query text and running the command: | ||
// SFDX: Execute SOQL Query with Currently Selected Text | ||
|
||
SELECT Id, Name FROM Account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"packageDirectories": [ | ||
{ | ||
"path": "force-app", | ||
"default": true, | ||
"package": "CheckBlankFields", | ||
"versionName": "ver 0.1", | ||
"versionNumber": "0.1.0.NEXT", | ||
"versionDescription": "" | ||
} | ||
], | ||
"name": "CheckBlankFields", | ||
"namespace": "", | ||
"sfdcLoginUrl": "https://login.salesforce.com", | ||
"sourceApiVersion": "61.0", | ||
"packageAliases": { | ||
"CheckBlankFields": "0Ho5G000000sXuPSAU", | ||
"[email protected]": "04t5G000004fz8BQAQ" | ||
} | ||
} |