• Sreekanth Naraboina
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
trigger Pricebookentry on Priority_Item_Targets__c (before insert) {
 for (Priority_Item_Targets__c p : Trigger.new) { 
     PricebookEntry pbe = [SELECT Id, Product2Id, UnitPrice, IsActive FROM PricebookEntry limit 1];
     p.Opportunity_Size__c = pbe.UnitPrice;
   } 
}
 please update my logic
it sounds like we have enabled multi-threading for Social Customer Service. However, as a result, you are seeing row lock errors when the same Social Persona publishes multiple posts in rapid succession?If so, row lock errors are expected in this scenario how can we avoid?

 
i need to update case object status and Noted field for exisiting listed records. 
public with sharing class TestCaseUpdateClass {
public list<case> caseList{get;set;}
public list<case> updateCaseList{get;set;}
public list<case> upCaseList{get;set;}
 public String casestatus{get;set;}
 public String casenotes{get;set;}
    public TestCaseUpdateClass(ApexPages.StandardController controller) {
        caseList=new list<case>();
        updateCaseList=new list<case>();
        list<string> allIdsList = new list<string>();
        
        //Getting ids from the url
        string AllIds = apexpages.currentpage().getparameters().get('AllIds');
        if(AllIds != null && AllIds != ''){
             //Spliting all ids in list to make a query
            allIdsList = AllIds.split('-');
            if(allIdsList != null && allIdsList.size() > 0){
                //final query on case list
                caseList= [select id,Status,Notes__c from Case where id In : allIdsList];
            }
    }

}
public void valueget(){
    casestatus=System.currentPageReference().getParameters().get('Mahavir');
    casenotes=System.currentPageReference().getParameters().get('notesget');
     system.debug('Status Value in valueget-->>'+casestatus);
     system.debug('notes Value in valueget-->>'+casenotes);
 
}

   public PageReference Save(){ 
             system.debug('Status Value in save-->>'+casestatus);
             system.debug('notes Value in valueget-->>'+casenotes);
       for(case cs:caseList){
           cs.Status=casestatus;
           cs.notes__c=casenotes;
           updateCaseList.add(cs);
       }
       update updateCaseList;
       system.debug('Updated List-->'+updateCaseList);
        PageReference pageRef;
        pageRef = new PageReference('/home/home.jsp');
        pageRef.setRedirect(true);
        return pageRef;  
}
  
}

Visualforce page:
apex:page standardController="case" extensions="TestCaseUpdateClass" >
<script type="text/javascript">
function Callmefunc(id)
{
var statusVal = '';
var type = document.getElementById(id).value;
statusVal = type; check(statusVal);
alert(statusVal);
}
function Callmefuncnotes(id) {
var typenotes = '';
var typenotes = document.getElementById(id).value;
notesVal = typenotes; notes(notesVal);
alert(notesVal);
}
</script>
<apex:form >
<apex:pageBlock >
<apex:actionFunction name="check" action="{!valueget}" reRender="refresh">
<apex:param name="Mahavir" value="" /> 
</apex:actionFunction>
<apex:actionFunction name="notes" action="{!valueget}" reRender="refresh1">
<apex:param name="notesget" value="" />
</apex:actionFunction> <apex:pageBlockSection columns="1">
<apex:inputField value="{!case.Status}" rendered="true" label="Status" style="width:15%" id="check" onchange="Callmefunc('{!$Component.check}')"/>
<apex:inputField value="{!case.Notes__c}" style="width:30%" id="notes" onchange="Callmefuncnotes('{!$Component.notes}')"/> </apex:pageBlockSection>
<apex:outputPanel id="refresh">
</apex:outputPanel>
<apex:outputPanel id="refresh1">
</apex:outputPanel> <
apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!Save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Update Existing Record from Visual Force Page
Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Error is in expression '{!Save}' in component <apex:commandButton> in page massclosecasescontroller: Class.MassCloseCasesController.save: line 17, column 1
An unexpected error has occurred. Your development organization has been notified.
Apex class:
public with sharing class MassCloseCasesController {
   public string CaseId{get;set;}
    public List<Case> Caselist{get;set;}
    public Case Caserecord{get;set;}
    public MassCloseCasesController(ApexPages.StandardController controller) 
    {
    
    Caserecord =(Case)Controller.getRecord();
    Caseid = ApexPages.CurrentPage().getparameters().get('CaseId');
    
    System.debug('Case id='+Caseid);
        Caselist = [select id,Status,Notes__c from Case where id=:CaseId];
    
    }  
    
    public PageReference save(){ 
        update Caserecord;
        return null;
    }
      
     
  }
    
    Visualforce page:
<apex:page standardController="Case" extensions="MassCloseCasesController">

 <apex:form >
 <apex:sectionHeader title="Change Case Status"/>
 <apex:pageBlock title="Select New Status">
 <apex:pageBlockButtons >
 <apex:commandButton value="Save" action="{!Save}"/>
 
 </apex:pageBlockButtons>
 <apex:pageBlockSection columns="1">
 
 <apex:inputField value="{!Caserecord.Status}" style="width:15%"/>
 <apex:inputField value="{!Caserecord.Notes__c}" style="width:30%"/>
 
 
 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
 </apex:page>

Please anyone help me asap.

Thanks,
Sreekanth
When selecting 1 or more cases from the list and clicking "Change Status" can we please add the Notes field on that page under the New Status field?  and Change Status is a Standard List View Button so I request you to please let me know any help or suggestion.User-added imageUser-added image

Thanks,
Sreekanth
Update Existing Record from Visual Force Page
Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Error is in expression '{!Save}' in component <apex:commandButton> in page massclosecasescontroller: Class.MassCloseCasesController.save: line 17, column 1
An unexpected error has occurred. Your development organization has been notified.
Apex class:
public with sharing class MassCloseCasesController {
   public string CaseId{get;set;}
    public List<Case> Caselist{get;set;}
    public Case Caserecord{get;set;}
    public MassCloseCasesController(ApexPages.StandardController controller) 
    {
    
    Caserecord =(Case)Controller.getRecord();
    Caseid = ApexPages.CurrentPage().getparameters().get('CaseId');
    
    System.debug('Case id='+Caseid);
        Caselist = [select id,Status,Notes__c from Case where id=:CaseId];
    
    }  
    
    public PageReference save(){ 
        update Caserecord;
        return null;
    }
      
     
  }
    
    Visualforce page:
<apex:page standardController="Case" extensions="MassCloseCasesController">

 <apex:form >
 <apex:sectionHeader title="Change Case Status"/>
 <apex:pageBlock title="Select New Status">
 <apex:pageBlockButtons >
 <apex:commandButton value="Save" action="{!Save}"/>
 
 </apex:pageBlockButtons>
 <apex:pageBlockSection columns="1">
 
 <apex:inputField value="{!Caserecord.Status}" style="width:15%"/>
 <apex:inputField value="{!Caserecord.Notes__c}" style="width:30%"/>
 
 
 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
 </apex:page>

Please anyone help me asap.

Thanks,
Sreekanth
When selecting 1 or more cases from the list and clicking "Change Status" can we please add the Notes field on that page under the New Status field?  and Change Status is a Standard List View Button so I request you to please let me know any help or suggestion.User-added imageUser-added image

Thanks,
Sreekanth