• kcplusplus
  • 109 Points
  • Member since 2012
  • Senior Developer
  • 2U

  • Chatter
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
  • 84

I am trying to write a test class and getting a save error in line 0.


public with sharing class HelloWorldTestClass {
static testMethod void HelloWorldTest(){
List<Position__c> positions = new List<Position__c>();
for (Integer i=0; i < 20; i++){
Position__c p = new Position__c();
position__c.Name = 'testName' + i;
position__c.Job_Description__c = 'testDescription' + i;

System.debug('Attempting to insert positions');
insert positions;
System.debug('Insert complete');
// refresh the Position list to include the Hello__c field after the insert
Map<ID,Position__c> positionMap = new Map<ID,Position__c>(positions);
positions = [select id,name,Hello__c from Position__c where id IN :positionMap.keySet()];
for (Position__c position:positions){
System.assertEquals(position.Hello__c, 'World');
System.debug('position.id=' + position.id);
System.debug('position.name=' + position.name);
System.debug('position.Hello__c=' + position.Hello__c);
} catch (System.DmlException e){
System.debug('We caught a DML exception: ' + e.getDmlMessage(0));



For some reason I cannot get cases to close by setting the status to closed. The "isClosed" checkbox remains unchecked even if I change the status.


Here is my code:


trigger CloseRelatedOppCases on Opportunity (before update) {

	List<Opportunity> opps = Trigger.new;
	for(Opportunity o : opps){
		if(o.StageName == 'Dead/Lost'){
			//Get record type ID of Engineering Engagement Request RT, Credit Verification Request, and Network Qualification Request
			RecordType rt1 = [SELECT id FROM RecordType WHERE Name = 'Engineering Engagement Request' LIMIT 1];
			RecordType rt2 = [SELECT id FROM RecordType WHERE Name = 'Credit Verification Request' LIMIT 1];
			RecordType rt3 = [SELECT id FROM RecordType WHERE Name = 'Network Qualification Request' LIMIT 1];
			//Find Associated NDS Cases
			List<Case> engineeringEngagementCases = [SELECT id FROM Case WHERE Opportunity__c = :o.Id AND RecordTypeId = :rt1.Id];
			List<Case> creditVerificationCases = [SELECT id FROM Case WHERE Opportunity__c = :o.Id AND RecordTypeId = :rt2.Id];
			List<Case> networkQualificationCases = [SELECT id FROM Case WHERE Opportunity__c = :o.Id AND RecordTypeId = :rt3.Id];
			//Combine All Cases into one list
			List<Case> cases = new List<Case>();
			//Loop Through Cases and Set Status to Opportunity Dead/
			for(Case c : cases){
					c.Status = 'Opportunity Dead/Lost';
			update cases;



Is it possible to convert a Date field to a Datetime value in a formula field? 

  • June 30, 2012
  • Like
  • 0

We are currently considering allowing our customers to access the SFDC case portal. Right now we are looking into different types of case views that we can setup to show the customer's cases.


We hit a roadblock in terms of allowing customers (who can see everyones cases that are from the same company) to only see their own cases in certain fields.


For example, John is apart of Acme Inc. and along with 4 coworkers, they have 5000 cases. John himself has 300 cases.


I want to create a view, so john can go to "My Open Cases" and it will only show john his open cases (<=300) rather than everyone's cases. While I know can set the scope to"my cases" if you have an employee account, is there a way to allow john or any of his cowokers to only see their own cases in some views, but all of their cases in other views? I have been looking for a variable such as CURRENT_USER() or LOGGED_IN_USER() that could be used in the case view critiera but haven't been able to find anything so far.


Any assistance would be greatly appreciated.





  • May 25, 2012
  • Like
  • 0

My name is KC and I am an experienced Salesforce developer, whether your looking for an apex trigger or a custom visualforce page to overhaul the UI I can help you, and at a more reasonable rate than many of the consultants and big companies out there. 


I'm a Salesforce MVP, Certified Administrator, Advanced Administrator and Developer and I have done a variety of customization and development through configurative and programmatic capabilities of the force.com platform. 


Check me out on linkedin here www.linkedin.com/pub/kc-shafer/46/411/96a and if you are interested in working with me, please email me at kcplusplus@me.com

I'm a 201 Certified Admin, 301 Certified Advanced Admin and 401 Certified Developer. I'm experienced in all parts of Salesforce from the declarative to the programmatic. 


If you are looking for complex workflows, formulas, validation, data modeling, complex business processes or Visual Flows, I can make them for you. I am very reasonable with my rates, and have a much lower cost and quicker turnaround time. 


I am also a developer and can assist with apex triggers, visualforce page or custom button. Whatever functionality or process you are looking to create, I can help you make it as efficient and effective as possible on the Force.com Platform. 


If you have any questions or would like to see code or project samples, email me at kcplusplus@me.com

I'm a 201 Certified Admin, 301 Advanced Admin and 401 Developer. I'm an experienced admin and developer, working in the programmatic and declarative capabilities of Salesforce.


If you are in need of a freelance developer for an apex trigger, visualforce page or custom button, then get in touch with me. I'm very resonable with rates and am much more affordable than the big consulting companies and have a quicker turnaround time, but most importantly produce the same high quality functionality. 


In addition to development, I also am experienced in creating complex workflow rules, formulas, validation rules, data models, complex processes and visual flows. 


If you have any questions or would like code samples, email me at kcplusplus@me.com

I'm a Force.com Certified Admin | Advanced Admin | Developer


I am both an expert in configuration - Data Modeling, formulas, workflow, Visual Flow, LiveAgent, Salesforce to Salesforce and anything else in the standard declarative tools. 


As well as development - Apex, Visualforce, SOQL, API, integrations etc. 


If you are in need of any type of consultation for development or admin projects, or both, I am very reasonable with rates and can work with your budget to get you the customizations you need. Email me at kcplusplus@me.com with any questions or for code samples. 

I am available and taking projects doing Salesforce configuration - building a data model, workflows, formulas, Visual Flow and  another declarative functionality. I mainly do apex and visualforce customizations though. I have a high level of knowledge of all parts of Salesforce and I am 201, 301 and 401 certified. 


If you are in need of customizations to your Salesforce org, I can help and at a much better rate than what many of the consulting companies are asking. If your interested in working with me, just send me an email at kcplusplus@me.com. I can answer any questions and have code samples available on request. 

I'm working on a trigger to update the account and the contact with the most recent completed event, I'm running through trigger.net and creating a map of event what id's and values as the ActivityDate, which I use for another part of the trigger. I then have a method to check if the whatid is an account, working fine.


The issue is, I then get down to getting the Most Recent Completed event activity date, but I have to do it in a for loop, so I can theoretically do it for every event getting inserted and also query against all that accounts events, to make sure I'm returning the right value. Everything is working fine, and I'm sure I could get away with using this, provided it was turned off for mass data loads. However, I would prefer to write this trigger as bulkified, but I'm having trouble coming up with a good way to do that. Any thoughts would be appreciated.


Eventually, I may move more logic to a class, but for now I'm just working in the trigger. It will be for accounts and contacts, whoid and whatid, and do both the most recent completed and the most recent future event, which would require four queries in for loops, two for accounts and two for contacts. Plus the two other queries.


Any points to a good example of someone dealing with something similar would be great or another way I can approach thi, that I'm not seeing.


trigger setLastEvent on Event (after insert) {
   	MAP<ID,Date> mapAccount = new MAP<ID,Date>();
    MAP<ID,Date> mapContact = new MAP<ID,Date>();
    //loop through trigger.new to get all of the what and who id's and add them to  
    for(Event e : trigger.new){
    	Id what = e.WhatId; 
        Id who = e.WhoId;
    //queries for account & contact id's in the maps for loops, and creating update LISTs for DML
    LIST<Account> accountIds = [SELECT id FROM Account Where Id IN: mapAccount.keySet()];
    LIST<Account> updateAccount = new LIST<Account>(); 
    LIST<Contact> contactIds = [SELECT id FROM Contact Where Id IN: mapContact.keySet()];
    LIST<Contact> updateContact = new LIST<Contact>(); 
    Date varToday = Date.Today(); 
    //loop to make updates
    for(Account a : accountIds){
    	LIST<Event> getEvents = [SELECT id,ActivityDate
                                 FROM Event 
                                 WHERE ActivityDate < :varToday
                                 ORDER BY ActivityDate desc
                                 LIMIT 1 ];
        a.Last_Meeting2__c = getEvents[0].ActivityDate; 
        a.Most_Recent_Meeting__c = mapAccount.get(a.id);
    update updateAccount; 


I have a both Salesforce configuration and development experience with Apex, as well as other Object Oriented languages and web technologies. I am looking for a position working in Force.com development and am available to relocate for the right position.


I have the following certifications as well:


Force.com 201 Administrator

Force.com 301 Advanced Administrator

Force.com 401 Developer


I'm also working towards my 501 Advanced Developer certification.


If you have open opportunities and would like to discuss them, please email me at kcplusplus@me.com and I would be happy to provide my resume, examples of work and linked in profile.


My email address is kcplusplus@me.com

I have three charts created as formulas and I wanted to conditionally display them based on a selected picklist value. I read a few posts on how to do this and it seemed really simple. I used an action support and an on change event, but the output Panel is not rerendering.


<apex:Form >
   <apex:actionRegion >
        <apex:inputField value="{!Quote.Chart__c}">
             <apex:actionSupport event="onChange" reRender="Panel"/>
<apex:outputPanel id="Panel">
    <apex:outputText value="{!IF(Quote.Chart__c ="Quantity",Quote.QuantityChart__c,"")}" escape="false"  label=""/>


I seem to remember that I had issues displaying an image formula in a merge formula before, but I can't remember if it isn't possible. I select a picklist value but the chart does not display. Right now I'm using an if merge formula to test, but I was going to move it to a case for each picklist choice once I had it working. 


Am I doing this the right way, or do I need to go about it a different way?

I'm working with quotes and line items, I have a trigger that rolls up data on 5 quote line item product categories and calculates percentages for each. I want to a have a data table essentially, that displays the 5 categories as rows and a total for the aggregated totals for each as a 6th row and have the cells for each rolled up value display with the value and the percentage as $1500 (50%). 


Category          $1500 (50%)       50.0 (35%)

Category          $1500 (50%)       50.0 (35%)


and then I have a few google charts I created as formulas, that I display on the right side. 


My first approach was with some visualforce tags, but it wasn't formatting well. Then I tried simple html table tagging, which worked a lot better to display while editing, but once I added it to the page layout, because it's quotes and I can't override the detail page, the formatting was awful and very difficult to work with. 


I know that straight html is not the best solution, because using visualforce will allow me to dig into the formatting to get the display the way I need it, but I'm stuck on where to go. I've taken a look at visualforce datatable and facets, and considered using a custom controller to set the different rolled up values and percentages together in an array, and then looping through them, but after researching I really didn't see how to do this. 


Is there a better way I can present the data in this format? I'm relatively new with visualforce and using custom controllers, but good with apex,javascript and html/css. Any solutions, ideas, points in the right direction, board examples or other resources would be appreciated :].



I'm working on making a section on the quotes page layout that displays some aggregated data for quote line item categories, that will display as a table. With the family on the left and then four columns of data, with five rows of categories and then two charts on the left. I tried using columns but that didn't work well, and now I'm using pageblocksection tags and items to lay it out and it worked well, but then I added a second row and the spacing got messed up. 


This is the markup I'm working with now and what it looks like now, ideally the chart would display on the right with the data all being aligned and spaced on the right. I'm still relatively new to using visualforce, I'm good with css and html for markup, I've tried using the built in style on the visualforce tags in a few ways and just using internal css but I haven't found the right way to style this. 


I'm sure this is just me approaching this the wrong way and using the wrong tags for my use case. Hopefully someone can enlighten me with the right approach :]


<apex:page standardController="Quote">
    <style type="text/css">
            font-size: 18px;
            text-decoration: underline;
            width: 50%;
            font-size: 18px;
        <apex:pageBlock >
            <apex:pageBlockSection columns="5" id="section">
            <!--Video Line-->
                <apex:pageBlockSectionItem dataStyle="width:5%">
                    <apex:outputLabel styleClass="label" >Redemption</apex:outputLabel>
                <apex:pageBlockSectionItem dataStyle="width:10%">
                    <apex:outputText value="{!Quote.Redemption_Quantity__c}" styleClass="text" />
                <apex:pageBlockSectionItem dataStyle="width:10%" >
                    <apex:outputText value="{0,number,##.##}%" styleClass="text">
                       <apex:param value="{!Quote.Redemption_Percentage__c}" />
                <apex:pageBlockSEctionItem dataStyle="width:10%">
                      <apex:outputText value="12345.34" styleClass="text"/>
                <apex:pageBlockSectionItem dataStyle="width:10%">
                    <apex:outputText value="12345.34" styleClass="text"/>
            <!--Video Line-->
                <apex:pageBlockSectionItem dataStyle="width:10%">
                    <apex:outputLabel styleClass="label" >Video</apex:outputLabel>
                <apex:pageBlockSectionItem dataStyle="width:10%">
                    <apex:outputText value="{!Quote.Video_Quantity__c}" styleClass="text" />
                <apex:pageBlockSectionItem dataStyle="width:10%" >
                    <apex:outputText value="{0,number,##.##}%" styleClass="text">
                       <apex:param value="{!Quote.Video_Percentage__c}" />
                <apex:pageBlockSEctionItem dataStyle="width:10%">
                      <apex:outputText value="12345.34" styleClass="text"/>
                <apex:pageBlockSectionItem dataStyle="width:10%">
                    <apex:outputText value="12345.34" styleClass="text"/>
                <apex:pageBlockSectionItem >
                              <apex:outputText value="{!Quote.QuantityChart__c}" escape="false" label=""/>







I'm trying to get into making some customizations with VF for the first time, so I may be missing something right off the bat. 


What I'm trying to do is replace the existing quote pdf that is generated. Specifically what I need to change is the order of how the items appear on the quote line items related list of the template. I knew going in that because the template is a pdf and not a regular page layout, I would need to completely override the functionality and start from scratch. After doing a little research on this, I think the best way to do it is a custom button to direct to a visualforce page that renders as a pdf, which was a pretty cool thing I just learned that you can do with vf pages. From there it would be rebuilding the structure of the page from the ground up, which shouldn't be a problem and I think, using a custom controller to set the order of the related list.


So, I got in a dev org to start some really early playing around with this before starting to work on it in a sandbox. The first thing  I tried was rendering as a pdf which worked great, but then I tried displaying the relatedlist and that's where I ran into problems. 


This is the markup I was using to test and the error is 'QuoteLineItem' is not a valid child relationship name for entity Quote 


<apex:page standardController="Quote">
<apex:detail relatedList="true" subject="{!Quote.Id}" title="test">
<apex:relatedList list="QuoteLineItem" rendered="true"/>


So, I couldn't find anywhere that said I couldn't use QuoteLineItems as a vf related list, but nowhere that said I could either. So I guess I have two questions, the first being obviously, can I reference the QuoteLineItem child relationship in Quote controller VF page, and if so, what am I doing wrong. 


The second, since I gave in and posted on here after hours of research, is whether or not I am going about this the right way. Is there an easier way to override the quote pdf with an end goal of reordering that related list?


Any help, tips, links to some good resources would be much appreciated. 



I am a 201, 301, 401 and soon to be 501 certified Salesforce Administrator/Developer. I have a year of experience working on the Salesforce platform and an advanced ability and knowledge of using the standard and declarative functionality to create complex business processes using workflow, formulas, visual flow etc., managing and moving data with the import/export tools, creating effective reports and dashboards using the report and dashboard builder, and my knowledge of formulas and other customizations and modeling data with best practice. I also have a strong interest in programming and have a moderate level of knowledge of apex and am learning as much as I can, as well as visualforce, soql and the other programmatic elements of the platform. I'm a Computer Programming and Database student online, and in addition to my Salesforce knowledge, I am experienced in relational databasing, programming with visual basic.net, javascript, php and have a working knowledge of java, ruby and python as well. I work in Aptana, Eclipse (for Java and Force.com use), Access, MySql, Word and Excel and a variety of other programs. 


If you are looking for a knowledgable and effective Salesforce administrator, developer or consultant, I am interested in talking to you. I am looking for a full time position. I am only able to work remotely at this time, but can travel as needed without a problem. 


If you would like to discuss any position with me you feel I would be a good fit for, please email me at kcplusplus@aim.com. I can provide more information on myself, my resume, linkedin profile and any other information needed. 


List<order_batch__c> bcList = new List<order_batch__c>();
        bcList= [select Or_sub_po_number__c,Or_customer_PO_Number__c,Or_customerid__c,Or_Account_name__c,Or_invoiceadd1__c,Or_invoiceadd2__c,Or_invoiceadd3__c,Or_invoiceadd4__c,Or_invoiceadd5__c,Or_contact_Phone__c,Or_contact_Fax__c,Or_Subcontact_family_name__c,Or_Subcontact_first_name__c,Or_contact_Name__c,Or_contact_Email__c,Or_Carrier__c,Order_Date__c,Or_Comments__c,Order_numbering__c,Or_clientpn__c,Or_Nicomatic_p_n__c,Quantity_Ordered__c,Requested_Date__c,Discount__c,Unit_price__c,Or_Quote_number__c,currencyisocode,id from order_batch__c  where  Quote_Line_Item__r.Quote1__c= : Apexpages.currentPage().getParameters().get('Id')];
        String JSONString = JSON.serialize(bcList);

In debug console:

12:39:38:127 USER_DEBUG [44]|DEBUG|(Order_batch__c:{Order_numbering__c=1, Or_contact_Email__c=c@gmail.com, Or_Nicomatic_p_n__c=123, Or_customerid__c=2, CurrencyIsoCode=CAD, Or_Comments__c=12, Or_invoiceadd1__c=4, Discount__c=false, Requested_Date__c=2014-09-01 00:00:00, Or_sub_po_number__c=BHARAT, Or_invoiceadd4__c=7, Or_Quote_number__c=NINAL140718548, Quote_Line_Item__c=a0LN0000000yWu4MAE, Or_invoiceadd3__c=6, Unit_price__c=11.0000, Or_invoiceadd5__c=8, Or_customer_PO_Number__c=BHARAT, Or_Account_name__c=3, Or_contact_Phone__c=97999999999, Or_Carrier__c=9, Id=a1EN00000001iBQMAY, Or_contact_Fax__c=123333333, Or_invoiceadd2__c=5, Quantity_Ordered__c=1.0000}, Order_batch__c:{Order_numbering__c=3, Or_contact_Email__c=c@gmail.com, Or_Nicomatic_p_n__c=456, Or_customerid__c=2, CurrencyIsoCode=CAD, Or_Comments__c=12, Or_invoiceadd1__c=4, Discount__c=true, Requested_Date__c=2014-09-02 00:00:00, Or_sub_po_number__c=BHARAT, Or_invoiceadd4__c=7, Or_Quote_number__c=NINAL140718548, Quote_Line_Item__c=a0LN0000000yWu3MAE, Or_invoiceadd3__c=6, Unit_price__c=2.0000, Or_invoiceadd5__c=8, Or_customer_PO_Number__c=BHARAT, Or_Account_name__c=3, Or_contact_Phone__c=97999999999, Or_Carrier__c=9, Id=a1EN00000001iGtMAI, Or_contact_Fax__c=123333333, Or_invoiceadd2__c=5, Quantity_Ordered__c=12.0000}, Order_batch__c:{Order_numbering__c=2, Or_customerid__c=2, Or_Comments__c=12, Discount__c=false, Order_Date__c=2014-09-01 00:00:00, Or_sub_po_number__c=BHARAT, Or_invoiceadd4__c=7, Or_invoiceadd3__c=6, Or_contact_Phone__c=97999999999, Or_invoiceadd2__c=5, Or_contact_Email__c=c@gmail.com, Or_Nicomatic_p_n__c=123, CurrencyIsoCode=CAD, Or_invoiceadd1__c=4, Requested_Date__c=2014-09-01 00:00:00, Quote_Line_Item__c=a0LN0000000yWu4MAE, Or_Quote_number__c=NINAL140718548, Unit_price__c=1.0000, Or_invoiceadd5__c=8, Or_customer_PO_Number__c=BHARAT, Or_Account_name__c=3, Or_Carrier__c=9, Id=a1EN00000001iBLMAY, Or_contact_Fax__c=123333333, Quantity_Ordered__c=1.0000})

How i can send the same order like in the list i specified
I already have everything set up to send a post request to another CRM. It was done for me by a devolper, I need to create another one for a new company. Where do I get started?? Thanks for any help!
I want authenticate user by soap to web when new job is create by clicking on oportunity tab.

I need a little help with the Web service authentication php script. i am beginner and i have lot of doubts with it.
how to rollBack apex job by using Database.Savepoint 

I need to render the background color of a cell based on the value in the cell. The value is retrieved from the a map generated by the controller. The background color will be one of seven colors based on the value retrieved. I have a method written that sets the value of the color as a string and takes the value of the rendered double as an arguement.

It's returning an error "Unknown property 'heatMapController.color'. I figured out from other posts in the forum about this error  that the system is looking at the statement:


as a function instead of a method call, but how do I call the method and pass the value in?  The method signature is:  String getColor(Double Val)

Here is the method:
public string getColor(Double val){
        color = '';
        if(val >= 0 && val < 25){
        if(val >= 25 && val < 50){
        if(val >= 50 && val < 75){
        if(val >= 75 && val < 85){
        if(val >= 85 && val < 95){
        if(val >= 95 && val < 100){
        if(val == 100){
        return color;

And this is how I'm calling it:

<apex:column headervalue="SitNum" style="{!color(defendNTAPNum[o.id])}">

Thank you for your feedback!
What its supposed to do:
When a change record is closed, it pulls a list of related cases.  You can check a box next to the cases you want closed with this change record.  It should then change the Status to Closed - Resolved.  For the cases that aren't checked, I want the Status to change to Pending - RCA.  I get the pop up with the list of cases to be checked or not, but upon save I get Duplicate id in list error with the ID of one of the cases I didn't check.  Please help!

public class CW_wrapperClassController {
String[] defects = new String[]{};
    public CW_wrapperClassController() {
private final Change__c chg;
    public CW_wrapperClassController(ApexPages.StandardController controller) {
     chg = (Change__c) controller.getRecord();
     chg.StatusChange__c = 'Completed';

    //Our collection of the class/wrapper objects cCase(just a name)
    public List<cCase> caseList {get; set;}

    //This method uses a simple SOQL query to return a List of Cases associated with this change record
    public List<cCase> getCases() {
         if(caseList == null) {
           caseList=new List<cCase>();
             List<ID> caseIDS = new List<ID>();
             for(Case_Change_Association__c CCA:[select Case__c from Case_Change_Association__c where Change__c=:chg.ID]){
             for(Case c:[select CaseNumber, Defect_Type_Multi__c from Case Where Status != 'Closed - Resolved' AND ID in:caseIDS]){
             caseList.add(new cCase(c));
             return caseList;
        public List<SelectOption> getItems() {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('HARDWARE','Hardware'));
            options.add(new SelectOption('SOFTWARE','Software'));
            options.add(new SelectOption('INFRASTRUCTURE','Ingrastructure'));
            options.add(new SelectOption('CONFIGURATION','Configuration'));
            options.add(new SelectOption('MINE MODEL','Mine Model'));
            options.add(new SelectOption('TRAINING','Training'));
            options.add(new SelectOption('DOCUMENTATION','Documentation'));
            options.add(new SelectOption('PROCESS','Process'));
            options.add(new SelectOption('3RD PARTY SERVICE PROVIDER','3rd Party Service Provider'));
            return options;
    public PageReference processSelected() {

        //We create a new list of Cases that we be populated only with Cases if they are selected
        List<Case> selectedCases = new List<Case>();
        List<Case> unselectedCases = new List<Case>();
        List<Case> selectedcasesToUpdate = new List<Case>();
        List<Case> nonselectedcasesToUpdate = new List<Case>();

        //We will cycle through our list of cCase and will check to see if the selected property is set to true, if it is we add the Case to the selectedCases list
        for(cCase cCs: getCases()) {
            if(cCS.selected == true) {
            //Adding a list for unselected cases to be processed
            if(cCS.selected == false){
        // Now we have our list of selected cases and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
        //System.debug('These are the selected Cases...');
        for(Case cs: selectedCases) {
           cs.Status = 'Closed - Resolved';
           cs.Change_Closing_Comments__c = chg.Closing_Comments__c;
              cs.Incident_Resolved_Internal__c = chg.Implementation_End_Date_Time__c;
        //Processing unselected cases.
        for(Case csun: unselectedCases){
            csun.Status = 'Pending - RCA';
            //csun.OwnerId = chg.Change_Implementer__c;
        //Updating a list of cases, instead of each case within a FOR, for bulkification.
        update selectedcasesToUpdate;
        //Updating the change record, since the status is already set as "completed" above.
        update chg;
        update nonselectedcasesToUpdate;
        caseList=null; // we need this line if we performed a write operation  because getCases gets a fresh list now
        PageReference redirect = new PageReference('/'+chg.ID);
        return redirect;
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Case and a Boolean value
    public class cCase {
        public Case cs {get; set;}
        public Boolean selected {get; set;}

        //This is the contructor method. When we create a new cCase object we pass a Case that is set to the con property. We also set the selected value to false
        public cCase (Case c) {
            cs = c;
            selected = false;
        }    }
   public String[] getDefect() {
    return defects;
    public void setDefect(String[] defects) {
            this.defects = defects;
  • May 12, 2014
  • Like
  • 0
A customer has tried installing our managed package with a package URL and they are receiving a 'Package install failed error'. I've tried searching for this particular error number in these forums but have not come up with anything. Can someone from Salesforce let me know what this error number means?

Error Number: 1482398671-14041 (1028436933)
Package Install Failed
An error has occurred during a package install operation.

I filed a case with more details about the org but was directed to ask for help here.

 I want to store below visualforce code inside controller based on the selection is made .

<apex:pageBlockSectionItem >
   <apex:outputLabel value="Expiry Term:" for="expireterm"/>
   <apex:selectList value="{!ExpireTerms}" multiselect="false" size="1" id="expterms" readonly="true">
                <apex:selectOption itemValue="1" itemLabel="1 Year"/>
                <apex:selectOption itemValue="3" itemLabel="3 Year"/>
                <apex:selectOption itemValue="5" itemLabel="5 Year"/>

<apex:pageBlockSectionItem >
   <apex:outputLabel value="Expiry Term:" for="expireterm"/>
   <apex:selectList value="{!ExpireTerms}" multiselect="false" size="1" id="expterms" readonly="true">
                <apex:selectOption itemValue="1" itemLabel="1 Year"/>
                <apex:selectOption itemValue="3" itemLabel="3 Year"/>
                <apex:selectOption itemValue="5" itemLabel="5 Year"/>

Please suggest me.


Hi all,

I have build visualforce pages for force.com site to show case our products on website.

Everything is fine but when i search a product on google search i am not able to find the product which we are displaying on our website.

Is there any process or additional code required  for search. plz help

Thank you.

Hi friends,

I have a requirement to check for holidays. I am quering the ActivityDate from Holiday in my controller which gives me a list. But the ActivityDate is not getting the proper holiday date. The date which is coming in the ActivityDate is nowhere related to the correct holiday.I didnt find any other field in holiday to fetch the required dates.
I am not sure whether the issue is because of recent release.
Can anyone help in fixing the issue?

Thanks in advance
It was working fine till yesterday. Suddenly its giving me the above error in DEBUG Logs and in Apex jobs page it gives First error: AsyncApexExecutions Limit exceeded.

can some one please help me.
Thanks in advance.

global class DEREDistributer implements Database.Batchable<sObject>, Database.AllowsCallouts,Database.stateful {
  global integer x=0;

global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT Name,Times_The_Lead_Is_Distributed__c,Hawaii__c,SV_Priority_Hidden__c, Id, AssignToUserId_Hidden__c FROM Lead WHERE IsConverted =false and Hawaii__c = false and To_Be_Distributed__c=true and DE_Synched__c=true and Is_Distributed__c =True ';
        return Database.getQueryLocator(query);
  global void execute(Database.BatchableContext BC, List<Lead> scope) {
  List<Team1__c> L1 = [SELECT Name,CheckIn__c From Team1__c Where CheckIn__c = True]; 
  integer i = L1.size();
integer z=1;

//Initialize the AZ Qualification Team   
  for(Team1__c L2 :[SELECT Name,CheckIn__c,UserId__c From Team1__c] )
  If(L2.CheckIn__c == True)
     L2.UserId__c = z++;
     update L2;
  L2.UserId__c =0;
  update L2;
  for (Lead e : scope) {
//assingn user id,distribution count and distributed flag.   
  decimal y =  e.Times_The_Lead_Is_Distributed__c;
  e.AssignToUserId_Hidden__c = math.MOD(x, i) + 1;
  e.Is_Distributed__c =True;
   e.Times_The_Lead_Is_Distributed__c = y +1;

      Update scope;
  global void finish(Database.BatchableContext BC) { }
I have a VisualForce page that is a drop-in element used in a standard page layout.  In my VF, I've got Javascript that's trying to get some elements of the main page and then run a pre-existing method, like this:

var imgs = document.getElementsByTagName('img');

for(var x in imgs)
  if ( imgs[x].className=='hideListButton' && imgs[x].alt.indexOf("ICOMM") != -1)
     { twistSection(imgs[x]) ; }

but the imgs collection is always showing up empty.  fine, I then try to use parent.document.getElementsByName() and it blows up, same thing with top.document.getElementsByName().

this code works fine if it's embedded in a JS button on the same page...but VF in this use case is somehow obscuring the parent and top pages.

The goal of this code is to make it so that some collapsible sections of the page are collapsed by default on page load.

I want to rollback whole batch process when single record in any batch gets failed. I want to know how to use DML options optallornone property in batch...........
Can we do DML operations using Jquery or DML operations are possible through Jquery?
Can we able to insert records using Java script?
once record edited we have to submit approval action to that record?

thanks in Advance friends
I am new to salesforce coding and i am having a requirement:
I have one text field on my visualforce page where a user will put youtube URL and there is a preview button on click of which he should be able to see the preview of the video on the same page without saving it to database.After he is done with preview there is a save button on click of which he should be able to save it(by save i mean save the Youtube URL) to  some object.I explored and came to know salesforce provide preview feature only for the file attached through feeder which gets stored in content document object but since my video size can be large in size I dont want to go by that way of previewing a video.Can some one please suggest any solution or code examples to do this.Thanks In advance.
  • January 23, 2014
  • Like
  • 0