• Katie Kourtakis
  • NEWBIE
  • 75 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 13
    Replies
Hi, I have been searching around to see if there is example code for creating a drag-and-drop profile picture using lignthing web components. I came across this link (https://developer.salesforce.com/blogs/developer-relations/2015/11/create-lightning-component-drag-drop-profile-pictures.html) from 2015 which uses aura components. Is this possible with lightning web components now or do I resort to aura components?

Thanks,
Katie
Hello,

I am trying to navigate to a record page when a button is clicked. I receive an error each time saying the page does not exist and to enter a valid url and try again. I tried navigating to a webpage to see if that would work and it did. Based on code examples and documentation I've seen I can't figure out why navigating to a record page is not working properly. 

Some context: My LWC sits on the campaign object and creates a button for each volunteer job that is connected to the campaign. Right now I am just trying to get the button to go to one of the volunteer job record pages. Once I know the navigation works I am going to try and fill the recordId attribute with the recordId associated with each button to direct to the correct volunteer job.

HTML:
<template>
    <lightning-card title="Program Navigation" record-id={recordId}>
        <ul class="slds-button-group-row slds-align_absolute-center">
            <template for:each={data} for:item="program">
                <li key={program.Id} class="slds-button-group-item">
                    <button class="slds-button slds-button_brand" onclick={navigateToVolunteerJob}>
                    {program.Name}</button>
                </li>
            </template>
        </ul>
    </lightning-card>
</template>

JS
import { LightningElement, track, api, wire } from 'lwc';
import getPrograms from '@salesforce/apex/programButtonController.getPrograms';
import { NavigationMixin } from 'lightning/navigation';

export default class ProgramButtons extends NavigationMixin(LightningElement) {
    @track data = [];
    @api recordId;

    @wire(getPrograms, {
        recordId: '$recordId'
    })
    wiredRecord(result) {
        if(result.data) {
            this.data = result.data;
            this.error = undefined;

        } else if (result.error) {
            this.error = 'Unknown error';
            this.data = undefined;
        }

        
    }

//Navigate to recordpage on click
    navigateToVolunteerJob() {
        this[NavigationMixin.Navigate]({
            type: 'standard_recordPage',
            attributes: {
                recordId: 'a0T02000000GoISEA0',
                objectApiName: 'GW_Volunteers__Volunteer_Job__c',
                actionName: 'view'
            }
        });

    }

//test naviagting to webpage
    navigateToWebPage() {
        // Navigate to a URL
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: 'http://salesforce.com'
            }
        },
        true // Replaces the current page in your browser history with the URL
      );
    }
}



Thanks!
Katie 
Hi, I'm trying to create an LWC that displays a datatable of records from a custom obect called Match__c. I want to display the record Id, the participant, and volunteer fields in the datatable where the field volunteer job on the Match record equals the record id of the page being viewed. I created an apex controller to pull the data. The table will not display any data even though I have permissions to the object/fields. On load the console displays "DevTools Failed to Load Source Map". Here are some pictures: 

Apex Controller
User-added imageJS
User-added imageHTML
User-added imageComponent
User-added image
Any help would be appreciated. This is my first LWC.
Hello, I created a scheduled job to run every sunday. The code creates an attendance record for each program participant for each day they are signed up for that week. I tested the code and recieved 85% code coverage. I deployed the code to production and the first sunday it did not run at all. I then scheduled it to run from the scheduled job interface. It ran this past sunday but it did not create any attendances. Any help would be appreciated.

