• Aneesha
  • NEWBIE
  • 130 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 38
    Replies
Trying to do what the title says. Class:

public class AccountTeamChecker {
    private ApexPages.StandardController sc;
    public AccountTeamChecker(ApexPages.StandardController sc) {
        this.sc = sc;
    }
    // Returns true if the user is an account team member
    public Boolean renderELEMENT{
        get {
            if (renderELEMENT== null) {
                renderELEMENT= [
                        select count()
                        from AccountTeamMember
                        where AccountId = :sc.getId()
                        and UserId = :UserInfo.getUserId()
                        and AccountAccessLevel in ('Read', 'Edit', 'All')
                        ] > 0;
            }
            return renderELEMENT;
        }
        private set;
    }
}

VF Page:

<apex:page standardController="Account" extensions="AccountTeamChecker" rendered="!renderELEMENT">
 
  <apex:pageBlock title="Rendering">
    RENDERED!
  </apex:pageBlock>
</apex:page>

Do not even get any queries rows on my debug logs. What's not firing? thanks!
Hello, 

I have a WordPress website and I am using Gravity Forms with the plugin called "Gravity Forms Salesforce Add-On" (available here: https://wordpress.org/plugins/gravity-forms-salesforce/ ). I have set up the required fields and I am seeing in Salesforce the leads that come from that contact form. The problem is that the leads coming from this contact form are filed directly under the "leads" tab and are not filtered under one of the "leads views" I've created. What am I doing wrong?

Thanks for your help!
Hi Developers,

I need to give sequence number to queue mebers when queue is created on particular object or whenever memeber are added/deleted. I am trying to create assignement based on thoese numbers.
 I want the queue related list on user object to show the this number along with queue name.

Please help in this matter. Thank you. 



Hi,

I am trying to deploy few reports and dashboards to a fullcopy sandbox 'fc' from another fullcopy sandbox via changeset and I am getting the following error message for dashboards.

Too many username matches for abc@gmail.com. The possible matches are abc@gmail.com.fc, abc@gmail.com; edit the username to match only one.

What des this mean?
Hi members ,

i have written a trigger on the oppportunity in the object if the stage is "closed won " i need to insert a record in the account.and i m getting the error and the error is (Error:Apex trigger opptrigger caused an unexpected exception, contact your administrator: opptrigger: execution of AfterUpdate caused by: System.DmlException: Upsert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Account Name]: [Account Name]: Trigger.opptrigger: line 23, column 1)




trigger opptrigger on Opportunity (after insert,after update)
{
      //Create a list to hold all new records  
   List<Account> newRecords = new List<Account>();
  
    //Loop around all records in the trigger transaction 
    for(Opportunity theRecord : Trigger.new)
{
          //Evaluate the record against our critieria    
     if(theRecord.StageName == 'Closed Won')
{
              //The line below creates a new Account record and adds it to our list of new records. Add your field assigments (examples below). Make sure to assign all required fields.          
   Account newRecord = new Account();           
  //newRecord.Name = theRecord.name;        
     //newRecord.Description = 'My New Record';           
  newRecords.add(newRecord);       
   }   
  }     
//Insert the new records if any exist   
  if(newRecords.size() > 0)    
     upsert newRecords;
}
I am trying to update a few records with email id whenever a user updates his email in the user record. I wrote the trigger on User object however the trigger is not firing since an email is first sent over on email update which then requires confirmation from user. 

Any ideas on what can be done?
I am trying to update a text field with the owner's name everytime the owner is changed to  one among a particular group of users. The new record's owner id is correctly returned in the debug log however the rec.owner.Name is returning null. 

Can somebody help me understand what is the issue?

Ran into an interesting Salesforce-to-Salesforce (S2S) problem I thought I'd share - it appears the S2S Connection Owner cannot insert share records via Apex trigger.

 

We have S2S configured in our org to receive Case records from another org.  Separately, we have a Case trigger to insert a custom "Performance Rating" object record anytime a Case is closed (to rate the owner).  This, in turn, fires a Performance Rating trigger to share the newly inserted record with the Case owner.

 

It all works fine normally.  But when a Case is closed via S2S connection, the Performance Rating trigger is failing with an INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY exception.  Apparently, the S2S Connection User isn't being allowed to insert  the new Performance_Rating__Share record.  The error occurs on the last line in the trigger below:

 

Trigger shareWithRelatedRecordOwner on Performance_Rating__c (after insert, after update) {
  List<Performance_Rating__Share> prShareList = new List<Performance_Rating__Share>();
  for (Performance_Rating__c pr : Trigger.new) {
    if(pr.Related_Record_Owner__c != null) {
      Performance_Rating__Share prShare = new Performance_Rating__Share();
      prShare.ParentId = pr.Id;
      prShare.UserOrGroupId = pr.Related_Record_Owner__c;
      prShare.AccessLevel = 'read';
      prShare.RowCause = Schema.Performance_Rating__Share.RowCause.Related_Record_Owner__c;
      prShareList.add(prShare);
    }
  }
  insert prShareList;
}

 Note that "with sharing" isn't coming into play here, so I believe the trigger should be running in system (aka "god") mode, and it really shouldn't matter who the running user is.

 

My theory is that we're hitting some odd bug related to the S2S Connection User.  In my view, this trigger should always work - it shouldn't fail just because it's being invoked as the result of an update made to a record via S2S.

 

Our quick & dirty workaround was to simply put a try/catch around the insert, and eat the error.  But wow, that is an unsatisfying resolution (and it results in the new record NOT being shared with the original Case owner, per the intent of the trigger).

 

I'd welcome any alternate theories.

 

 

 

 

I have an apex:pageMessage component outside apex:form which I would like to rerender based on the action of a commandlink and commandbutton inside apex:form. I have placed the pagemessage inside an outputpanel an rerendered the panel using the id, but its not displaying the error message. I can see the error message in the logs. But its not displaying in the page. First of all, i am doing the right thin? Is it even possible to rerender this way?

 

If not how do i get to rerender the pagemessage component? I cannot put the component inside the form, because currently the form itself is rerendered based on the action of the commandlink and commandbutton. 

Hi,

 

I have some reports in my org which I only want some users to see. I have created a folder and a public group with those users and shared the folder with the group. It works fine for most of the users.However I found that some users were still able to access this reports. I mean they are not getting the Insufficient privileges error. They can see the report and edit the report. They are not seeing any data on the report.

 

Why is this happening? My guess is its a profile permission. But I cannot figure out which one.Can somebody please explain?

 

Thanks in advance.

His all,

 

Is there a way to avoid sharing records fro users who dont have access to the object.

 

in soql even we used with sharing keyword, records are retrieved for the users who have sharing records but not read access in profile

I have certain list views on the custom objects which I want only certain group of people to see. For example I have two list views LV1 and LV2. Certain group of users should only see LV1 and certain others should see only LV2.I have created two public groups and restricted the visibility to 'Certain groups' but still the users are able to see both the list views LV1 and LV2.

 

Upon investigation I found that the users have system permission 'Manage Public List Views' in their profile.

 

What can I do to restrict the users from viewing the list views they are not supposed to see?