• TobyKutler
  • NEWBIE
  • 144 Points
  • Member since 2020
  • Salesforce Developer
  • Salesforce

  • Chatter
    Feed
  • 4
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 57
    Replies
User-added image
I cannot choose from any other users in my org other than me. According to this documentation (https://help.salesforce.com/s/articleView?id=sf.pipeline_inspection_considerations.htm&type=5) the User can see other users below them in the hierarchy. I am at the top of the hierarchy but still see no users. Does anyone have any idea what else could be causing it?
public static void maxSalaryOFPositions(string position){
    List<Employee__c> existingEmployees = [SELECT Id, Name, Position__c, Salary__c FROM Employee__c];
     integer MaxSalary= existingEmployees[0].Salary__c;
    for(Employee__c emp:existingEmployees){
        
        if((emp.Position__c==position)&&(emp[1].Salary__c>MaxSalary)){
            MaxSalary=emp[1].Salary__c;
        }
        
    }system.debug('The max salary of'+position+ 'and its salary is'+MaxSalary);
        
   
       
}

pls help me with my code and here is my code. am getting 2 errors as illegal assignemnt from Decimal to integer and Expression must be list type:Employee__c
 

Hi Community, 
 

I'm new to developing and I'm keen to learn the best way to compare two collections for future use on a trigger or method. 

For example for an investigation into org missing data if I wanted to compare Leads and Accounts to check which Leads had matching email addresses with Accounts but other personal information was diffrerent. 

At the moment I only know how to do this with two for loops but there must be a better way? possibly using maps or a map and list?

Account[] personalAccounts = [SELECT Id, FirstName, LastName, Phone, PersonMobilePhone, PersonEmail, EmployerCode__c, DOB__c FROM Account WHERE LastName != null AND PersonEmail != null AND DOB__c != null];

Lead[] leads = [SELECT Id, FirstName, LastName, Phone, MobilePhone, Email, Employer_Code__c, DOB__c FROM Lead WHERE Email != null AND DOB__c != null];

Sudo code

for Leads {
  for Accounts {
   If (Lead.email == Account.PersonalEmail && Lead.DOB__c != Account.DOB__c && Lead.EmployerCode__c != Account.EmployerCode__c etc )

  cleanUpMap.put(Lead.Id, Account.Id);

}
}

Appreciate the help, sorry for the terrible code. 

Hi everonye,

I have a requirement where I've to use Country field as multi-select of countries which will be saved as a comma separated list. I display this field on the screen flow. Could anyone help on this "how to achieve multi-select field of countries which will be saved as a comma separated list.


Thanks in advance!
Good afternoon all,

I'm trying to create a countup timer. I need a timer that counts the seconds, minutes, and hours while working within an object. When the object is closed it should save the time spent... when it is reopened the clock countup should start where it was left off. I would need an override button to cease all counting.

Thank you,
-Adam
public PageReference redirectToOpportunity(){
        String opportunityId = getId();
        system.debug('in go back to opportunity apex' + opportunityId); 
        return new PageReference('/lightning/r/Opportunity/'+opportunityId+'/view');
    }

The above code works perfectly fine in Chrome but does not redirect when using Firefox. I get the following logs when testing in firefox: 

User-added image 

Hello, 

 

I need help with a IF formula. I am attempting to calculate the number of times a patron has participated in an activity within our organization. 

 

Right now I am using the formula below to calculate how many people within a report have donated since joining. 

 

IF(Group_Roster__c.eGroup_Join_Date__c > Contact.npo02__FirstCloseDate__c, 0, 1)

 

This formula is working. However I want to take it a step further by also calculating how many people have given, served at an event. Basically I am trying to combine two IF formulas together but I keep getting an error saying there are too many IF functions. 

IF(Group_Roster__c.eGroup_Join_Date__c < Contact.npo02__FirstCloseDate__c,0, 1)IF(Group_Roster__c.eGroup_Join_Date__c < Contact.GW_Volunteers__First_Volunteer_Date__c,0, 1)

Is it possible to combine two IF functions and if not is there another way I can do this? I am trying to calculate the number of people who took an additional step of participating within our organization after joining.

Any advice woud be appreciated!


 
I have one LWC component in it I have Layout which consists of three layout items
1.layout item=checkbox
2.layout item =Text
3.layout item =button
 
Now I want to select this checkbox when I click anywhere in that layout.
<apex:page sidebar="false" showHeader="false" standardController="Account">
    <apex:pageBlock title="Registration">
    <apex:pageBlockSection title="Related Info" columns="1">
        <apex:outputField value="{!Account.Name}"/> 
    </apex:pageBlockSection> 
    <apex:pageBlockSection title="Related Info" columns="1">
        <apex:relatedList list="Cases"/>
    </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
Hello,
I  have a LWC component which shows list of records . I am fetching the records from apex with WIRE decorator if a case staus is 'New'. Now if I change the status to New to Close , I still can see the data. I have to manually  refresh the data to make it disappear. I want as soon I change the status from new to close at that time the LWC should auto refresh. 
Please help me on this. Thanks in advance.
P.S. - I am updating the status from Case's standard UI.
I have three objects 
Contract
Order
Order Line Items
----------------------------------------

Order is lookup to Contract
Order Line Item is lookup with Order

--------------------------------------------------

Need to do an automation that,
First order will be dispatched on the upcoming Wednesday. Every order after that will be dispatched on Wednesday, a month after the first order.
Contract object is having a picklist field having value Paused and Canceled.

Thanks 
 

Hello Folks,

I want to design a custom button such that when user click on that custom button, a drop down should appear with list of emeil template, followed by editable Email Body and recipient name. Finally, clocking on Send button in dropdown, Email will be sent to recipient. How to perform this tak? Using Trigger or Lightning Flows? Plz Suggest.

I have a requirement to make the Case object's ContactId field to Null when the owner of the case changes. Understand that the contactId is populated by salesforce standard process based on the case owner. But is there anyway i can achieve this.?

Tried calling a Queueable class to update case record on Case After update trigger, but it still did not work when the owner is community user.
Please suggest. below is the Queueable class called from case after update trigger context. (used after update context even though update is on same object, tried before update and could see ContactId was getting updated back to case owner)
 
public class CaseContactUpdateQueueable implements Queueable {
    private Map<Id,Case> newMap;
    public CaseContactUpdateQueueable(Map<Id,Case> newMap) {
        this.newMap = newMap;
    }
    public void execute(QueueableContext context) {
        List<Case> caseList = new List<Case>();

        for(Case cs:newMap.values()){
           if(cs.ContactId != null)){
               caseList.add(new Case(Id = cs.Id,ContactId = null));
            }
        }

        update caseList;
    }
}

 
create 2 custom objects main Object & Copy Object then create 3 custom fields in both the objects 1-month picklist 2price fiend 3 name  field & then  there is no relation between in both the object & the condition is if we create record in the copy object the when the batch run then record is  already insert in the main object ?????? please help me to figger in out with this problem 