global class createSoulAttendance implements Schedulable {
    
    public static final String CRON_EXP = '0 0 12 ? * SUN';
    global static String scheduleIt() {
        createSoulAttendance job = new createSoulAttendance();
        return System.schedule('Soul Attendance', CRON_EXP, job);
    }
    global void execute(SchedulableContext ctx) {
        
        //Create List to store Program Enrollment Ids
        List<id> enroll = new List<id>();
        
        //Find all attending Soul Participants with Status Confirmed
        for(Program_Enrollment__c enrollId : [SELECT ID FROM Program_Enrollment__c WHERE Campaign__r.Name = 'Soul Studio'
                                              AND Status__c = 'Confirmed']) {
                                                  
                                                  enroll.add(enrollId.Id);
                                              }
        
        
        //Create List to store Volunteer Shift Ids
        List<id> vol = new List<id>();

        //Find Volunteer Shift Ids and add them to the list
        for(GW_Volunteers__Volunteer_Shift__C volId : [SELECT ID FROM GW_Volunteers__Volunteer_Shift__C  WHERE Program__r.Name = 'Soul Studio'AND Shift_Start_Date__c > TODAY 
                       AND Shift_Start_Date__c = NEXT_n_DAYS:7]){
                                                           
                                                          vol.add(volId.Id);
                                                       }
        
        //Create Attendance for each program enrollment
        //Loop through enrollments
        for(Integer i = 0; i < enroll.size(); i++) {
            
            Program_Enrollment__c ProEnroll = new Program_Enrollment__c();
            
            ProEnroll.Id = enroll[i];
            
            //Loop through Volunteer Shifts
            for(Integer j = 0; j < vol.size(); j++) {
                
                GW_Volunteers__Volunteer_Shift__c volunteerShift = new GW_Volunteers__Volunteer_Shift__c();
                
                volunteerShift.Id = vol[j];
                
                //Create attendance for each enrollment
                Attendance__c att = new Attendance__c(Session__c = volunteerShift.Id, Program_Enrollment__c = ProEnroll.Id);
                //Insert Attendance
                insert att;
            }
            
        }
    }

}
Hello, I built a test class and ran it receiving this error message: Required_Field_Missing on line 41 Column 1. GW_Volunteers__Volunter_Job__c

I created a new volunteer job, retrieved the Id of the volunteer job, and set the volunteer job field to the id when creating a new Volunteer Shift. I highlighted the sections in bold.

@isTest
public class createSoulAttendanceTest {

    public static String CRON_EXP = '0 0 0 3 7 ? 2019';
    static testmethod void testScheduledJob() {
        
        //Create Contact
        Contact con = new Contact(Lastname = 'Brown');
        
        insert con;
        
        //Grab contact Id
        Id conId = con.Id;
        
        //Create Campaign
        Campaign soulCam = new Campaign(Name = 'Soul Studio');
        
        insert soulCam;
        
        //Grab Campaign Id
        Id camId = soulCam.Id;
        
        //Create Volunteer Job
        GW_Volunteers__Volunteer_Job__c job = new GW_Volunteers__Volunteer_Job__c(GW_Volunteers__Campaign__c = camID, Name = 'Monday');
        //Grab Volunteer Job ID
        Id jobId = job.Id;

        
        //Set Date/Time for Volunteer Shifts
        DateTime dt = DateTime.now(); 
        
        //Create list to hold all the shifts
        List<Id> allShiftList = new List<Id>();
        
        //Create 7 Volunteer Shifts
        for(Integer i = 0; i < 6; i++) {
            GW_Volunteers__Volunteer_Shift__c shift = new GW_Volunteers__Volunteer_Shift__c(Program__c = camID,                 GW_Volunteers__Volunteer_Job__c = jobId,                                         GW_Volunteers__Start_Date_Time__c = dt.addDays(i),                                                               GW_Volunteers__Duration__c = 5);
            insert shift;
            
            allShiftList.add(shift.Id);
            
        }
        
        //Create New Program Enrollment
        Program_Enrollment__c proEnroll = new Program_Enrollment__c(Campaign__c = camId,
                                                                   Attendee__c = conId,
                                                                   Volunteer_Job__c = jobId,
                                                                   Status__c = 'Confirmed',
                                                                   Role__c = 'Participant',
                                                                   For_All_Sessions__c = FALSE);
        //Retrieve Program Enrollment Id
        Id proId = proEnroll.Id;
        
       Test.startTest();
       String apexJobId = System.schedule('ScheduleApexTest', CRON_EXP, new createSoulAttendance());
       Test.stopTest();
        
       List<Attendance__c> att = [SELECT Id FROM Attendance__c
                                 WHERE Program_Enrollment__c =: proId
                                 AND Date__c >= TODAY 
                                 AND Date__c = NEXT_n_DAYS:7];
        
       System.assertEquals(allShiftList.size(), att.size());
    }
}

