• Natasha Ali
  • NEWBIE
  • 110 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 44
    Questions
  • 20
    Replies
Hi,
We've implemented an API that connects to an external database, which we can search within our Salesforce org. I'm running into an 
Attempt to de-reference a null object error:

User-added image

Here is the Visualforce Page:
<apex:page controller="EDSSearchController">
    <apex:form >
        <apex:pageBlock title="EDS Search">
            Enter search term here: <apex:inputText value="{!searchTerm}"/>
            <apex:commandButton action="{!Search}" value="Search"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

And the Controller:
public class EDSSearchController {

    public String searchTerm { get; set; }
    servicesEdrsEducationGovUkV17.EmployerLookupSoap a;
    EDS_Credentials__c edsCreds;


    public EDSSearchController() {
      edsCreds = EDS_Credentials__c.getValues('Default');
        a = new servicesEdrsEducationGovUkV17.EmployerLookupSoap();
    }

    public String getSearchTerm() {
        return searchTerm;
    }

    public PageReference search() {
        a.ByFreeText(searchTerm, false,'O','',edsCreds.API_Key__c);
        return null;
    }
}

How would I resolve this error?

ANY help is MUCH appreciated!
Many Thanks,
Natasha :)
 
Hi,
I'm trying to create a connection between our Org and a third party system through the SOAP API. Are there any practical examples of this? (I've done the trailheads but they haven't given many practical examples).

I need a button to call the third-party web services through SOAP API, search and retrieve results then populate fields on the salesforce record the button is clicked from.

Can anyone show working practical code which I can amend for us?

Any help is much appreciated!
Many thanks,
Natasha :)
I'm struggling with understanding how I will implement this SOAP API from Salesforce to https://services.edrs.sfa.bis.gov.uk/documentation/WebServices/.

The API will enable a user to search the EDS Database using the following methods:
- ByFreeText
- ByOrganisation
- ByPostcode
- ByStreet
- Fetch

I want to create an interface or something within Salesforce, where the user can search an organisations' name and the API would retrieve information about the org (specifically a URN (ref number)) from the third-party org.

How would I begin this? I've done all the SOAP API trailheads so I have a basic understanding, I just need some guidance on where to begin??

Any help is much appreciated!
Many thanks,
Natasha :)
Hi,
I'm struggling to understand how I would use the SOAP API to connect our Salesforcr org to these web services: https://services.edrs.sfa.bis.gov.uk/documentation/WebServices/
I don't understand how I would be able to use the API after it has been implemented (will there be an app or functionality to perform the methods on a record??)

How would I begin the API? I've done the trailheads on SOAP API already but I'm unsure about how to apply it to this API.

ANY help is MUCH appreciated!
Many Thanks,
Natasha :)
Hi,
I have the following controller which seems fine in terms of syntax but I'm still getting an error? I only added a StageName to the SOQL (the original controller deployed fine without it):
 
public class OpportunityVFController {
    
    public List<Opportunity> opp {get;set;}

    public OpportunityVFController {
        opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, 
        NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, 
                Key_Responsibilities__c, Skills_Required__c, Account.Name, Employer_Name__c,  Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity 
        WHERE (StageName = '1 - Qualifying'or StageName = '2 - Booked for CK' or StageName = '3 - Live'
                or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice') AND (Post_Ad__c = TRUE)];
          }
}

The original deployed one:
public class OpportunityVFController {
    
    public List<Opportunity> opp {get;set;}

    public OpportunityVFController {
        opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, 
        NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, 
                Key_Responsibilities__c, Skills_Required__c, Account.Name, Employer_Name__c,  Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity 
        WHERE (StageName = '2 - Booked for CK' or StageName = '3 - Live'
                or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice') AND (Post_Ad__c = TRUE)];
          }
    
}
Any help is much appreciated!
Many Thanks,
Natasha :)
 
Hi,
I have the following controller and need to add a criteris: AND 
Post_Ad__c = TRUE

How do I go about doing this?
public class OpportunityController {
    
    public List<Opportunity> opp {get;set;}

