• mgonzalezbic
  • NEWBIE
  • 20 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
Hi all,

I am creating a VF wizard which will take information from a VFP and dump it into three objects ( Account, Application__c, and Management_Structure__c).

I have a wrapper for the Management_Structure__c that allows me to create a pageblock table with dynamic row adding/deleting. The fields for Account and App objects are pretty standard. 

In my save I have it create the Account, then the application linking to the accountID. Once that is done, I then go to create the Management Structure records, which works properly, but I cannot add the created accountID into the wrapper before save. Accountids does show a ID in the debug log however, I just need to send it into the wrapper here's what the debug log shows:
 
21:04:40.321 (321447984)|USER_DEBUG|[169]|DEBUG|

Accountwrapper:[account=Management_Structure__c:{Account__c=null, Position_Title__c=President, Compensation__c=20000.00, Board_of_Director_Member__c=false}, accountids=001J000001jJpQYIA0, counterWrap=1]



Here is my save code:
 
//Create Management records
  
    list<Management_Structure__c> updateAccountList;
        updateAccountList = new list<Management_Structure__c>();
        if(!accountwrapperList.isEmpty()){
            for(Accountwrapper accountWrapper:accountwrapperList){

             accountid = acct.id;
             accountwrapper.accountids = accountid ; 
             
            system.debug(accountWrapper);
            
            
                updateAccountList.add(accountWrapper.account);
              
            }
        }
         if(!updateAccountList.isEmpty()){
            upsert updateAccountList;
       
        }

my wrapper:
 
public class Accountwrapper{
        public Management_Structure__c account{get;set;}
        public Integer counterWrap{get;set;}
        public id accountids {get;set;}
        
        public Accountwrapper(Management_Structure__c act){
            this.account = act;  
            act.Account__c = accountids; 
        }
    }

 
Afternoon everyone,

So I was wondering how to approach the following situation, i've been on the platform for about a year and a half now and still learning the programming side of things.

We have a custom obj called Employment History ("EH") which looks up to Contacts (since contacts can have many "employment" records). The EH associates to specific accounts that the person has worked for. The lookup field is called Contact_LU__c and the child relationship name for the lookup is Employment_Ownership_Histories.

What I am trying to do is the following:

I made a standard controller using Account with an extension (ExtensionEHReport) which will get the data so I can show it in a VFP.

I am trying to have the controller get the current EH for the account where status = active as a list and then iterate through the list. My problem is setting criteria in for loop for the list. So I have something like the following:
 
Account acct;
 public  List<Employment_History__c>       getEH {get; set;}
 public  List<Employment_History__c>       pastEH {get; set;}

public EHReportExtension(Apexpages.standardcontroller std)
{  
acct = (Account)std.getRecord();

getEH = [SELECT Contact_LU__c FROM Employment_History__c WHERE Account__c = :acct.Id AND Employee_Type__c ='Principal' AND Employee_Status__c = 'Active' ];

for(Employment_History__c a : getEH)
{
PastEH = [SELECT Account__c,Employee_Type__c,Job_Title__c,Employee_Status__c,Contact_Lu__c,
Disclosure_Date__c,of_Shares_Owned__c,of_ownership__c
FROM Employment_History__c WHERE  <I need to set the Contact_LU__c to the value in the list above (getEH).... but it doesn't work> ];
}
Now I tried using maps, but since they're unordered; I feel as if that's not the right approach, but to be honest I am uncertain about maps and sets and how to use them properly anyway. 

Any help you can provide would be awesome. Thanks.
 

Hello SF,

 

I have a object called Employee, this Employee can have position and salaries (both related objects).

 

The hierarchy goes:

 

Employee Object

Position Object  (MD to Employee)

Salary Object (MD to Employee object via Position field, and MD to Employee object via Employee field)

 

Now when im looking at a Employee and click New Salary (related list), their Employee record is pulled into the Employee field. I have a filter on the Position field to pull in the position record as matched to the Employee.... But when I click the lookup, I get no results for the filter, when there is a position for that employee.

 

my filter criteria is:

 

Employee Position: Employee ID EQUALS Employee Salary: Employee ID   for the Employee Position field.

 

Does salesforce know when creating the record to use the value thats placed in the Employee field as a result of clicking the New Salary (in the related list)? If so, what could be wrong with my filter?

 

Thanks in advance.

 

--Matt

Hi all,

I am creating a VF wizard which will take information from a VFP and dump it into three objects ( Account, Application__c, and Management_Structure__c).

I have a wrapper for the Management_Structure__c that allows me to create a pageblock table with dynamic row adding/deleting. The fields for Account and App objects are pretty standard. 

In my save I have it create the Account, then the application linking to the accountID. Once that is done, I then go to create the Management Structure records, which works properly, but I cannot add the created accountID into the wrapper before save. Accountids does show a ID in the debug log however, I just need to send it into the wrapper here's what the debug log shows:
 
21:04:40.321 (321447984)|USER_DEBUG|[169]|DEBUG|

Accountwrapper:[account=Management_Structure__c:{Account__c=null, Position_Title__c=President, Compensation__c=20000.00, Board_of_Director_Member__c=false}, accountids=001J000001jJpQYIA0, counterWrap=1]



Here is my save code:
 
//Create Management records
  
    list<Management_Structure__c> updateAccountList;
        updateAccountList = new list<Management_Structure__c>();
        if(!accountwrapperList.isEmpty()){
            for(Accountwrapper accountWrapper:accountwrapperList){

             accountid = acct.id;
             accountwrapper.accountids = accountid ; 
             
            system.debug(accountWrapper);
            
            
                updateAccountList.add(accountWrapper.account);
              
            }
        }
         if(!updateAccountList.isEmpty()){
            upsert updateAccountList;
       
        }

my wrapper:
 
public class Accountwrapper{
        public Management_Structure__c account{get;set;}
        public Integer counterWrap{get;set;}
        public id accountids {get;set;}
        
        public Accountwrapper(Management_Structure__c act){
            this.account = act;  
            act.Account__c = accountids; 
        }
    }

 
Afternoon everyone,

So I was wondering how to approach the following situation, i've been on the platform for about a year and a half now and still learning the programming side of things.

We have a custom obj called Employment History ("EH") which looks up to Contacts (since contacts can have many "employment" records). The EH associates to specific accounts that the person has worked for. The lookup field is called Contact_LU__c and the child relationship name for the lookup is Employment_Ownership_Histories.

What I am trying to do is the following:

I made a standard controller using Account with an extension (ExtensionEHReport) which will get the data so I can show it in a VFP.

I am trying to have the controller get the current EH for the account where status = active as a list and then iterate through the list. My problem is setting criteria in for loop for the list. So I have something like the following:
 
Account acct;
 public  List<Employment_History__c>       getEH {get; set;}
 public  List<Employment_History__c>       pastEH {get; set;}

public EHReportExtension(Apexpages.standardcontroller std)
{  
acct = (Account)std.getRecord();

getEH = [SELECT Contact_LU__c FROM Employment_History__c WHERE Account__c = :acct.Id AND Employee_Type__c ='Principal' AND Employee_Status__c = 'Active' ];

for(Employment_History__c a : getEH)
{
PastEH = [SELECT Account__c,Employee_Type__c,Job_Title__c,Employee_Status__c,Contact_Lu__c,
Disclosure_Date__c,of_Shares_Owned__c,of_ownership__c
FROM Employment_History__c WHERE  <I need to set the Contact_LU__c to the value in the list above (getEH).... but it doesn't work> ];
}
Now I tried using maps, but since they're unordered; I feel as if that's not the right approach, but to be honest I am uncertain about maps and sets and how to use them properly anyway. 

Any help you can provide would be awesome. Thanks.
 

Hello SF,

 

I have a object called Employee, this Employee can have position and salaries (both related objects).

 

The hierarchy goes:

 

Employee Object

Position Object  (MD to Employee)

Salary Object (MD to Employee object via Position field, and MD to Employee object via Employee field)

 

Now when im looking at a Employee and click New Salary (related list), their Employee record is pulled into the Employee field. I have a filter on the Position field to pull in the position record as matched to the Employee.... But when I click the lookup, I get no results for the filter, when there is a position for that employee.

 

my filter criteria is:

 

Employee Position: Employee ID EQUALS Employee Salary: Employee ID   for the Employee Position field.

 

Does salesforce know when creating the record to use the value thats placed in the Employee field as a result of clicking the New Salary (in the related list)? If so, what could be wrong with my filter?

 

Thanks in advance.

 

--Matt