Any help in why this error is happening is greatly appreciated!
Hello community, I am attempting to write an apex class that is scheduled to run weekly. The three objects I am dealing with is 'Program Enrollment',  'Volunteer Shift' and 'Attendance'. The Program Enrollment object has a lookup to the campaign, contact, and volunteer job objects. The Attendance object has a lookup to the program enrollment and master-detail to Volunteer shift. I am attempting to create attendance records for each program enrollment I have for the volunteer shifts in the next seven days.
The volunteer shifts are created in advanced. 

Here is my code so far:
global class createAttendance implements Schedulable {
    global void execute(SchedulableContext ctx) {
        
        //Find all attending Participants with Status Confirmed
        Set<Id> enroll = new map<Id, Program_Enrollment__c>([SELECT ID FROM Program_Enrollment__c  WHERE Campaign__c = '7016A000000dWoDQAU' AND Status__c = 'Confirmed']).keySet();
        
        //Find Volunteer Shifts >= Today and < Today + 7
  Set<Id> shift = new Map<Id, GW_Volunteers__Volunteer_Shift__c>([SELECT ID FROM GW_Volunteers__Volunteer_Shift__C WHERE Program__c = '7016A000000dWoDQAU' AND Shift_Start_Date__c >= TODAY AND Shift_Start_Date__c = NEXT_n_DAYS:7]).keySet();

        //Create Attendance for each program enrollment
        //Loop through enrollments
        for(Integer i = 0; i < enroll.size(); i++) {
            //Loop through Volunteer Shifts
            for(Integer j = 0; j < shift.size(); j++) {
                //Create attendance for each enrollment
              
                Attendance__c att = new Attendance__c();
        
                insert att;
            } 
        }
    }
}

In this code block 
Attendance__c att = new Attendance__c();
I need to set the Program enrollment lookup field to the Id I obtained using SOQL. Same for the Volunteer Shift field. I just haven't come across anything to show me how.


Help would be appreciated. Thanks!

                                          
 
Hello, I wrote a trigger to add contacts to a campaign once a rollup field on their associated account is greater than or equal to $1800. I am in the process of writing a test class for my trigger but I always run into a failure when I test. Here is my trigger:

trigger addPatrontoCampaign on Account (after update) {

    //find campaign Id
    List<Campaign> patronCampaign = [SELECT ID 
                                     FROM Campaign 
                                     WHERE Name = 'Patron Circle Member 2019'
                                     LIMIT 1];
    //New Contact List
    List<Contact> householdMembers = new List<Contact>();
    
    //New Campaign members List
    List<CampaignMember> patronMemberstoCreate = new List<CampaignMember>();
    
    //Loop through accounts
    for(Account acct : Trigger.new) {
        
    //Define criteria
        if(acct.Patron_Donation__c >= 1800) {
    
    //find all contacts with same Account ID
            householdMembers = [SELECT ID
                                FROM Contact
                                WHERE AccountID = :acct.ID];
            
    //Loop though found contacts
            for(Contact con : householdMembers) {
                
    //Add each contact to campaign
                patronMemberstoCreate.add(new CampaignMember(CampaignID = patronCampaign[0].ID,
                                                       ContactId = con.ID));
    //Insert
                database.insert(patronMemberstoCreate, false);
            }
        }
    }
}

Here is my test class for when one contact is associated with an account with the patron donation field at $1800. (Should be added to campaign)

@isTest
private class addtoCampaignTest {
    @isTest static void addtoCampaign() {
        //Create new Contact
        Contact con = new Contact();
        con.FirstName = 'Mary';
        con.LastName = 'Potter';
        insert con;
        
        //Create new Account
        Account acc = new Account();
        acc.Name = 'Test Account';
        insert acc;
        
        //Create new Campaign
        Campaign Patron = new Campaign(
        Name= 'Patron Circle Member 2019',
        Status = 'Active'
        );
        insert Patron;
        
        //Associate new account to new contact
        con.AccountId = acc.id;
               
        //Set criteria for trigger to execute
        acc.patron_donation__c = 1800;
        
        System.assertEquals(1, Patron.NumberOfContacts);
              
    }
}