    public OpportunityController() {
        opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, 
        NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, 
                Key_Responsibilities__c, Skills_Required__c, Account.Name, Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity 
        WHERE (StageName = '2 - Booked for CK' or StageName = '3 - Live'
                or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice')];
          }
}

Any help is much appreciated!
Many Thanks,
Natasha :)
Hi,
I have a trigger in Salesforce which converts Leads into Person Accounts if the 'Company Name' field is Null :
Trigger AutoConvert on Lead (after insert) {
     LeadStatus convertStatus = [
          select MasterLabel
          from LeadStatus
          where IsConverted = true
          limit 1
     ];
     List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();

     for (Lead lead: Trigger.new) {
          if (!lead.isConverted && lead.Company == null) {
               Database.LeadConvert lc = new Database.LeadConvert();
               String oppName = lead.Name;
               
               lc.setLeadId(lead.Id);
               lc.setDoNotCreateOpportunity(true);
               lc.setConvertedStatus(convertStatus.MasterLabel);
               
               leadConverts.add(lc);
          }
     }

     if (!leadConverts.isEmpty()) {
          List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
     }
}

I need to write some test classes to validate and deploy this code and it needs to include any error handling. How would I go about achieving this? 

Any help is much appreciated :)
Many Thanks,
Natasha  
Hi.
I'm stuck on creating a trigger which fires when a status changes on a record on the 'Placement' object (very new to development). Basically I want the trigger to fire and call a HTTP request class when the 'Status' on the Placement object changes from '8 - Offer Accepted' to '9 - Induction Booked'.

How do I start??

Any help is much appreciated! 
Many Thanks,
Natasha 
Hi,
So I'm creating a Salesforce integration through the REST API to connect out org with an external third party software. Essentially the user will change a 'Status' on a custom object record in Salesforce, this would then trigger an API call to get results information from the third party and populate that data in a field on the corresponding record in Salesforce/

How would I go about starting this? What are the different components I need to develop the integration?

Any help is much appreciated!!
Many Thanks,
Natasha
Hi,
We have a custom child object called ‘Placements’ which has a many to one relationship to the parent ‘Account’ (Person Account) object. We currently send out emails to the Account (via a process – used to be a bunch of WF rules) based on a ‘Status’ and ‘X’ amount of days after ‘Start Date’ from the Account object.

We’ve moved the ‘Status’(picklist) and ‘Start Date’(date/time) onto the new Placement object, and need the process to work from the Placement instead of the Account. Each ‘Placement’ is essentially a job. The process works perfectly fine if the Account has only one Placement, but the issue is that many Accounts can have multiple Placements, and emails also get sent to Line Managers (which would be different for each Placement).

The emails are as follows:
WHEN Status = 10 - ‘On Programme’ + Start Date = ‘30/04/19’ THEN
3 days AFTER ‘Start Date’ send “3 Days After email”
10 days AFTER ‘Start Date’ send “10 Days After email”
60 days AFTER ‘Start Date’ send “60 Days After email”
90 days AFTER ‘Start Date’ send “90 Days After email”
100 days AFTER ‘Start Date’ send “100 Days After email” (This goes on for around 25 Emails).

The ‘Placements’ will have the same ‘Start Date’ and the ‘Status’ would change and revert back to ‘10 – On Programme’ but will be different ‘Placements’ on the same ‘Account’.

How would we be able to send out the correct emails at the correct time to the right ‘Placement’ without retroactively sending emails and to the wrong ‘Placement’ (only sends to the most recent 'Placement') from the ‘Placement’?

Any help is much appreciated!
Many Thanks,
Natasha :)
Hi,
I have a simple formula I need help with for a validation rule. The criteria is IF Course__r.Name CONTAINS 'ICT' or 'Maths' or 'English' AND RecordTypeId not equal to ‘0120O000000tbh0QAA’ THEN THE VALIDATION RULE SHOULD FIRE

I've tried a couple ways but to no avail.

Any help is much appreciated :)
Many Thanks,
Natasha 
Hi,

So we will be using an API to connect Salesforce to a third party app and one of the fields shared is Address. In Salesforce, the address is already concatenated (it comes in through a separate web app as Address Line, Address Line 2, City and Postcode). However the third party we want to connect to requires the Address field to be split. Is there some apex or mechnanism that would split the fields? Or anything that needs to be written into the API connections to enable this?

