• Siddharth Mani
  • NEWBIE
  • 324 Points
  • Member since 2015
  • Aspiring Developer

  • Chatter
    Feed
  • 8
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 73
    Replies
I have enabled Chatter in Chatter settings. I have enabled everything to do with Chatter in my profile - System administrator, and removed myself from all permission sets (just in case). I don't know where else to do/enable but when I hover over a dashboard component, all I see is "Click to go to full report" - no menu icon appears so I can select post options, there's no option to "follow"!
Just to say that I can access my Chatter feed and I can follow records etc - I just cannot post or follow dashboard components?!

Hi All,

I am having problem with verifing this module.Its very simple but i am not able to verify this.
Module:

Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.
The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.
 

public class StringArrayTest {
    public Static List<string> generateStringArray(Integer n){
        integer i=1;
        List<String> rtn = new List<String>();
        for(i =1;i<=n;i++){
        rtn.add('\'Test '+i+'\'');
        }
        return rtn;
    }
}
I hope this is an easy one.. I have not yet started writing triggers so it's all foreign to me.
I need to write a trigger to reassign a task based on a subject content to a lookup user in the record.
We have mutliple people that handle an account and I created a workflow/rule to automatically assign a task based on a specific criteria but I cannot assign it to another user besides the account owner.
Any help is appreciated.
Hi folks,
  please folks help me out in this sceraniro 

  My requirement is to creating search button in visualforce page ,,if we search any records by using records name ,it has to  display that records details.
Thanks in advance,,,

Thanks
Anjin
Question to my great developers. What route should I take on this project.

Just like every other list view in Salesforce, I know that the activity history are not shown in any field or even creating a filter for it.  

SCENARIO:
Create a List View of contacts that will show and filter Activity History "Subject" and "Call Result" and "Date"
Ex. 
John Doe - Subject: Call - Call Result: Reached

The reason for this is to have a call list for my Salesteam and be able to do it in any standard/custom object.  Also have it sorted by the newest date on top so once a new call date has been made it goes all the way to the bottom of the list.

- Visualforce? Can you show code?
- Process Builder? Can you guide the process
- Field Creation? What formula?

Can you guys share your thoughts and codes so I can try?
Hi 

1. Create a field “Number of attachments “in accounts. Whenever an attachment is attached or deleted from the account, count the number of attachments and display in the field.

2. Create a Page with two buttons “Start” and ”Increment” .When “Start” is clicked start a counter decrementing from 60 seconds. When the “Increment” button is clicked 3 times stop the counter. Else after 60 seconds display an alert message.

How to achive this two scenario. Please guide me to solve this issue.Post some code to achive this.

Advance Thanks
Maheshwar 
I'm trying to complete the challenge in the admin trail about the report builder but I'm stuck. No matter what I try I keep getting the same error: "Challenge not yet complete... here's what's wrong: Please check that you have a filter for Stages that are not equal to Closed Won or Closed Lost."

I tried applying these filters:

Filtered By:1 AND NOT(2 OR 3)
    1. Amount greater than "25,000" 
    2. Stage equals Closed Won 
    3. Stage equals Closed Lost

Filtered By:
    Amount greater than "25,000"
    AND Stage not equal to Closed Won
    AND Stage not equal to Closed Lost

Any help is much appreciated
For Case Object, when logged in as a limited profile User, when the User navigates to the Cases tab, there are a set of records which are shown as Recently Viewed. But even after opening a case record manually - this particular record does not show up in the list. What could be a possible reason for this?
Note that as a sysadmin when i open the same record and then navigate back to the cases tab - i am able to see the record in my recent cases list. 
P.S - Tab is standard and not customized (VF)
I saw this question in multiple boards, but still haven't got a definite answer for this. I want to know use case wise why we would go for  Trigger.old specifically as I believe that Trigger.oldMap already has the old values along with Id. The simpler form of the question is why Salesforce has provided Trigger.old as a context variable.
I have a requirement to prepopulate some fields (Address Fields) when standard "New" button is clicked from the related list (Contact) of Account. This was being achieved using an intermediate VF page in classic.
Now in lightning, I am able to create a component with a quick action to achieve the same - but the problem here is that the override has to be either a vf page or a lightning component.
Is there any way to have both on a single button - like when in classic, follow the old approach by redirecting to an intermediate vf and prepopulating the values and when in lightning, use the newly created lightning component?
hi,