Any help would be appreciated! Thank you
I would like to use a list view button to create a record for all contacts selected. Is this possible with a visualforce page or declarative functions? 

For my case I have two custom objects: Dinner__c and Invitation__c. When my user is on the contact list view I would like them to be able to select all the contacts that they wish to invite to dinner and then press a button to create an Invitation record for all of them. The Invitation record is a junction object connecting the contact with a dinner. My user only needs to edit the dinner lookup field on the invitation object, all other fields would be defaults.

Thanks!
Hello, I am fairly new to developing in Salesforce and am trying to create a form for a custom object and insert the information into the system. I have the form and custom controller created but it will not insert the newly created record into the database. I get the error "attempt to de-reference a null object". Any help would be appreciated.

Visualforce Page

Apex Class

Actual Page
I am seeing this error...'Challange Not yet complete...here's what's wrong: The 'Shift Hours' field on the 'Volunteer Shift' record is not working as expected. I'm stuck as to what I am doing wrong. It's probably a simple fix that I'm over looking. Help solving this problem would be greatly appreciated! Thanks!

User-added image
User-added image
User-added image
I am seeing this error...'Challange Not yet complete...here's what's wrong: The 'Shift Hours' field on the 'Volunteer Shift' record is not working as expected. I'm stuck as to what I am doing wrong. It's probably a simple fix that I'm over looking. Help solving this problem would be greatly appreciated! Thanks!

User-added image
User-added image
User-added image
Hello,

I am trying to navigate to a record page when a button is clicked. I receive an error each time saying the page does not exist and to enter a valid url and try again. I tried navigating to a webpage to see if that would work and it did. Based on code examples and documentation I've seen I can't figure out why navigating to a record page is not working properly. 

Some context: My LWC sits on the campaign object and creates a button for each volunteer job that is connected to the campaign. Right now I am just trying to get the button to go to one of the volunteer job record pages. Once I know the navigation works I am going to try and fill the recordId attribute with the recordId associated with each button to direct to the correct volunteer job.

HTML:
<template>
    <lightning-card title="Program Navigation" record-id={recordId}>
        <ul class="slds-button-group-row slds-align_absolute-center">
            <template for:each={data} for:item="program">
                <li key={program.Id} class="slds-button-group-item">
                    <button class="slds-button slds-button_brand" onclick={navigateToVolunteerJob}>
                    {program.Name}</button>
                </li>
            </template>
        </ul>
    </lightning-card>
</template>

JS
import { LightningElement, track, api, wire } from 'lwc';
import getPrograms from '@salesforce/apex/programButtonController.getPrograms';
import { NavigationMixin } from 'lightning/navigation';

export default class ProgramButtons extends NavigationMixin(LightningElement) {
    @track data = [];
    @api recordId;

    @wire(getPrograms, {
        recordId: '$recordId'
    })
    wiredRecord(result) {
        if(result.data) {
            this.data = result.data;
            this.error = undefined;

        } else if (result.error) {
            this.error = 'Unknown error';
            this.data = undefined;
        }

        
    }

//Navigate to recordpage on click
    navigateToVolunteerJob() {
        this[NavigationMixin.Navigate]({
            type: 'standard_recordPage',
            attributes: {
                recordId: 'a0T02000000GoISEA0',
                objectApiName: 'GW_Volunteers__Volunteer_Job__c',
                actionName: 'view'
            }
        });

    }

//test naviagting to webpage
    navigateToWebPage() {
        // Navigate to a URL
        this[NavigationMixin.Navigate]({
            type: 'standard__webPage',
            attributes: {
                url: 'http://salesforce.com'
            }
        },
        true // Replaces the current page in your browser history with the URL
      );
    }
}



Thanks!
Katie 
Hi, I'm trying to create an LWC that displays a datatable of records from a custom obect called Match__c. I want to display the record Id, the participant, and volunteer fields in the datatable where the field volunteer job on the Match record equals the record id of the page being viewed. I created an apex controller to pull the data. The table will not display any data even though I have permissions to the object/fields. On load the console displays "DevTools Failed to Load Source Map". Here are some pictures: 