Any help is much appreciated :)
Many Thanks,
Natasha 
Hi,
I'm using the following formula to set a date and time for another field:
DATETIMEVALUE(TEXT(DATEVALUE([Session__c].Course__c.Knowledge_Module_Session_1__c)+266) +” 09:00:00")
Regardless of time changes and time zones, I need to set the time to be 09:00:00 everytime. Is there any way of setting the time as 09:00:00 and forcing it to stay like that?

Many Thanks,
Natasha 
 
Hi,
So I think I need a trigger to populate dates of Sessions.

We have a custom object called 'Sessions' (child). Sessions are created automatically (via a trigger) for a 'Course' (parent). Now depending on the value of the 'Level' field (on the Course) object, a different number of 'Sessions' are created. (There are different types of sessions, I need it to work for 'Knowledge Module Sessions')

Each of these Sessions has dates which are currently filled manually. Every single session occurs weekly (on the same day i.e every Wednesday). I need help creating a formula to calculate these date and populate them (ALL ARE DATETIME FIELD VALUES).
All dates will be populated based on the Session 1 Planned Date, here is the structure it needs to follow:

If Session Name CONTAINS 'Knowledge Module Session 2' then populate 'Session Planned Date' = Session 1 + 7
If Session Name CONTAINS 'Knowledge Module Session 3' then populate 'Session Planned Date' = Session 1 + 14
If
 Session Name CONTAINS 'Knowledge Module Session 4' then populate 'Session Planned Date' = Session 1 + 21
If Session Name CONTAINS 'Knowledge Module Session 5' then populate 'Session Planned Date' = Session 1 + 28
If Session Name CONTAINS 'Knowledge Module Session 6' then populate 'Session Planned Date' = Session 1 + 35
If Session Name CONTAINS 'Knowledge Module Session 7' then populate 'Session Planned Date' = Session 1 + 42
If Session Name CONTAINS 'Knowledge Module Session 8' then populate 'Session Planned Date' = Session 1 + 49
If Session Name CONTAINS 'Knowledge Module Session 9' then populate 'Session Planned Date' = Session 1 + 56
If Session Name CONTAINS 'Knowledge Module Session 10' then populate 'Session Planned Date' = Session 1 + 63
If Session Name CONTAINS 'Knowledge Module Session 11' then populate 'Session Planned Date' = Session 1 + 70
UNTIL SESSION 80.


Any help is MUCH appreciated :)
Thanks,
Natasha 
So we have a custom object called 'Sessions' (child). Sessions are created automatically for a 'Course' (parent). Now depending on the value of the 'Level' field (on the Course) object, a different number of 'Sessions' are created.

Each of these Sessions has dates which are currently filled manually. Every single session occurs weekly (on the same day i.e every Wednesday). I need help creating a formula to calculate these date and populate them (ALL ARE DATETIME FIELD VALUES).
All dates will be populated based on the Session 1 Planned Date, here is the structure it needs to follow:

If Session Name CONTAINS 'Session 2' then populate 'Session Planned Date'Session 1 + 7
If Session Name CONTAINS 'Session 3' then populate 'Session Planned Date' Session 1 + 14
If Session Name CONTAINS 'Session 4' then populate 'Session Planned Date' = Session 1 + 21
If Session Name CONTAINS 'Session 5' then populate 'Session Planned Date'Session 1 + 28
If Session Name CONTAINS 'Session 6' then populate 'Session Planned Date'Session 1 + 35
If Session Name CONTAINS 'Session 7' then populate 'Session Planned Date'Session 1 + 42
If Session Name CONTAINS 'Session 8' then populate 'Session Planned Date'Session 1 + 49
If Session Name CONTAINS 'Session 9' then populate 'Session Planned Date'Session 1 + 56
If Session Name CONTAINS 'Session 10' then populate 'Session Planned Date'Session 1 + 63
If Session Name CONTAINS 'Session 11' then populate 'Session Planned Date'Session 1 + 70
UNTIL SESSION 80.

How would I go about doing this?

Any help is much appreciated :)
Many Thanks,
Natasha 

