You need to sign in to do that
Don't have an account?
Einstein Analytics and Discovery Insights Specialist Challenge 3: How do I calculate subscriber attrition cost?
The dashboard designer tells me there is an error in my Attrition Cost step
Warning! Analytics encountered a problem with this step [Attrition_Cost_1]. Input stream not found
My SAQL query is this:
beattieSubscribers = load "Beattie_Subs"; tenuredSubscribers = filter beattieSubscribers by{{row(Tenure_Length_1.selection,[0],["min","max"]).asRange ("Tenure")}}; churnedSubscribers = filter tenuredSubscribers by 'Churn' == "Yes"; attrCost = churnedSubscribers * 950.00;
What am I missing?

Trailhead Recommendations?
I registered with trailhead.
I’m an SDR looking to expand my Salesforce skill set. Let’s pretend I have none. Particularly looking for the basics around reporting, and any other trails that may be beneficial to spend some time with.
My goal is to have a competent understanding of SF to build my sales as I enter a closing role and the relevant tools in SF that will help me gain an advantage.
Thanks in advance!

Below are few trailhead links, hope it helps:)
https://trailhead.salesforce.com/en/content/learn/modules/sales_admin_sales_reports_for_lex
https://trailhead.salesforce.com/en/content/learn/modules/sales-activity-analysis

Custom button to generate the PDF and send it as email
When custom button in detail page of custom object is clicked i'm generating the PDF . I want to send the generated PDF as email. Can we do this...?
Can anyone help me over here.
Thanks in advance.

Use below code.
-- JavaScript --
{!requireScript("/soap/ajax/16.0/connection.js")} {!requireScript("/soap/ajax/16.0/apex.js")} var a = sforce.apex.execute("SendEmail","emailPdf",{localId:"{!Application__c.Id}"});
-- Apex Class Method --
public void SendEmail(Id localId){ Application__c inv = [Select Id, name From Application__c Where Id=:localId]; PageReference pdf = Page.PDFpage;// Replace PdfOfInvoice with your Page which render as PDF. pdf.getParameters().put('id', localId); // Blob b = pdf.getContentAsPDF(); Blob b; if (Test.IsRunningTest()){b=Blob.valueOf('UNIT.TEST');}else{b = pdf.getContentAsPDF();} // Create Attachment Object to attach with Email Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); efa.setFileName(inv.Name+'.pdf'); efa.setBody(b); // Define the email Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); // Sets the paramaters of the email email.setSubject('PDF of Invoice - '+inv.Name); email.setToAddresses( new List<String>{inv.Email__c} ); //email.setbccAddresses( new List<String>{'admin@gmail.com'} ); email.sethtmlBody('Hi '+inv.Name+',<br/><br/> ' +'Please find the attached Invoice.' +'<br/><br/>'+'Thanks,'+'<br/>' +UserInfo.getName()+'<br/>' +UserInfo.getOrganizationName()); email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); try{ Messaging.SendEmailResult [] result = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); }catch(System.Exception e){ }Let me know if this helps :)
Thanks,
Amit Singh

validation rule on Salutation & Gender
I need to make a validation rule on salutation and gender.
The rule should be like this:
If the salutation is Dr. or Prof. then a gender (Male or Female) must be filled in.
I've already tried some validation rules but non of them worked.
Could someone help me with it ?
Thank you.

Try the below Validation Rule,
AND(
OR( ISPICKVAL(Salutation, "Dr.") ,
ISPICKVAL(Salutation, "Prof.")),
ISBLANK(TEXT(Gender__c)) )
Thanks,
Maharajan.C
Custom Lookup on Product Object doesn't show any record
I have created a new Lookup field on standard Prdoduct object which points to one of my custom objects. Field has been created successfully but when I'm trying to set a value by clicking the magnifying glass the popup doesn't show any records of my Custom object.
As suggested in some other posts I checked for Search settings in Setup > Customize > Search > Search Settings. Custom objects has been enabled for enhance search at there. Can anyone help me to figure out what is going on please?
Thanks,
Madhura

Generally, look up fields picks and displays recently viewed records and that is the reason it won't display list of parent records. you can do following things:
1. Try searching with any keyword , it should display records with keywords.
2. if above doesnot works, check for filters enabled on lookup field. it conflicts sometimes.
Error in Insert Assigned Resource for Test Code
I'm doing a trigger that is triggered from the Assigned Resource. The trigger works in the UI, however, I'm having an issue with the Test Code.
I receive an error:
FIELD_CUSTOM_VALIDATION_EXCEPTION, Cannot change status from New to Scheduled: []
Now, if i do the same from the UI, there is no error regarding the status change. The status change is allowed in the FSL administration. I can assign using the dispatcher console - all good. And I can mimic the process i'm using in the test code in the UI (editing the SA directly) with out error.
Wondering if any one has seen this error before?
Code is included below:
@isTest static void test_AssignedResource_Insert() { List<AssignedResource> toInsert = new List<AssignedResource>(); //retrieve a service resource List<ServiceResource> listSR = new List<ServiceResource>([SELECT Id, Name FROM ServiceResource WHERE Name = 'Technician One']); ServiceResource sr1 = listSR[0]; // retrieve the Service Appointment created by test data List<WorkOrder> workOrders = new List<WorkOrder>([SELECT Id FROM WorkOrder WHERE Subject ='Test Subject1']); List<Id> woIds = new List<Id>(); for (WorkOrder wo : workOrders ) { woIds.add(wo.Id); } if (woIds.size() > 0 ) { List<ServiceAppointment> appts = new List<ServiceAppointment> (); appts = [SELECT Id FROM ServiceAppointment WHERE Work_Order__c IN :woIds]; //for all the appts - should be one - create an assigned resource if(appts.size()>0) { for( ServiceAppointment sa : appts ) { sa.SchedStartTime = datetime.newInstance(2019, 4, 19, 11, 00, 0); sa.SchedEndTime = datetime.newInstance(2019, 4, 19, 11, 30, 0); AssignedResource ar = new AssignedResource(ServiceAppointmentId=sa.Id,ServiceResourceId=sr1.Id); toInsert.add(ar); } update appts; insert toInsert; List<ServiceAppointment> assignedSA = new List<ServiceAppointment>([SELECT Id,Technician_Name__c FROM ServiceAppointment WHERE Work_Order__c IN :woIds]); System.assertEquals(assignedSA.size(), 1); System.assertEquals(assignedSA[0].Technician_Name__c,sr1.Name); } else { } } else { //exception System.assertNotEquals(woIds.size(), 0); } }the error occurs on the insert of the assigned resources
insert toInsert;IF i change the code such that I manually do the status change in the code example:
sa.SchedStartTime = datetime.newInstance(2019, 4, 19, 11, 00, 0); sa.SchedEndTime = datetime.newInstance(2019, 4, 19, 11, 30, 0); sa.Status = 'Scheduled';the error is returned for the update of the service appointments.
update appts;
Feed back greatly appreciated.
Andrew

So i discovered what the issue is and hopefully my explanation makes sense. (or is 100% correctly explained).
With the FSL managed package, apparently the status transitions are retained in an object which lurks in the darkness of the back end and are not directly available. I would suspect that the system logic is something like "if I can find a object record that explicitly states the transition is allowed, then allow the transition, otherwise return an error "not allowed".
So these transitions exist as an object (not a system setting) and you need to use the SeeAllData tag in the test class.
@istest (SeeAllData=true)The side effect of this is that I had to remove the @testsetup method I was using and move all my test data creation to a test helper class
@testSetup static void setupTestRecords() { //removed - not compatiable with SeeAllData
Hope this helps others in their coding adventures.
Regards
Andrew
When i tried to instal LWC local development server in my Mac system i am getting below error. could please guide me to fix this issue
Polling for new version(s) to become available on npm... done
HTTPError: Response code 403 (Forbidden)
Code: ERR_NON_2XX_3XX_RESPONSE

Now i have installed LWC local development server in my mac system. I feel issue with salesforce server.
HI Vikalp Nagar, Can you please try now.
sfdx.cmd is not recognized as an internal or external command
'"C:\Users\Desja\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.
>>> Why is it trying to run sfdx from that folder? It's not in that folder!
In this folder: C:\Users\Desja\AppData\Local\sfdx\client I have two sub-folders, "bin" and "7.209.6-8ba3197", the 2nd of which appears to have been created on 9/5/23 (just 2 days ago). The "bin" folder contains 2 files: sf.cmd and sfdx.cmd, while the "7.209.6-8ba3197" folder contains a "bin" folder, which contains a single file named "node.exe"
CLI has become a very valuable tool for me as I support 19 nearly identical orgs for the chapters of a national non-profit that works for the homeless. I have no idea why it has stopped working so mysteriously.
I have been through several existing messages on here that all seem to point to the PATH environment variable. The correct folder is present in my path, but the error message indicates it's trying to run sfdx from that other folder named 7.209.6-8ba3197\bin -- why?
Thank you for any clues to help resolve this.


https://github.com/forcedotcom/cli/issues/2447

How to add Custom Objects to an App after creation of the objects?
Hi,
I am following the book "Developement with the Force.com platform" by JasonOuelette.
When creating the Custom Objects, I did not check the box to be visible in a tab, and so I could not add this object to the Custom App I was creating. Now I have a created fields and relationships in the custom object. How do I add this Object to the Custom App?
thanks
Svidya



It looks you havent create custom Tabs while defining custom objects first you need to create custom Tab for new objects Creating Tab Setup -->App Set up---> Create---> Tabs Click on new Tab [drop down shows all untabed objects ] select your object, set Tab style , click Next select profiles Save Adding To App Setup -->App Set up---> Create---> Apps Click on edit, edit available tab section Save Done Thanks, Bala
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
1. After filtering the beattieSubscribers for Tenure and Churn, I need to group these.
and then,
2. I needed to generate the attrition cost for each subscriber in the group, and assign the value using "as" syntax, instead of just equals: