• Trevor Viall
  • 30 Points
  • Member since 2020

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
  • 0
So, I'm trying to get product related to opportunity to show up in the same page, but even with an extended controller I can't seem to get it working. 

<apex:page standardController="Opportunity" extensions="PositionsExtends">
    <apex:form >
        <apex:pageBlock title="Edit Opportunity" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            <apex:pageBlockSection title="Opportunity Fields" Columns="1">
                <apex:outputText value="{!Opportunity.Amount}"/>
                <apex:inputField value="{!Opportunity.AccountId}"/>
                <apex:inputField value="{!Opportunity.LeadSource}"/>
                <apex:inputField value="{!Opportunity.CloseDate}"/>
                <apex:inputField value="{!Opportunity.StageName}"/>
                <apex:outputField value="{!ProductList.Name}"/>
                <apex:outputField value="{!ProductList.Opportunity__c}"/>
                <apex:outputField value="{!ProductList.StockKeepingUnit}"/>
                <apex:outputField value="{!ProductList.IsActive}"/>

public class PositionsExtends {
    public List<Product2> ProductList {get;set;}
    public PositionsExtends(apexpages.StandardController stdcontroller) {
        ProductList= [SELECT Name, Opportunity__c, StockKeepingUnit, IsActive FROM Product2 Limit 100];

What am I doing wrong here I am just getting an error saying Unknown property 'OpportunityStandardController.Product2'
So i have a question that i likely very simple but google isnt helping. How do I edit or create new records for a standard object that isnt tabbed. I'm aware I can tab custom objects but this won't work. Really I don't need to tab it I just need to access the records but outside of an apex soql search I can't find a way to access them.
I am trying to create a post that can take in more than one record at a time. I am hitting a bit of a brick wall and was hoping someone could help me with an answer. how would I allow this to take in multiple employee records together.

    public static HttpResponse PostEmployeeCallout(){
        http http = new http ();
        HttpRequest request = new HttpRequest();
        //Set the Endpoint of the Post callout
        //Set the method to be a post callout
        //declairing the header type and the format of the response
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        list <object> employees = (List<Object>) results.get('employees');
        HttpResponse response = http.send(request);       
    public class body{
        String Name {get;set;}
        String hire_Date {get;set;}
        String position {get;set;}
        String email {get;set;}
        Integer phone {get;set;}
        String functional_area {get;set;}
        String Location {get;set;}
        String type {get;set;}
    public body(String Name, String hire_Date, String position, String email, Integer phone, String functional_area, String Location, String type){
        this.name = name;
        this.hire_date = hire_Date;
        this.position = position;
        this.email = email;
        this.phone = phone;
        this.functional_area = functional_area;
        this. location = Location;
        this.type = type;

I'm sure this is a very simple problem, but I'm still fairly new to saleforce and can't seem to find the solution. So I'm trying to compair new records when inserted with all existing records to ensure that the last name values are unique otherwise it won't post the new record. I'm sure that I will have to put this in a before insert trigger but I can seem to figure out how exactly to run the compairson. 
This is probably a fairly simple question but, I am still fairly new. How do I check an object within an object? I am making a trigger on the Account object and one of the requirements is to check the contacts email and phone and compair it with the accounts email and phone. How exactly do I check this information while setting the trigger to account?

snippit of the code:

public with sharing class AccountTriggerHandler {
    public static void afterupdate(Map<Id, Account> oldRecs, list <Account> newrecs){        
        //Checks for changes in account
        Integer task =0;
        for (account a: newrecs){
            if (a.Email__c == (a.Contact__c).Email__c)
            {a.EmailCheck__c = true;
            if (a.Phone == (a.Contact__c).Phone)
            {a.PhoneCheck__c = true;
Within Apex is there a way that I can check who updated a record. Basically a to check see if someone other than the account holder updated a record.