Hi,
I need to expose certain Salesforce Data to a third party app that doesn't have a ready-made Salesforce integration. I'm going to use REST API to expose the data and this action will be triggered when a status changes. 

Here is the general process of what should happen 
1. User changes status which triggers the API
2. API call made to an external app and Salesforce Data is exposed, ready to be consumed
3. External App consumes data 

I'm struggling to understand what would I need to ask from the third part? and is there anything else I would need to do?

Any help is much appreciated :)
Many Thanks,
Natasha 


 

Hi,
I'm new to development and need to create a trigger which will call an API to GET information from a third party app, then use the data retrieved to update a couple of picklist values in salesforce on the corresponding record. The record's unique identifier is the email address, which it will use to identify which record in the third party app to retrieve the data from.  How would I write the class to call the API and where would I begin with creating the API? I've exhausted the resources and I'm still a little lost. 
The trigger would be on the account object and would run when a picklist value changes (so a record is updated), and I need it to also update 2 picklist values on the record with the values retrieved from the callout. 

Any help is much appreciated,
Many Thanks :)
Natasha 
Hi,
I'm trying to understand and build an API that connects to a third party app where it would retrieve the results of a test the user does and send back results to Salesforce to populate the correct record (based on the email address (the unique identifier) ) with the results. How would I get started with the API callout?
The third party app has their own API documentation, and I recognise that I need to use the following method:
GET api/results/initialAssessment/{userId}/all?page={page}&recordsPerPage={recordsPerPage}
How and where would I begin in establishing this API??

Many Thanks,
Natasha 

 

Hi,
I need some guidance to understand how a certain API will work and the process of making it so.
We have a third party online e-learning app (called bksb) where learners do assessments and we manually input the results on their Salesforce record.
bksb have a bunch of APIs ready to use and I need to know how to make our Salesforce org to retrieve (GET) but also (POST) learner's information.
The process would be:

1. On the Learner's record, a status change would trigger bksb (the third party software) to create an account using the learner's SF information (NAME, DOB, EMAIL ADDRESS).
Using the POST api/users/createUser method

2.  Once the user logs in and completes the assessment, then retrieve the results and pull through to populate fields on the Learners' record in Salesforce.  
Using the GET api/results/initialAssessment/{userId}/all?page={page}&recordsPerPage={recordsPerPage} and GET api/results/diagnosticAssessment/{userId}/all?page={page}&recordsPerPage={recordsPerPage}

How would I go about implementing this? What would I need to do from our Salesforce org side?

ANY help is much appreciated!
Natasha :)

Hi,
I'm quite clueless when it comes to APIs and I need some guidance to understand how a certain API will work and the process of making it so.
So we have a third party online e-learning app (called bksb) where learners do assessments and we manually input the results on the record. They have a bunch of APIs ready to use and I need to know how to make our Salesforce org to retrieve (GET) but also (POST) learner's information.
The process would be:
1.
 On the Learner's record, a status change would trigger bksb (the third party software) to create an account using the learner's SF information (NAME, DOB, EMAIL ADDRESS). Using the POST api/users/createUser method

2.
Once the user logs in and completes the assessment, then retrieve the results and pull through to populate fields on the Learners' record in Salesforce.  Using the GET api/results/initialAssessment/{userId}/all?page={page}&recordsPerPage={recordsPerPage} and 
GET api/results/diagnosticAssessment/{userId}/all?page={page}&recordsPerPage={recordsPerPage}


How would I go about implementing this? What would I need to do from our Salesforce org side?

ANY help is much appreciated!
Natasha :)

Hi,
We've implemented an API that connects to an external database, which we can search within our Salesforce org. I'm running into an 
Attempt to de-reference a null object error:

User-added image

Here is the Visualforce Page:
<apex:page controller="EDSSearchController">
    <apex:form >
        <apex:pageBlock title="EDS Search">
            Enter search term here: <apex:inputText value="{!searchTerm}"/>
            <apex:commandButton action="{!Search}" value="Search"/>
        </apex:pageBlock>
    </apex:form>
</apex:page>

And the Controller:
public class EDSSearchController {

    public String searchTerm { get; set; }
    servicesEdrsEducationGovUkV17.EmployerLookupSoap a;
    EDS_Credentials__c edsCreds;