First, see the below example that I have taken from trailhead modules.

public class AnimalsCallouts {
 
    public static HttpResponse makePostCallout() {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        request.setBody('{"name":"mighty moose"}');
        HttpResponse response = http.send(request);
        // Parse the JSON response
        if(response.getStatusCode() != 201) {
            System.debug('The status code returned was not expected: ' +
                response.getStatusCode() + ' ' + response.getStatus());
        } else {
            System.debug(response.getBody());
        }
        return response;
    }        
}
@isTest
global class AnimalsHttpCalloutMock implements HttpCalloutMock {
    // Implement this interface method
    global HTTPResponse respond(HTTPRequest request) {
        // Create a fake response
        HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animals": ["majestic badger", "fluffy bunny", "scary bear", "chicken", "mighty moose"]}');
        response.setStatusCode(200);
        return response; 
    }
}
@isTest 
static void testPostCallout() {
    // Set mock callout class 
    Test.setMock(HttpCalloutMock.class, new AnimalsHttpCalloutMock()); 
    // This causes a fake response to be sent
    // from the class that implements HttpCalloutMock. 
    HttpResponse response = AnimalsCallouts.makePostCallout();
    // Verify that the response received contains fake values
    String contentType = response.getHeader('Content-Type');
    System.assert(contentType == 'application/json');
    String actualValue = response.getBody();
    System.debug(response.getBody());
    String expectedValue = '{"animals": ["majestic badger", "fluffy bunny", "scary bear", "chicken", "mighty moose"]}';
    System.assertEquals(expectedValue, actualValue);
    System.assertEquals(200, response.getStatusCode());
}

Here in the above case, we are faking our response in Mock class so whenever the test class method is going to call our apex class we are going to receive a mocked response which we going to put in assertion with our expected response. 

In our project, apex classes contain a future method with the return type as void (actually they are getting called by triggers to post something externally whenever a record is created in salesforce). So in that case, is there a way to receive a fake response in test class when my apex class methods return nothing? (Assume below as my project classes)

public class AnimalsCallouts {
 
    public static void makePostCallout() {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint(...);
        request.setMethod('POST');
        request.setBody(...);
        HttpResponse response = http.send(request);
        if(response.getStatusCode() != 201) {
            System.debug('...');
        } else {
            System.debug('...');
        }
    }        
}
@isTest
global class AnimalsHttpCalloutMock implements HttpCalloutMock {
    global HTTPResponse respond(HTTPRequest request) {
        ....
        ....
        return response; 
    }
}
@isTest 
static void testPostCallout() {
    Test.setMock(HttpCalloutMock.class, new AnimalsHttpCalloutMock()); 
    HttpResponse response = AnimalsCallouts.makePostCallout(); (i can't recieve this inside a variable because method is returning nothing.)
    String actualValue = response.getBody();
    String expectedValue = '....';
    System.assertEquals(expectedValue, actualValue);
}
Hi,

How i can check on controller if page is opened using 'Salesforce Classic' or 'Salesforce lightning' UI(for winter 16 release).

Thanks,
Kanwalpreet Singh