Apex Controller
User-added imageJS
User-added imageHTML
User-added imageComponent
User-added image
Any help would be appreciated. This is my first LWC.
Hello, I created a scheduled job to run every sunday. The code creates an attendance record for each program participant for each day they are signed up for that week. I tested the code and recieved 85% code coverage. I deployed the code to production and the first sunday it did not run at all. I then scheduled it to run from the scheduled job interface. It ran this past sunday but it did not create any attendances. Any help would be appreciated.

global class createSoulAttendance implements Schedulable {
    
    public static final String CRON_EXP = '0 0 12 ? * SUN';
    global static String scheduleIt() {
        createSoulAttendance job = new createSoulAttendance();
        return System.schedule('Soul Attendance', CRON_EXP, job);
    }
    global void execute(SchedulableContext ctx) {
        
        //Create List to store Program Enrollment Ids
        List<id> enroll = new List<id>();
        
        //Find all attending Soul Participants with Status Confirmed
        for(Program_Enrollment__c enrollId : [SELECT ID FROM Program_Enrollment__c WHERE Campaign__r.Name = 'Soul Studio'
                                              AND Status__c = 'Confirmed']) {
                                                  
                                                  enroll.add(enrollId.Id);
                                              }
        
        
        //Create List to store Volunteer Shift Ids
        List<id> vol = new List<id>();

        //Find Volunteer Shift Ids and add them to the list
        for(GW_Volunteers__Volunteer_Shift__C volId : [SELECT ID FROM GW_Volunteers__Volunteer_Shift__C  WHERE Program__r.Name = 'Soul Studio'AND Shift_Start_Date__c > TODAY 
                       AND Shift_Start_Date__c = NEXT_n_DAYS:7]){
                                                           
                                                          vol.add(volId.Id);
                                                       }
        
        //Create Attendance for each program enrollment
        //Loop through enrollments
        for(Integer i = 0; i < enroll.size(); i++) {
            
            Program_Enrollment__c ProEnroll = new Program_Enrollment__c();
            
            ProEnroll.Id = enroll[i];
            
            //Loop through Volunteer Shifts
            for(Integer j = 0; j < vol.size(); j++) {
                
                GW_Volunteers__Volunteer_Shift__c volunteerShift = new GW_Volunteers__Volunteer_Shift__c();
                
                volunteerShift.Id = vol[j];
                
                //Create attendance for each enrollment
                Attendance__c att = new Attendance__c(Session__c = volunteerShift.Id, Program_Enrollment__c = ProEnroll.Id);
                //Insert Attendance
                insert att;
            }
            
        }
    }

}
Hello, I built a test class and ran it receiving this error message: Required_Field_Missing on line 41 Column 1. GW_Volunteers__Volunter_Job__c

I created a new volunteer job, retrieved the Id of the volunteer job, and set the volunteer job field to the id when creating a new Volunteer Shift. I highlighted the sections in bold.

@isTest
public class createSoulAttendanceTest {