    public EDSSearchController() {
      edsCreds = EDS_Credentials__c.getValues('Default');
        a = new servicesEdrsEducationGovUkV17.EmployerLookupSoap();
    }

    public String getSearchTerm() {
        return searchTerm;
    }

    public PageReference search() {
        a.ByFreeText(searchTerm, false,'O','',edsCreds.API_Key__c);
        return null;
    }
}

How would I resolve this error?

ANY help is MUCH appreciated!
Many Thanks,
Natasha :)
 
Hi,
I have the following controller which seems fine in terms of syntax but I'm still getting an error? I only added a StageName to the SOQL (the original controller deployed fine without it):
 
public class OpportunityVFController {
    
    public List<Opportunity> opp {get;set;}

    public OpportunityVFController {
        opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, 
        NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, 
                Key_Responsibilities__c, Skills_Required__c, Account.Name, Employer_Name__c,  Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity 
        WHERE (StageName = '1 - Qualifying'or StageName = '2 - Booked for CK' or StageName = '3 - Live'
                or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice') AND (Post_Ad__c = TRUE)];
          }
}

The original deployed one:
public class OpportunityVFController {
    
    public List<Opportunity> opp {get;set;}

    public OpportunityVFController {
        opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, 
        NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, 
                Key_Responsibilities__c, Skills_Required__c, Account.Name, Employer_Name__c,  Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity 
        WHERE (StageName = '2 - Booked for CK' or StageName = '3 - Live'
                or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice') AND (Post_Ad__c = TRUE)];
          }
    
}
Any help is much appreciated!
Many Thanks,
Natasha :)
 
Hi,
I have the following controller and need to add a criteris: AND 
Post_Ad__c = TRUE

How do I go about doing this?
public class OpportunityController {
    
    public List<Opportunity> opp {get;set;}

    public OpportunityController() {
        opp = [SELECT Id, Name, CreatedDate, Pathway__c, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, 
        NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, 
                Key_Responsibilities__c, Skills_Required__c, Account.Name, Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity 
        WHERE (StageName = '2 - Booked for CK' or StageName = '3 - Live'
                or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice')];
          }
}

Any help is much appreciated!
Many Thanks,
Natasha :)
Hi,
I have a trigger in Salesforce which converts Leads into Person Accounts if the 'Company Name' field is Null :
Trigger AutoConvert on Lead (after insert) {
     LeadStatus convertStatus = [
          select MasterLabel
          from LeadStatus
          where IsConverted = true
          limit 1
     ];
     List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();

     for (Lead lead: Trigger.new) {
          if (!lead.isConverted && lead.Company == null) {
               Database.LeadConvert lc = new Database.LeadConvert();
               String oppName = lead.Name;
               
               lc.setLeadId(lead.Id);
               lc.setDoNotCreateOpportunity(true);
               lc.setConvertedStatus(convertStatus.MasterLabel);
               
               leadConverts.add(lc);
          }
     }

     if (!leadConverts.isEmpty()) {
          List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
     }
}

I need to write some test classes to validate and deploy this code and it needs to include any error handling. How would I go about achieving this? 

Any help is much appreciated :)
Many Thanks,
Natasha  
Hi,

So we will be using an API to connect Salesforce to a third party app and one of the fields shared is Address. In Salesforce, the address is already concatenated (it comes in through a separate web app as Address Line, Address Line 2, City and Postcode). However the third party we want to connect to requires the Address field to be split. Is there some apex or mechnanism that would split the fields? Or anything that needs to be written into the API connections to enable this?

Any help is much appreciated :)
Many Thanks,
Natasha 
Hi,
I'm using the following formula to set a date and time for another field:
DATETIMEVALUE(TEXT(DATEVALUE([Session__c].Course__c.Knowledge_Module_Session_1__c)+266) +” 09:00:00")
Regardless of time changes and time zones, I need to set the time to be 09:00:00 everytime. Is there any way of setting the time as 09:00:00 and forcing it to stay like that?

Many Thanks,
Natasha 
 

Hi,
I need to expose certain Salesforce Data to a third party app that doesn't have a ready-made Salesforce integration. I'm going to use REST API to expose the data and this action will be triggered when a status changes. 

Here is the general process of what should happen 
1. User changes status which triggers the API
2. API call made to an external app and Salesforce Data is exposed, ready to be consumed
3. External App consumes data 

I'm struggling to understand what would I need to ask from the third part? and is there anything else I would need to do?

Any help is much appreciated :)
Many Thanks,
Natasha 


 

Hi :)
We have a custom object called ‘Courses’ and is the parent object of another custom object called ‘Sessions’. 'Sessions' are created within Courses and the number of sessions depends on the 'Course Structure'
We have a trigger that creates sessions when the new course is created:

trigger CourseTrigger on Course__c (after insert) {
  if(Trigger.isAfter){
    if(Trigger.isInsert){
      CourseTriggerHandler.createSessionAfterCourseCreated(Trigger.new);  
    }
  }
}

The Trigger Handler:

/*

**   Method & Business Logic:
    1) createSessionAfterCourseCreated: 
      - after new Course is created, create new Session(s) based on the amount of '# of Sessions' in Default Modules.
/*

public with sharing class CourseTriggerHandler {
  
  public static void createSessionAfterCourseCreated(List<Course__c> newList){
    
    Map<Id,Id> mapCourseCourseStructure = new Map<Id,Id>();
    Set<Id> courseStructureIds = new Set<Id>();
    for(Course__c c : newList){
      
      //Store related Course_Structure__c
      courseStructureIds.add(c.Course_Structure__c);
      
    }
    
    // mapCSDM = map of Course Structure => Default Modules
    Map<Id,List<Default_Module__c>> mapCSDM = new Map<Id,List<Default_Module__c>>();
    // mapDefaultModule = map of DefaultModule.ID => Default Modules
    Map<Id,Default_Module__c> mapDefaultModule = new Map<Id,Default_Module__c>();
    for(Default_Module__c dm : [Select Name, Course_Structure__c, Module_Code__c, of_Sessions__c From Default_Module__c Where Course_Structure__c IN:courseStructureIds]){
      
      if(mapCSDM.get(dm.Course_Structure__c) == null) mapCSDM.put(dm.Course_Structure__c, new List<Default_Module__c>());
      mapCSDM.get(dm.Course_Structure__c).add(dm);
      
      mapDefaultModule.put(dm.Id,dm);
    }
    
    // create CourseModule records
    List<Course_Module__c> lstCourseModule2Insert = new List<Course_Module__c>();
    for(Course__c c : newList){
      
      //check in case there are Course Structure without Default Module => continue loop
      if(mapCSDM.get(c.Course_Structure__c) == null) continue;
      
      for(Default_Module__c dm : mapCSDM.get(c.Course_Structure__c)){
        lstCourseModule2Insert.add(new Course_Module__c(Name=dm.Name, Default_Module__c = dm.Id, Course__c = c.Id));
      }
    }
    
    insert lstCourseModule2Insert;
    
    
    // create Session records
    List<Session__c> lstSession2Insert = new List<Session__c>();
    
    for(Course_Module__c cm : lstCourseModule2Insert){
      
      Integer sessionNumber = Integer.valueOf(mapDefaultModule.get(cm.Default_Module__c).of_Sessions__c);
      
      for(integer i=0; i<sessionNumber; i++){
        lstSession2Insert.add(new Session__c(  Name = mapDefaultModule.get(cm.Default_Module__c).Name + ' - Session ' + (i+1),
                            Course__c = cm.Course__c,
                            Default_Module__c = cm.Default_Module__c,
                            Module_Code__c = mapDefaultModule.get(cm.Default_Module__c).Module_Code__c,
                            Course_Module__c = cm.Id
                            ));
      }
    }
    
    // insert new Sessions
    insert lstSession2Insert;
    
    
  }
}
 


The requirement is to auto-populate the session planned dates which are based off the initial Course Start Date and follow the same pattern every time for this Course Structure:

User-added image
To follow this pattern:

User-added image

Any help is much appreciated,
Thaanks :)
Natasha 
 

Hi All,
I'm getting emails about SFDC Expiring Certificate Notifications and I don't understand what I need to do! I've read the recommended article: https://help.salesforce.com/articleView?id=000231048&type=1 but I'm still unsure as to what I have to do! We do have 3rd party APIs and apps such as Zapier and Typeform which connect to Salesforce. 

Any help is much appreciated :) 
Thanks,
Natasha 
Hi All,
I have a validation rule on the contract object which doesn't allow a checkbox to be checked by users until they have completed the required fields. The issue is that some of these fields are picklist values and are very much needed. Here is the rule with the other fields (without the picklist ones):
AND( 
OR( 
ISBLANK (Knowledge__c ), 
ISBLANK(Functional_Skills__c), 
ISBLANK(App_Attendance_Absent__c), 
ISBLANK(App_Attendance_Late__c), 
ISBLANK(App_Attendance_Present__c), 
ISBLANK(App_Attendance_Present_including_Late2__c), 
ISBLANK(How_can_you_improve_your_score__c), 
ISBLANK(Apprentice__c), 
ISBLANK(Career_Options__c), 
ISBLANK(Competency__c), 
ISBLANK(Date_of_last_Review__c), 
ISBLANK(Date_of_this_review__c ), 
ISBLANK(Due_Date_1__c), 
ISBLANK(Due_Date_2__c), 
ISBLANK(Due_Date_3__c), 
ISBLANK(Employer_Representative_Comments__c), 
ISBLANK(English_Diagnostic_Assessment__c), 
ISBLANK(Functional_Skills__c), 
ISBLANK(Health_Safety_E_D_topic__c), 
ISBLANK(How_would_you_score_yourself__c), 
ISBLANK(Issues_or_Concerns__c), 
ISBLANK(LDS_Comments__c), 
ISBLANK(LDS_How_to_improve_score_next_month__c), 
ISBLANK(maths_English__c), 
ISBLANK(maths_Diagnostic_Assessment__c), 
ISBLANK(Overall_Progress_Blue__c), 
ISBLANK(Overall_Progress_Green__c), 
ISBLANK(Overall_Progress_Orange__c), 
ISBLANK(PDP__c), 
ISBLANK(Projects_or_areas_of_work__c), 
ISBLANK(Review_Location__c), 
ISBLANK(Safeguarding_topic__c), 
ISBLANK(Score_for_the_month__c), 
ISBLANK(LDS_Score_for_the_month__c), 
ISBLANK(Target_1__c), 
ISBLANK(Target_2__c), 
ISBLANK(Target_3__c), 
ISBLANK(To_keep_myself_and_others_safe_I_can__c), 
ISBLANK(Work_Attendance_Late__c), 
ISBLANK(Work_Attendance_Sick__c) 
), 
Review_Completed__c = true 
)
Here are the picklist values:
ISBLANK(All_Smart_Targets_met__c),
   ISBLANK(Additional_Support__c),
   ISBLANK(Apprentice_of_the_month__c),
   ISBLANK(Apprenticeship_work__c),
   ISBLANK(At_risk_record_to_be_created_or_updated__c),
   ISBLANK(Do_we_need_to_open_FS_aims__c),
   ISBLANK(Enrichment_sessions__c),
   ISBLANK(For_Whom__c),
   ISBLANK(For_Whom_2__c),
   ISBLANK(For_Whom_3__c),
   ISBLANK(Is_employer_partnerships_input_required__c),
   ISBLANK(Is_the_manager_happy_generally__c),
   ISBLANK(Qualification_Level__c),
   ISBLANK(Reflective_log__c),
   ISBLANK(Target_Type_1__c),
   ISBLANK(Target_Type_2__c),
   ISBLANK(Target_Type_3__c),
   ISBLANK(The_Employer_Reference__c),
   ISBLANK(Upcoming__c),
Thaaaanks :) 

 

Hi, so I have an existing VF page which comes up when the custom button is clicked on the Account object. I've also checked the "Available for Lightning Experience, Lightning Communities, and the mobile app" box.

The page is a Calendar view. Here's the VF code before and after:

<apex:page action="/00U/c">
    <apex:ListViews type="Event"/>
</apex:page>

AFTER:

<apex:page action="/00U/c" lightningStylesheets="true">
    <apex:ListViews type="Event"/>
</apex:page>

It let me save the pages but doesn't work!
Here is the custom link button:
 

https://ldngroup.my.salesforce.com/00U/c?cType=2&md2=41&md0=2017 
It's working perfectly fine in Classic, just not in Lightning.

Any help is much appreciated!!
Thanks,
Natasha
Natasha Ali 
What is the alternative attribute to <apex: enhancedList>?
Hi all,
I'm migrating the SF org over to lightning the following VF page needs to be converted into a lightning component as the <apex: enhancedList> attribute isn't supported. What would be the alternative to it? Or are there any workarounds? 
 
<apex:page lightningStylesheets="true">
<apex:enhancedList type="Activity" height="700" customizable="True"/>
</apex:page>

Thanks
Hi,
I'm unsure how to go about doing this, I have the following VF code which I need as a lightning component as we are migrating over to lightning. Any help is much appreciated!!! Thank you! :)
 
<apex:page lightningStylesheets="true">
<apex:enhancedList type="Activity" height="700" customizable="True"/>
</apex:page>

 
I'm very new to apex and programming, and I've come up with the following trigger, but need a test class in order for it to be deployed. What we essentially want to do is autoconvert the lead into a person account when the company field is blank, (coming in via an external webform).
Here's the trigger:
Trigger AutoConverter on Lead (after insert) {
    LeadStatus convertStatus = [
         select MasterLabel
         from LeadStatus
         where IsConverted = true
         limit 1
    ];
    List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();

    for (Lead lead: Trigger.new) {
         if (!lead.isConverted) {
              Database.LeadConvert lc = new Database.LeadConvert();
              String oppName = lead.Name;
               
              lc.setLeadId(lead.Id);
              lc.setOpportunityName(oppName);
              lc.setConvertedStatus(convertStatus.MasterLabel);
             
              leadConverts.add(lc);
         }
    }
    if (!leadConverts.isEmpty()) {
         List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
    }
}

any help would be MUCH appreciated!! :) 
Hi,
I'm new to apex and code and I can't seem to figure out how to write a test class for the following trigger: 
Trigger AutoConverter on Lead (after insert) {
     LeadStatus convertStatus = [
          select MasterLabel
          from LeadStatus
          where IsConverted = true
          limit 1
     ];
     Lis t<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();

     for (Lead lead: Trigger.new) {
          if (!lead.isConverted && lead.Company == null) {
               Database.LeadConvert lc = new Database.LeadConvert();
               String oppName = lead.Name;
               
               lc.setLeadId(lead.Id);
               lc.setOpportunityName(oppName);
               lc.setConvertedStatus(convertStatus.MasterLabel);
               
               leadConverts.add(lc);
          }
     }

     if (!leadConverts.isEmpty()) {
          List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
     }
}




Here's what I've written so far:
@isTest
private class AutoConverteronLeadTestClass {
static testMethod void validateAutoConverteronLead (after insert) {
     LeadStatus convertStatus = [
          select MasterLabel
          from LeadStatus
          where IsConverted = true
          limit 1
     ];
     List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();

     for (Lead lead: Trigger.new) {
          if (!lead.isConverted && lead.Company == null) {
               Database.LeadConvert lc = new Database.LeadConvert();
               String oppName = lead.Name;
               
               lc.setLeadId(lead.Id);
               lc.setOpportunityName(oppName);
               lc.setConvertedStatus(convertStatus.MasterLabel);
               
               leadConverts.add(lc);
          }
     }

     if (!leadConverts.isEmpty()) {
          List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
     }
}
How do I continue? 

Many thanks!
 
Hello Guys

I have been struggling to find a way on how I can call an external web service via apex  which uses OAUTH via REST services. Basically I am trying to access an API on https://api.envisionme.co.za/v1/docs#oauth. Now they use OAUTH to grant access to make calls such as retrieving jobs, candidates etc. They have set up an app on their side with a client_id and a client_secret. Now based on their doc Im suppose to follow a process: make a login call, get a token etc...

I have absolutely no idea how to do this...how do I set up an apex class that will
  1. Login and get the token
  2. Enable me to make those Http POST, GET etc methods
Because ultimately I wanna have a trigger that will call on it to retrieve the data from that external web service.

I do know a bit of apex but I am a rookie when it comes to integration stuff. Please help if you can.