February 28, 2019
February 25, 2019
Delete records across multiple objects using Apex in Salesforce
Sample Code:
Note:
Don't include child record ids and master records ids if they are strongly coupled( Master Detail Relationship ).
- List < Id > toDeleteIds = new List < Id > { '0WO2M000000mbwnWAA',
- '5002M00000mnEdCQAU',
- '0WO2M000000qewsWAA',
- 'a0k2M000066AYgKQAW'};
- Database.DeleteResult[] deleteResults = Database.delete( toDeleteIds, true );
- for ( Database.DeleteResult dr : deleteResults ) {
- if ( !dr.isSuccess() ) {
- for ( Database.Error err : dr.getErrors() ) {
- System.debug(LoggingLevel.Error, 'The following error has occurred.'
- + '\n' + err.getStatusCode() + ': ' + err.getMessage()
- + '\n fields that affected this error: ' + err.getFields());
- }
- }
- }
Note:
Don't include child record ids and master records ids if they are strongly coupled( Master Detail Relationship ).
February 22, 2019
How to chunk csv file content into smaller using MuleSoft?
Listener Configuration:
File Read Configuration:
Transform Message Configuration:
For Each Configuration:
Transform Message inside For Each Configuration:
Logger Configuration:
Output:
File Read Configuration:
Transform Message Configuration:
For Each Configuration:
Transform Message inside For Each Configuration:
Logger Configuration:
Output:
- INFO 2019-02-17 10:26:50,999 [[MuleRuntime].cpuLight.08: [test].testFlow.CPU_LITE @77f9697c] [event: 0-72a0a750-32c8-11e9-b865-025041000001] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: {
- "message": {
- "Size": 5,
- "Payload is": [
- {
- "A": "Example 1",
- "B": "Sample 1"
- },
- {
- "A": "Example 2",
- "B": "Sample 2"
- },
- {
- "A": "Example 3",
- "B": "Sample 3"
- },
- {
- "A": "Example 4",
- "B": "Sample 4"
- },
- {
- "A": "Example 5",
- "B": "Sample 5"
- }
- ]
- }
- }
- INFO 2019-02-17 10:26:51,014 [[MuleRuntime].cpuLight.06: [test].testFlow.CPU_LITE @77f9697c] [event: 0-72a0a750-32c8-11e9-b865-025041000001] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: {
- "message": {
- "Size": 5,
- "Payload is": [
- {
- "A": "Example 6",
- "B": "Sample 6"
- },
- {
- "A": "Example 7",
- "B": "Sample 7"
- },
- {
- "A": "Example 8",
- "B": "Sample 8"
- },
- {
- "A": "Example 9",
- "B": "Sample 9"
- },
- {
- "A": "Example 10",
- "B": "Sample 10"
- }
- ]
- }
- }
- INFO 2019-02-17 10:26:51,029 [[MuleRuntime].cpuLight.06: [test].testFlow.CPU_LITE @77f9697c] [event: 0-72a0a750-32c8-11e9-b865-025041000001] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: {
- "message": {
- "Size": 5,
- "Payload is": [
- {
- "A": "Example 11",
- "B": "Sample 11"
- },
- {
- "A": "Example 12",
- "B": "Sample 12"
- },
- {
- "A": "Example 13",
- "B": "Sample 13"
- },
- {
- "A": "Example 14",
- "B": "Sample 14"
- },
- {
- "A": "Example 15",
- "B": "Sample 15"
- }
- ]
- }
- }
- INFO 2019-02-17 10:26:51,039 [[MuleRuntime].cpuLight.06: [test].testFlow.CPU_LITE @77f9697c] [event: 0-72a0a750-32c8-11e9-b865-025041000001] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: {
- "message": {
- "Size": 3,
- "Payload is": [
- {
- "A": "Example 16",
- "B": "Sample 16"
- },
- {
- "A": "Example 17",
- "B": "Sample 17"
- },
- {
- "A": "Example 18",
- "B": "Sample 18"
- }
- ]
- }
- }
How to install and set up VS Code for Salesforce?
1. Go to https://code.visualstudio.com. Download the VS Code. Install it. After the installation, open the VS Code.
2. Select Extensions.
3. Search "Salesforce Extensions for VS Code".
4. Install Salesforce Extensions for VS Code.
5. Click Reload to restart the VS Code.
6. Go to https://developer.salesforce.com/tools/sfdxcli.
7. Download Salesforce CLI and install it.
To Create a project, check https://www.infallibletechie.com/2018/09/how-to-create-salesforce-project-in-vs.html
2. Select Extensions.
3. Search "Salesforce Extensions for VS Code".
4. Install Salesforce Extensions for VS Code.
5. Click Reload to restart the VS Code.
6. Go to https://developer.salesforce.com/tools/sfdxcli.
7. Download Salesforce CLI and install it.
To Create a project, check https://www.infallibletechie.com/2018/09/how-to-create-salesforce-project-in-vs.html
February 20, 2019
February 14, 2019
Marketing User API Name in Salesforce
UserPermissionsMarketingUser
Sample SOQL:
SELECT Id, Name FROM User WHERE IsActive = true AND UserPermissionsMarketingUser = true
Sample SOQL:
SELECT Id, Name FROM User WHERE IsActive = true AND UserPermissionsMarketingUser = true
Subscribe to:
Posts (Atom)