You need to sign in to do that
Don't have an account?
Discover Lightning Actions Trailhead Challenge
1. The Lightning component must be named quickContact (this comes as part of the package, confirmed in picture below)
2. Create a new action with Label Quick Contact and Name Quick_Contact on the Account object that invokes the quickContact component. (confirmed in picture below)
3. Add the appropriate interfaces to the quickContact component. (Hint: there are two.) (used the implements force:lightningquickaction AND the force:hasrecordid on line 1, confirmed in picture below)
4. Add the action to the Account Layout page layout. (added in picture below)
Formula to calculate the number of working days between 2 dates
IF(AND((5 - (CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) < (CASE(MOD( End_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) ),
((( End_Date__c - Start_Date__c ) + 1) < 7)),
((CASE(MOD( End_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) - (5 - (CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)))),
(((FLOOR((( End_Date__c - Start_Date__c ) - (CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0))) / 7)) * 5) +
(CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) +
(CASE(MOD( End_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0))))
The Start Date and End Date fields are custom in the above example and can be replaced as required. If use of a DateTime field is required then the DATEVALUE function will be required.
I also recommend a simple field validation rule is added to check that the End Date is after the Start Date.



This formula seems to work when calculating bt 2 different days. What about taking into account for same day and returns result shoud be a "0"? My result shows a "5" when I entered 9/10/09 and 9/10/09 for both start and end dates. Is there one formula that can include this possiblity?
TY!!
Teacup13

Can't see System.debug() output in installed managed package
Hi,
We have an application that we distribute as a managed package. In the dev org where I created the package, I can see all output from my System.debug() calls in the system log window.
When we install the package in a client's SF org, we can't see any of the System.debug() output. We do see the SF profiling information, but no debug() calls.
I can't find any reference to this in the documentation.
- Is this known behavior?
- Is there some way to enable System.debug() output in a managed package?
thanks for any feedback,
joezaloom




SOQL __r -> not displaying data although adding a temp field in the object displays that data !
When I give a query like this ... I get a response but the last field with 2 relationships does not display anything - only [object Object] [ Am currently just trying in the Developer Console to get my query right ]
Select SA__c.Id, SA__c.Name,
SA__c.SQ__r.Name__c,
SA__c.SQ__r.S__r.Name__c
from SA__c where
SA__c.SQ__r.S__c = 'a0Hi0000009S5jcEAC'
So I checked adding a field like this in the SA object and it gets displayed just fine !!!!

If so...you're right, it is curious that this is not found.
If not, then my first guess is that you need to drop the __c suffix and select the field as such:
If neither of those fits, then would you mind furnishing some additional information:
1. Are you able to execute the query?
2. Are you receiving an error?
3. What is the error you are receiving?
4. Does the query execute successfully but not return any value?
Answering these questions could help with some of the ambiguity of your initial question.
Finally...just a suggestion...there is no need to explicitly name the object that is being queried in the FROM clause when you select fields. So a more simple form of your query would have been a little easier for me to read:
SELECT Id, Name, SQ__r.Name__c, SQ__r.S__r.Name__c FROM SA__c WHERE SQ__R.S__c = 'a0Hi0000009S5jcEAC'

SimpleEmail
I'm currently using the Simple Email API (/services/data/v58.0/actions/standard/emailSimple) for sending emails. I'm passing "emailTemplateId" (Template Id), "recipientId" (ID of a Contact), and setting "logEmailOnSend" to true. However, every time I try to test, I receive the following exception:
"errors": [
{
"statusCode": "UNKNOWN_EXCEPTION",
"message": "An error occurred. Try again, or contact Salesforce Customer Support and provide this error ID: 1057582836-221577 (1125190724)",
"fields": []
}
]
Even when I test with only "emailTemplateId" and "recipientId," the same exception occurs.
I've attempted this with multiple accounts, but the result is the same. When I try with version 57 and lower, I get the following error:
[
{
"statusCode": "UNKNOWN_EXCEPTION",
"message": null,
"fields": []
}
]
I'm not sure what's causing this issue. Could someone please help? Your assistance would be greatly appreciated.
Thank you.




Please follow the workaround given in the below-known issue link.
https://issues.salesforce.com/issue/a028c00000tJBCQ/emailsimple-action-throws-unknown-exception-when-called-from-api-with-logemailonsend-param-as-true-or-emailtemplateid-param-is-present
Please mark it as Best Answer if the above information was helpful.
Thanks.

How to fix vscode error. I was trying to authorize my org but got this error C:\Users\username\AppData\Local\sfdx\client\bin\..\7.209.6-8ba3197\bin\sfdx.cmd"' is not recognized as an internal or external command, operable program or batch file.
C:\Users\username\AppData\Local\sfdx\client\bin\..\7.209.6-8ba3197\bin\sfdx.cmd"' is not recognized as an internal or external command, operable program or batch file
Anyone who have idea on this? Thanks!



As mentioned in https://salesforce.stackexchange.com/questions/355477/sfdx-authorize-an-org-failed-to-run-in-vscode,
1. Verify if salesforce CLI is installed successfully or not. If Salesforce CLI is already installed, check the version number by running the command "sfdx --version" in the terminal. Make sure it is the latest version.
2. Add the path of the Salesforce CLI to the environmental variables.
If updating Salesforce CLI does not fix the issue, try deleting the sfdx folder located at "C:\Users\username\AppData\Local\sfdx" and then reinstalling Salesforce CLI.
If none of the above steps work, try restarting VS Code and your machine.
Related:
https://developer.salesforce.com/forums/?id=9062I000000DKBwQAO
https://github.com/forcedotcom/salesforcedx-vscode/issues/3459
https://github.com/forcedotcom/salesforcedx-vscode/issues/2869
If this information helps, please mark the answer as best. Thank you

I have 2 different errors regarding my Decimal fields. What would be a good solution?
Decimal value = 0;
for (Pay_Element__c payElement : payElements) {
if (payElement.Is_Addition__c && payElement.Car_Allowance__c) {
value += payElement.Value__c;
}
}
return value;
}
Logical operator can only be applied to Boolean is the error I receive for this method.
private Decimal getCarAllowances() {
Decimal value = 0;
for (Pay_Element__c payElement : payElements) {
if (payElement.Is_Addition__c == payElement.Car_Allowance__c) {
value += payElement.Value__c;
}
}
return value;
}
Comparison arguments must be compatible types: Boolean, Decimal is the error I receive for this one.


Try below code
private Decimal getCarAllowances() { Decimal value = 0; for (Pay_Element__c payElement : payElements) { if (payElement.Is_Addition__c == true && payElement.Car_Allowance__c > 0.0) { value += payElement.Value__c; } } return value; }
Please mark it as best answer if it helps
Thanks

Users not receiving email notifications for chatter messages
My Org users stopped receiving email notifications for chatter @metions. Email notifications are working fine earlier. "Chatter email notification setting" are look good. Email deliverability settings also is set to "All emails". Thanks



Can you follow the below steps:
Setup > Chatter > Email Settings > Add your name and email address.
You will receive email verification. After verifying your email address, the issue will be resolved.
If this information helps, please mark the answer as best. Thank you

Is there a way to directly use DML statements to manipulate records? And if not can someone explain why?
I'm aware of using apex to query records, put in a list, use a for loop to change attributes, then update the records in the list.
In my previous life when we needed to do mass updates, we just do an update where statement. Is this possible in Salesforce? And if not, I'd like to know if there is a technical reason behind it. Purely so I can better understand the infrastructure too. I'm currently the only person in the team who has gotten into Salesforce and I'm trying to be able to communicate why we can't or shouldn't do certain things on the platform the same as we do with our custom database. (like have thousands of lines of database logic for automation)



There is no way to directly use DML statements to manipulate records in Salesforce. This is because Salesforce uses a multi-tenant architecture, which means that multiple customers share the same physical infrastructure. This architecture allows Salesforce to provide a scalable and affordable platform for its customers, but it also means that there are certain restrictions on what customers can do.
To perform mass updates in Salesforce, you should use programmatic approaches like Apex (similar to PL/SQL) or declarative tools like Flows. These tools are designed to work within the Salesforce platform's architecture, allowing you to update records in a controlled and efficient manner while respecting the platform's security and governance measures.
- You can perform bulk updates using Salesforce's Bulk API(dataloader), which is designed to handle large volumes of data.
- You can use batch apex which allows you to batch process DML statements. This means that you can group multiple DML statements together and execute them as a single operation. This can significantly improve the performance of mass updates.
- Asynchronous programming allows you to perform DML operations in the background.
Related:
https://salesforce.stackexchange.com/questions/45011/how-do-i-mass-update-my-object
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_insert_update.htm
https://help.salesforce.com/s/articleView?id=sf.performing_mass_updates.htm&type=5
If this information helps, please mark the answer as best. Thank you

Apex trigger on Task
Hi everyone-
I believe I'm coming pretty close to finalizing my apex code. Unfortunately I'm getting a compile error and could use some help. I have included comments within the code to show exactly what I'm trying to accomplish. Can somebody please take a look and see what modifications need to be made?
trigger LastSWDate on Task (before insert, before update) { //To do - If the subject of a completed task contains "SW", put the date of the completed task in the //the "Last_SW_Activity__c" field on the account object //Create a set of related account ID's Set <ID> acctIDs = new Set <ID> (); //For every task, add it's related to account ID to the set for (Task t: Trigger.new){ acctIDs.add(t.accountID); //Create a map to match the task related to ID's with their corresponding account ID's Map<ID, Account> acctMap = new Map<ID, Account> ([Select ID, Last_SW_Activity__c from Account where ID in :acctIDs]); //Create the account object Account acctRec = acctMap.get(t.accountID); //If the account ID isn't null, the subject line starts with "sw", and the task has been marked as completed If (t.accountID =!null && t.subject.indexOf('sw') && t.Status == 'Completed') //Check to see if the Last_SW_Activity__c field is current compared with the latest completed activity If (acctMap.get.(t.accountID).Last_SW_Activity__c < t.endDateTime || acctMap.get(t.accountID).Last_SW_Activity ==null){ //Update the Last_SW_Activity__c field on the account object with the task's end date acctrec.Last_SW_Activity__c = t.endDatetime; } } }
The error I'm getting states "Invalid field endDatetime for SObject Task". It's refering to the last line of code. Does anybody have any idea why it's giving me that error?



t.accountID =!null in your code should be
t.accountID!=null
you had the ! and the = switched.
Please check if you have connected to same DE org where you have done your work in the trailhead.To do this click on" launch your hands on org" and select the DE org or trailhead playground where you have your work and then check challenge.
OR
Go to Trailhead Profile -- settings -- make the DE org which you have worked as default then check the challenge.
Please refer below link how to take challenges in trailhead.
https://force.desk.com/customer/portal/articles/2643793-trailhead-profile-signup-login-faq?b_id=13478
Hope this helps you!
Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya