+ Start a Discussion
Tiffany LeszcynskiTiffany Leszcynski 
I am getting an error in the dev console that my variables (i and n) do not exist. I've compared to other posts and can't seem to find where my error is. Run tests = 0% What am I missing here?
@isTest
private class AddPrimaryContactTest {
    @testSetup static void TestingList() {
        List<Account> acc = new List<Account>();
        for (Integer i=0;i<50;i++); {
            acc.add(new Account(BillingState = 'CA', name = 'Testing ' + i));
        }
        for (Integer n=0;n<50;n++); {
            acc.add(new Account(BillingState = 'NY', name = 'Testing ' + n));
        }
    insert acc;
        Contact con = new Contact();
        con.FirstName = 'First Name';
        con.LastName = 'Last Name';
        insert con;
        String state = 'CA';
    AddPrimaryContact apc = new AddPrimaryContact(con, state);
    test.startTest();
    	system.enqueueJob(apc);
    test.stopTest();
    }
}
AlinaAlina 
trigger visit on Appointment__c (before insert) {
for (Appointment__c  app : Trigger.new){
if ()}
app.error('choose another time ');
      }
   }
}
Best Answer chosen by Alina
Khan AnasKhan Anas (Salesforce Developers) 
Hi Alina,

Greetings to you!

First, create two fields with Time data type, say, Start Working Hours and End Working Hours.
Then use below validation rule:
Start_Working_Hours__c > End_Working_Hours__c

Please refer to the below links which might help you further with the validation rules.

https://trailhead.salesforce.com/en/content/learn/modules/point_click_business_logic/validation_rules

https://help.salesforce.com/articleView?id=fields_useful_field_validation_formulas.htm&type=5 (https://help.salesforce.com/articleView?id=fields_useful_field_validation_formulas.htm&type=5)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Jessica EstradaJessica Estrada 

I've competed all steps in challenge 2 on the Process Automation Specialist Superbadge, but when I check it, an error comes back saying

"Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Both Billing Country and Shipping Country must be populated. Can be US, USA, or United States: []"


Here is the rule I set up. I tested it and it works. Any idea what is going wrong?
User-added image
 

Robin Singh 26Robin Singh 26 
Challenge Not yet complete... here's what's wrong:
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: YROWFNID
Robin Singh 26Robin Singh 26 
Challenge Not yet complete... here's what's wrong:
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: MGCYPHAX
Jennifer boyydJennifer boyyd 
I'm new to einstein analytics and I keep getting the following message in the step 1. I would appreciate if someone could let me know what does the error means and how I need to fix it.

User-added image

and my SAQL Query is below, I'm not sure what is wrong as I'm still trying to learn EA.

q = load "Beattie_Subs";

cancel = group q by ('Churn_Date_Year', 'Churn_Date_Quarter');
cancel = foreach cancel generate cancel.'Churn_Date_Year' + "~~~" + cancel.'Churn_Date_Quarter' as 'ActivityDate_Year~~~ActivityDate_Quarter', count() as 'New Quarter Cancellations';

cancel = group cancel by ('ActivityDate_Year~~~ActivityDate_Quarter');
cancel = foreach cancel generate cancel.'ActivityDate_Year~~~ActivityDate_Quarter' as 'ActivityDate_Year~~~ActivityDate_Quarter', coalesce(sum(cancel.'New Quarter Cancellations'),0) as 'New Quarter Cancellations', coalesce(sum(sum('New Quarter Cancellations')) over ([-1..-1] partition by all order by ('ActivityDate_Year~~~ActivityDate_Quarter')),0) as 'Previous Quarter Cancellations';

sub = group q by ('Subscription_Date_Year', 'Subscription_Date_Quarter');
sub = foreach sub generate sub.'Subscription_Date_Year' + "~~~" + sub.'Subscription_Date_Quarter' as 'ActivityDate_Year~~~ActivityDate_Quarter', count() as 'New Quarter Subcribers';

sub = group sub by ('ActivityDate_Year~~~ActivityDate_Quarter');
sub = foreach sub generate sub.'ActivityDate_Year~~~ActivityDate_Quarter' as 'ActivityDate_Year~~~ActivityDate_Quarter', coalesce(sum(sub.'New Quarter Subcribers'),0) as 'New Quarter Subcribers', coalesce(sum(sum('New Quarter Subcribers')) over ([-1..0] partition by all order by ('ActivityDate_Year~~~ActivityDate_Quarter')),0) as 'Previous Quarter Subcribers';

result = cogroup sub by 'ActivityDate_Year~~~ActivityDate_Quarter' full, cancel by 'ActivityDate_Year~~~ActivityDate_Quarter';
result = foreach result generate coalesce(sub.'ActivityDate_Year~~~ActivityDate_Quarter', cancel.'ActivityDate_Year~~~ActivityDate_Quarter') as 'ActivityDate_Year~~~ActivityDate_Quarter', sum(cancel.'New Quarter Cancellations')/(sum(sub.'New Quarter Subcribers') + sum(sub.'Previous Quarter Subcribers') - sum(cancel.'Previous Quarter Cancellations')) as 'Churn Rate';