• Pascal
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
Map<Id,String> userEmail = new Map<Id, String>{};
    List<User> userList = [SELECT Id, Email FROM User WHERE IsActive = TRUE];
    Map<Id, String> acctMap = new Map<Id, String>{};
    List<Account> acctList = [SELECT Id, Tech_Rep_Mgr__c FROM Account];
    for(User u : userList){
        userEmail.put(u.Id, u.Email);
    }
    for(Account a : acctList){
        acctMap.put(a.Id, a.Tech_Rep_Mgr__c);
    }

Community:

 

I have a requirement that I'm not sure how to go about implementing.  In a nutshell, I want users to edit a campaign if the user's region (a custom field) matches the campaign's region (another custom field).  If there is a match, the edit is allow; otherwise, the edit is not allowed.

 

Should I be overriding the edit functionality with VF/Controller extensions, of is this a case of Apex Sharing?  I don't necessarialy want to hide records, just prevent the editablility of some.

 

Thanks.

  • March 30, 2009
  • Like
  • 0

Trying to write a controller extension that either sends a user to the edit page or the view page of a campaign based on the regions (custom fields) of the campaign and user.  For example, if the user's region equals the campaign's region, then allow the edit.  Otherwise, prevent the edit of the campaign.

 

Here's thde code I have so far.  Just want to do a simple redirect.  There is an override of the Campaign Edit that calls a VF page (with extension shown below) ... on the VF page, I have an action that calls the method on the class:

 

public class CampaignExtension{
    String recordId;
    Campaign campaign;
    public CampaignExtension(ApexPages.StandardController controller) {
        recordId = controller.getId();
        campaign = [select Region__c from campaign where id = :recordId];
    }
   
    public PageReference redirect(){
         
        User user = new User();
        user = [select Region__c from User where id =:UserInfo.getUserId()];
              
        if (user.Region__c == campaign.Region__c){
            return null;
        }
        else{
            return null;
        }
    }
}

  • March 27, 2009
  • Like
  • 0
Live and work in Atlanta area.  Extremely proficient in everything salesforce (admin functionality, customizations, data migration, s-controls).  Have taught classes on same.  Looking to continue to work with product, but can no longer travel (my current job has me on the road too much and for health reasons, I need to limit my time away from home).  I have a "high tech" background.  Also have strong working knowledge of Siebel CRM as well.  I'm well educated (BS and MS in Electrical Engineering).  If you can help somehow, please don't hesitate to respond.  Thanks.

Hi I am fairly new to salesforce as we just rolled it out this year. I just completed the Dev 401 training class and I was wondering what other people who took this class thought of the class, the trainer and the materials they give you.

 

I'll start. The trainer I had was excellent very knowledgeable and had excellent presentation skills. The books however that are supplied I assume by Salesforce are terrible. I mean I could have put these things together. The took the training deck slide presentation and put 2 slides per page. This is something I would expect from a company that has no money or clue how to put together training. I am not a huge fan of Microsoft but at least the books they give you can be used as a reference guide. For $4,000 the books should be 100 times better than a slide deck. 

 

The work book on the other hand is useful but does not make up for the main student guide book.

 

Overall the class is not worth the $4,000 they charge for it. I was very disappointed with the materials and expect better from Salesforce.

 

Thanks,

Matt

 

 

 

Trying to write a controller extension that either sends a user to the edit page or the view page of a campaign based on the regions (custom fields) of the campaign and user.  For example, if the user's region equals the campaign's region, then allow the edit.  Otherwise, prevent the edit of the campaign.

 

Here's thde code I have so far.  Just want to do a simple redirect.  There is an override of the Campaign Edit that calls a VF page (with extension shown below) ... on the VF page, I have an action that calls the method on the class:

 

public class CampaignExtension{
    String recordId;
    Campaign campaign;
    public CampaignExtension(ApexPages.StandardController controller) {
        recordId = controller.getId();
        campaign = [select Region__c from campaign where id = :recordId];
    }
   
    public PageReference redirect(){
         
        User user = new User();
        user = [select Region__c from User where id =:UserInfo.getUserId()];
              
        if (user.Region__c == campaign.Region__c){
            return null;
        }
        else{
            return null;
        }
    }
}

  • March 27, 2009
  • Like
  • 0