I am trying to remove items being displayed on a VF page via wrapper class. The code seems to work fine when a single record is selected but throws index out of bounds exception when multiple entries are selected. Below is the code:

Controller:
public with sharing class SelectEmpRecordController2 {
     //Our collection of the class/wrapper objects wrapEmployee
    public List<wrapEmployee> wrapEmpList{get; set;}
    public List<Employee_Information__c> selectedEmployees{get;set;}
    public Map<String,Double> empatt{get;set;}
 
    public SelectEmpRecordController2(){
        if(wrapEmpList== null) {
            wrapEmpList = new List<wrapEmployee>();
            for(Employee_Information__c s: [select Name,Emp_Name__c,Percentage__c from Employee_Information__c]) {
                // As each employee is processed we create a new wrapEmp object and add it to the wrapEmpList
                wrapEmpList.add(new wrapEmployee(s));
            }
        }
        if(empatt == null) {
            empatt = new Map<String,Double>();
            for(Employee_Information__c s: [select Name,Emp_Name__c,Percentage__c from Employee_Information__c]) {
                empatt.put(s.Emp_Name__c,s.Percentage__c);
            }
            system.debug('map value'+empatt);
        }
    }
 
    public void processSelected() {
    selectedEmployees = new List<Employee_Information__c>();
 
        for(wrapEmployee wrapEmpObj : wrapEmpList) {
            if(wrapEmpObj.selected == true) {
                selectedEmployees.add(wrapEmpObj.emp);
                wrapEmpObj.perc = empatt.get((wrapEmpObj.emp).Emp_Name__c);
            }
        }
    }
    
    public void removeEmployee() {
        Set<Integer> toDelete = new Set<Integer>();
        for(Integer i=0;i<wrapEmpList.size();i++) {
            if(wrapEmpList[i].selected == true) {
                toDelete.add(i);
            }
        }
        for(Integer i : toDelete) {
            wrapEmpList.remove(i);
        }
    }
 
    // This is our wrapper/container class. This wrapper class contains both the salesforce object Employee_Information__c and a Boolean value
    public class wrapEmployee{
        public Employee_Information__c emp {get; set;}
        public Boolean selected {get; set;}
        public double perc{get;set;}
         
        public wrapEmployee(Employee_Information__c s) {
            emp = s;
            selected = false;
        }
        
    }
}

VF Page
<apex:page controller="SelectEmpRecordController2" sidebar="false">
    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Show Selected Employee Result" action="{!processSelected}" rerender="table2"/>
                <apex:commandButton value="Remove Employee" action="{!removeEmployee}" rerender="table"/>
            </apex:pageBlockButtons>
 
            <apex:pageblockSection title="All Employee Result" collapsible="false" columns="2">
 
                <apex:pageBlockTable value="{!wrapEmpList}" var="empWrap" id="table" title="All Results">
                    <apex:column headerValue="Option" >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!empWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!empWrap.emp.Name}" />
                    <apex:column value="{!empWrap.emp.Emp_Name__c}" />
                    <!--<apex:column value="{!empWrap.emp.Percentage__c }" />-->
                </apex:pageBlockTable>
 
                <apex:pageBlockTable value="{!selectedEmployees}" var="s" id="table2" title="Selected Employees">
                    <!--<apex:column value="{!s.Name}" headerValue="Name"/>
                    <apex:column value="{!s.Emp_Name__c}" headerValue="Employee Name"/>-->
                    <apex:column value="{!s.Percentage__c}" headerValue="Percentage" />
                </apex:pageBlockTable>
 
            </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form> 
</apex:page>

Please check the removeEmployee() function for the details I mentioned.
Can anyone let me know what is wrong?
There are 12 tabs in my custom app and 4 of them are VF tabs. The rest of them are all Custom object tabs/Standard Tabs (Reports and Dashboards). Issue is with 2 of the Custom Object tabs - When I click on "Create New View" link after opening the tab, the highlighted tab changes to some other random value instead of staying on the current Tab.
For eg. 
1. I click on Orders tab.
2. I click on "Create New View" link within the tab
3. I get the page for creating a new view for Orders (as is apparent from the options provided to me) - but now the highlighted tab is say for eg. Accounts (or any other tab!!).

Any idea what could be causing this?
Hi,

Suppose I have a String like this:
String myString = ';abc;;;def;;ghi;jkl;lmnop';

Is it possible to create a list like {abc,def,ghi,jkl,lmnop} ??
Basically the values will be separated by semicolon, but it might not be a single one and it may also occur at the start and end. I want only the values stored in a separate list
I have a pageblock table and its the most basic version at that. The requirement is to have dynamic columns based on the values of a particular field value and other columns grouped below this one.For eg. my data is like this:

User-added image

I want the output as:

User-added image

And similarly if there are more accounts/fields, they should be grouped and displayed accordingly. Could someone please guide as to how to proceed on this?
I have a custom object ToDoObj which has no fields ( I am using only the Name field from it) and I am trying to create a ToDo list type of functionality with this Object. Below is my code for Component and Controller:
 
<aura:component controller="ToDoController">
    <aura:attribute name="list" type="ToDoObj__c[]" />
    <aura:attribute name="listItem" type="ToDoObj__c" />
    <aura:handler name="init" action="{!c.myAction}" value="{!this}" />

   <div class="container">
    <form class="form-for-list">
      <div class="if-field-is-req">
        <div class="only-one-inputfield">
          <ui:inputText aura:id="todoitemfield" label="Enter ToDo Item  "
                        class="to-do-item"
                        labelClass="to-do-item__label"
                        value="{!v.listItem.Name}"/>
         </div>
       </div>
      </form>
    </div>
      <ui:button label="Add To List" 
                       class="add-to-list"
                       labelClass="label"
                       press="{!c.createToDo}"/>
<div class="msg">
              <div id="list" class="row">
                 <aura:iteration items="{!v.list}" var="item">
                     <ui:inputCheckbox value="" /><ui:outputText value="{!item.Name}"/>
                  </aura:iteration>
              </div>
          </div> 
</aura:component>
Controller:
({
 myAction : function(component, event, helper) {
    var action = component.get("c.getToDos");
    action.setCallback(this, function(data) {
    component.set("v.list", data.getReturnValue());
});
$A.enqueueAction(action);
 },

createToDo : function(component, event, helper) {
 var todoItemField = component.find("todoitemfield");
   console.log('field is'+todoItemField);
 var todoItem = todoItemField.get("v.value");   
    console.log('item is '+todoItem);
    if(!todoItem || 0 === todoItem.length){
        todoItem.set("v.errors", [{message:"Enter a value!"}]);
    }
    else {
    todoItem.set("v.errors", null);
    var listItem = component.get("v.listItem");
    createtodo(component, listItem);
}
},
createtodo: function(component, listItem) {
this.upserttodo(component, listItem, function(a) {
    var list = component.get("v.list");
    list.push(a.getReturnValue());
    component.set("v.list", list);
    this.updateTotal(component);
  });
},
})
I tried to debug the same using console.log but I am getting null value for todoItem while todoItemField is being updated correctly in the variable (as far as I know - it comes as some value which is in some other format and doesnt show the actual fieldName or something). Can anyone tell me where I am going wrong in this!

 
I have a requirement to prepopulate some fields (Address Fields) when standard "New" button is clicked from the related list (Contact) of Account. This was being achieved using an intermediate VF page in classic.
Now in lightning, I am able to create a component with a quick action to achieve the same - but the problem here is that the override has to be either a vf page or a lightning component.
Is there any way to have both on a single button - like when in classic, follow the old approach by redirecting to an intermediate vf and prepopulating the values and when in lightning, use the newly created lightning component?
I have a custom object ToDoObj which has no fields ( I am using only the Name field from it) and I am trying to create a ToDo list type of functionality with this Object. Below is my code for Component and Controller:
 
<aura:component controller="ToDoController">
    <aura:attribute name="list" type="ToDoObj__c[]" />
    <aura:attribute name="listItem" type="ToDoObj__c" />
    <aura:handler name="init" action="{!c.myAction}" value="{!this}" />

   <div class="container">
    <form class="form-for-list">
      <div class="if-field-is-req">
        <div class="only-one-inputfield">
          <ui:inputText aura:id="todoitemfield" label="Enter ToDo Item  "
                        class="to-do-item"
                        labelClass="to-do-item__label"
                        value="{!v.listItem.Name}"/>
         </div>
       </div>
      </form>
    </div>
      <ui:button label="Add To List" 
                       class="add-to-list"
                       labelClass="label"
                       press="{!c.createToDo}"/>
<div class="msg">
              <div id="list" class="row">
                 <aura:iteration items="{!v.list}" var="item">
                     <ui:inputCheckbox value="" /><ui:outputText value="{!item.Name}"/>
                  </aura:iteration>
              </div>
          </div> 
</aura:component>
Controller:
({
 myAction : function(component, event, helper) {
    var action = component.get("c.getToDos");
    action.setCallback(this, function(data) {
    component.set("v.list", data.getReturnValue());
});
$A.enqueueAction(action);
 },

createToDo : function(component, event, helper) {
 var todoItemField = component.find("todoitemfield");
   console.log('field is'+todoItemField);
 var todoItem = todoItemField.get("v.value");   
    console.log('item is '+todoItem);
    if(!todoItem || 0 === todoItem.length){
        todoItem.set("v.errors", [{message:"Enter a value!"}]);
    }
    else {
    todoItem.set("v.errors", null);
    var listItem = component.get("v.listItem");
    createtodo(component, listItem);
}
},
createtodo: function(component, listItem) {
this.upserttodo(component, listItem, function(a) {
    var list = component.get("v.list");
    list.push(a.getReturnValue());
    component.set("v.list", list);
    this.updateTotal(component);
  });
},
})
I tried to debug the same using console.log but I am getting null value for todoItem while todoItemField is being updated correctly in the variable (as far as I know - it comes as some value which is in some other format and doesnt show the actual fieldName or something). Can anyone tell me where I am going wrong in this!

 
Hello everyone,

I have a very peculiar situation. For the creation of a particular record I need the Automated Process User Id, up to now this is the way I obtained it.
 
[SELECT Id FROM User Where Name = 'Automated Process']
Everything was correct until a new user arrived that set his profile Locale to Chinese.

Now this previous Query does not work as the name for the "Automated Process" user has changed to "Process Automated", giving 0 results for this query.

Is there a proper way to retrieve this "Automated Process" user without having the name issue because the Users locale?
  • April 21, 2020
  • Like
  • 1
I saw this question in multiple boards, but still haven't got a definite answer for this. I want to know use case wise why we would go for  Trigger.old specifically as I believe that Trigger.oldMap already has the old values along with Id. The simpler form of the question is why Salesforce has provided Trigger.old as a context variable.
I have a requirement to prepopulate some fields (Address Fields) when standard "New" button is clicked from the related list (Contact) of Account. This was being achieved using an intermediate VF page in classic.
Now in lightning, I am able to create a component with a quick action to achieve the same - but the problem here is that the override has to be either a vf page or a lightning component.
Is there any way to have both on a single button - like when in classic, follow the old approach by redirecting to an intermediate vf and prepopulating the values and when in lightning, use the newly created lightning component?
I am trying to make the Partner role as removed when I select a Partner for a Account. I understand that it is not customizable.

On the Account standard object we have the related list "Partners"; when you create new Partner; it provide the option to select a Partner (Account) and " role" in the drop down, i wanted it to be removed.

Has anyone implemented this using VF? Thanks.. I would appreciate any codes that can be shared. Thanks
I am pulling fields from a database to my object on salesforce. one of the fields from the database are ID"s each ID represents a color such as ID 1111 is color green and 2222 is color yellow. The database does not have the actual color fields just the id for the color. How can I pull the ID's from the database but display Green, Yellow, or Red as the value on salesforce?
hi,

I am trying to remove items being displayed on a VF page via wrapper class. The code seems to work fine when a single record is selected but throws index out of bounds exception when multiple entries are selected. Below is the code:

Controller:
public with sharing class SelectEmpRecordController2 {
     //Our collection of the class/wrapper objects wrapEmployee
    public List<wrapEmployee> wrapEmpList{get; set;}
    public List<Employee_Information__c> selectedEmployees{get;set;}
    public Map<String,Double> empatt{get;set;}
 
    public SelectEmpRecordController2(){
        if(wrapEmpList== null) {
            wrapEmpList = new List<wrapEmployee>();
            for(Employee_Information__c s: [select Name,Emp_Name__c,Percentage__c from Employee_Information__c]) {
                // As each employee is processed we create a new wrapEmp object and add it to the wrapEmpList
                wrapEmpList.add(new wrapEmployee(s));
            }
        }
        if(empatt == null) {
            empatt = new Map<String,Double>();
            for(Employee_Information__c s: [select Name,Emp_Name__c,Percentage__c from Employee_Information__c]) {
                empatt.put(s.Emp_Name__c,s.Percentage__c);
            }
            system.debug('map value'+empatt);
        }
    }
 
    public void processSelected() {
    selectedEmployees = new List<Employee_Information__c>();
 
        for(wrapEmployee wrapEmpObj : wrapEmpList) {
            if(wrapEmpObj.selected == true) {
                selectedEmployees.add(wrapEmpObj.emp);
                wrapEmpObj.perc = empatt.get((wrapEmpObj.emp).Emp_Name__c);
            }
        }
    }
    
    public void removeEmployee() {
        Set<Integer> toDelete = new Set<Integer>();
        for(Integer i=0;i<wrapEmpList.size();i++) {
            if(wrapEmpList[i].selected == true) {
                toDelete.add(i);
            }
        }
        for(Integer i : toDelete) {
            wrapEmpList.remove(i);
        }
    }
 
    // This is our wrapper/container class. This wrapper class contains both the salesforce object Employee_Information__c and a Boolean value
    public class wrapEmployee{
        public Employee_Information__c emp {get; set;}
        public Boolean selected {get; set;}
        public double perc{get;set;}
         
        public wrapEmployee(Employee_Information__c s) {
            emp = s;
            selected = false;
        }
        
    }
}

VF Page
<apex:page controller="SelectEmpRecordController2" sidebar="false">
    <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Show Selected Employee Result" action="{!processSelected}" rerender="table2"/>
                <apex:commandButton value="Remove Employee" action="{!removeEmployee}" rerender="table"/>
            </apex:pageBlockButtons>
 
            <apex:pageblockSection title="All Employee Result" collapsible="false" columns="2">
 
                <apex:pageBlockTable value="{!wrapEmpList}" var="empWrap" id="table" title="All Results">
                    <apex:column headerValue="Option" >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!empWrap.selected}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!empWrap.emp.Name}" />
                    <apex:column value="{!empWrap.emp.Emp_Name__c}" />
                    <!--<apex:column value="{!empWrap.emp.Percentage__c }" />-->
                </apex:pageBlockTable>
 
                <apex:pageBlockTable value="{!selectedEmployees}" var="s" id="table2" title="Selected Employees">
                    <!--<apex:column value="{!s.Name}" headerValue="Name"/>
                    <apex:column value="{!s.Emp_Name__c}" headerValue="Employee Name"/>-->
                    <apex:column value="{!s.Percentage__c}" headerValue="Percentage" />
                </apex:pageBlockTable>
 
            </apex:pageblockSection>
        </apex:pageBlock>
    </apex:form> 
</apex:page>

Please check the removeEmployee() function for the details I mentioned.
Can anyone let me know what is wrong?
Hi all,

I want to know whether we can override a particular record type page with a custom VF page? If yes how can we do that. Please help me
Hi,
I have controler method that takes 2 string parameter as input and accordingly after processing internal logic return a boolean value. For Ex. the below
UserCredentialcheck(){
        if(ud <> UID && pw <> PWD){
           return false;
        }
        else{
            return true;
        }
}

Here UID and PWD are predefined values defined earlier on top of the class.
I would like to call this method from VF page along with the parameter. How shall I acheive this. Please suggest and guide.

Thanks in advance
Ashish
As a non-developer, is there any way I can disable autofill / autocomplete and autocorrect in name fields?

One of my team has flagged that the autocorrect in a name field is creating problems. (eg correcting Lyn to Lynne)

Is there a setting I can select to disable this function?

I would appreciate any assistance.
Hi Team,
I am getting error on bulk Lead import, "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:CheckLeadDNCR: System.LimitException: Apex CPU time limit exceeded:--".
I checked trigger CheckLeadDNCR, it is not inserting/updating any data its a normal if else and very short trigger. Then why this error is coming on this trigger
I have enabled Chatter in Chatter settings. I have enabled everything to do with Chatter in my profile - System administrator, and removed myself from all permission sets (just in case). I don't know where else to do/enable but when I hover over a dashboard component, all I see is "Click to go to full report" - no menu icon appears so I can select post options, there's no option to "follow"!
Just to say that I can access my Chatter feed and I can follow records etc - I just cannot post or follow dashboard components?!
Hi EveryOne,

I am trying to open the attachments of a record using one click. Please give some inputs to achive that.

Thanks
Hi, 

I'd like to sum the results of 2 queries. I'd use those results in order to double check some figures. 
I pasted the two queries herebelow, they have different timeframe.

SELECT Sum(Power_of_1__c)
FROM Task
WHERE CallType = 'Outbound'
AND Sucessful_call__c = TRUE
AND CreatedDate >= LAST_N_WEEKS: 4

SELECT Sum(Power_of_1__c)
FROM Task
WHERE CallType = 'Outbound'
AND Sucessful_call__c = TRUE
AND CreatedDate >= LAST_N_MONTHS: 4

Any help would be much appreciated. 

Nathan
Hi friends,

 i want to show leads which are associated with email domains on a visualforce page (which i use it in lead page layout).

For Ex :-

A lead with email 1234@ABC.com is existing in my leads.
When a new lead is created with the same domain 56789@ABC.com.  Then the prevoius lead should be shown in the visualforce page (which i use it in lead page layout).


I tried it but could not get it solved : 

here is my Visualforce page and Extension controller, please do make any changes :


<apex:page standardController="Lead" extensions="GetDomain">
   <apex:pageBlock >
      <apex:pageBlockTable value="{!LeadLst}" var="ld">
         <apex:column value="{!ld.Name}"/>
         <apex:column value="{!ld.Email}"/>
         <apex:column value="{!ld.PartnerAccount.Name}" headerValue="Account"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
</apex:page>


CONTROLLER :

public with sharing class GetDomain {

    public List<Lead> LeadLst { get; set; }

    public GetDomain(ApexPages.StandardController controller) {
        String email = '%' + [SELECT Name, Email, PartnerAccount.Name FROM Lead WHERE Id =: apexpages.currentpage().getparameters().get('id')].email.substringAfter('@')+ '%';
        LeadLst = [SELECT Name, Email FROM Lead WHERE Email LIKE: email];      
    }

}


Did i miss anything that should be there.!


Any help would be approciated.

Thanks,
Avinash Guptha


 
Hi,
I have a VF page and some apex code in related controller. The VF is ran by a user having limited access based on his profile. However the code tries to update a contact which results in a privilege error and says [Update access denied for Contact] which seems an issue for currently runnign user. This is fine as user profile doesnt allow him to edit/update Contacts. However if I have not used [with sharing], then ideally it should run in System mode which is somehow not happening. Can someone pls help by pointing out issue  or some direction pls ?
I have a trigger that uses the account name to populate a Service Contract field on the ticket. Sometimes we forget to add the account but instead add a contact with the account associated and we get

Error:Apex trigger UpdateServiceContract caused an unexpected exception, contact your administrator: UpdateServiceContract: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.UpdateServiceContract: line 8, column 1

Is it possible for you to review the trigger and let me know how I can incorporate just having a contact name on the ticket
trigger UpdateServiceContract on Case (before insert,before update, after update) {
  Id caseRecordTypeId = [Select id from RecordType where sObjectType = 'Case' and developerName ='Service_Desk' ].id ; 
    for (Case c : trigger.new) {
    if (c.RecordTypeID == caseRecordTypeId )
      if (c.service_contract__c == NULL){
        try{
          //c.Service_Contract__c = [select Id from ServiceContract where AccountId ='810D0000000Cfza' and Primary_Service_Contract__c = True].id;
        c.Service_Contract__c = [select Id from ServiceContract where AccountId = :c.AccountId and Primary_Service_Contract__c = True limit 1].id;
        }catch(QueryException e) {
          //No records found. Maybe you should set it to Null
      }
     }
    }
  
}