    public static String CRON_EXP = '0 0 0 3 7 ? 2019';
    static testmethod void testScheduledJob() {
        
        //Create Contact
        Contact con = new Contact(Lastname = 'Brown');
        
        insert con;
        
        //Grab contact Id
        Id conId = con.Id;
        
        //Create Campaign
        Campaign soulCam = new Campaign(Name = 'Soul Studio');
        
        insert soulCam;
        
        //Grab Campaign Id
        Id camId = soulCam.Id;
        
        //Create Volunteer Job
        GW_Volunteers__Volunteer_Job__c job = new GW_Volunteers__Volunteer_Job__c(GW_Volunteers__Campaign__c = camID, Name = 'Monday');
        //Grab Volunteer Job ID
        Id jobId = job.Id;

        
        //Set Date/Time for Volunteer Shifts
        DateTime dt = DateTime.now(); 
        
        //Create list to hold all the shifts
        List<Id> allShiftList = new List<Id>();
        
        //Create 7 Volunteer Shifts
        for(Integer i = 0; i < 6; i++) {
            GW_Volunteers__Volunteer_Shift__c shift = new GW_Volunteers__Volunteer_Shift__c(Program__c = camID,                 GW_Volunteers__Volunteer_Job__c = jobId,                                         GW_Volunteers__Start_Date_Time__c = dt.addDays(i),                                                               GW_Volunteers__Duration__c = 5);
            insert shift;
            
            allShiftList.add(shift.Id);
            
        }
        
        //Create New Program Enrollment
        Program_Enrollment__c proEnroll = new Program_Enrollment__c(Campaign__c = camId,
                                                                   Attendee__c = conId,
                                                                   Volunteer_Job__c = jobId,
                                                                   Status__c = 'Confirmed',
                                                                   Role__c = 'Participant',
                                                                   For_All_Sessions__c = FALSE);
        //Retrieve Program Enrollment Id
        Id proId = proEnroll.Id;
        
       Test.startTest();
       String apexJobId = System.schedule('ScheduleApexTest', CRON_EXP, new createSoulAttendance());
       Test.stopTest();
        
       List<Attendance__c> att = [SELECT Id FROM Attendance__c
                                 WHERE Program_Enrollment__c =: proId
                                 AND Date__c >= TODAY 
                                 AND Date__c = NEXT_n_DAYS:7];
        
       System.assertEquals(allShiftList.size(), att.size());
    }
}

Any help in why this error is happening is greatly appreciated!
Hello, I wrote a trigger to add contacts to a campaign once a rollup field on their associated account is greater than or equal to $1800. I am in the process of writing a test class for my trigger but I always run into a failure when I test. Here is my trigger:

trigger addPatrontoCampaign on Account (after update) {

    //find campaign Id
    List<Campaign> patronCampaign = [SELECT ID 
                                     FROM Campaign 
                                     WHERE Name = 'Patron Circle Member 2019'
                                     LIMIT 1];
    //New Contact List
    List<Contact> householdMembers = new List<Contact>();
    
    //New Campaign members List
    List<CampaignMember> patronMemberstoCreate = new List<CampaignMember>();
    
    //Loop through accounts
    for(Account acct : Trigger.new) {
        
    //Define criteria
        if(acct.Patron_Donation__c >= 1800) {
    
    //find all contacts with same Account ID
            householdMembers = [SELECT ID
                                FROM Contact
                                WHERE AccountID = :acct.ID];
            
    //Loop though found contacts
            for(Contact con : householdMembers) {
                
    //Add each contact to campaign
                patronMemberstoCreate.add(new CampaignMember(CampaignID = patronCampaign[0].ID,
                                                       ContactId = con.ID));
    //Insert
                database.insert(patronMemberstoCreate, false);
            }
        }
    }
}

Here is my test class for when one contact is associated with an account with the patron donation field at $1800. (Should be added to campaign)

@isTest
private class addtoCampaignTest {
    @isTest static void addtoCampaign() {
        //Create new Contact
        Contact con = new Contact();
        con.FirstName = 'Mary';
        con.LastName = 'Potter';
        insert con;
        
        //Create new Account
        Account acc = new Account();
        acc.Name = 'Test Account';
        insert acc;
        
        //Create new Campaign
        Campaign Patron = new Campaign(
        Name= 'Patron Circle Member 2019',
        Status = 'Active'
        );
        insert Patron;
        
        //Associate new account to new contact
        con.AccountId = acc.id;
               
        //Set criteria for trigger to execute
        acc.patron_donation__c = 1800;
        
        System.assertEquals(1, Patron.NumberOfContacts);
              
    }
}

Any help would be appreciated! Thank you
Hello, I am fairly new to developing in Salesforce and am trying to create a form for a custom object and insert the information into the system. I have the form and custom controller created but it will not insert the newly created record into the database. I get the error "attempt to de-reference a null object". Any help would be appreciated.

Visualforce Page

Apex Class

Actual Page
I have tried both, Trailhead Playground and the Developer Edition, but keepp getting this error. Please help.

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: YXJGSSXW
Hello,
 I am working on Security Specialist Superbadge Challenge 4. One of the requirement is 
Field-Level Security—Customer SSN and Bank Account fields on contact records must be encrypted. Any change in the Amount field on opportunity records must be recorded. I cant find Customer SSN and Bank Account fields on Contact Object.