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


  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 84
    Replies
Apex:

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')];
       system.debug(bcList);
        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 
Hi,

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:

style="{!color(defendNTAPNum[o.id])}"

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){
            color='background-color:#FF0000;';
        }
        if(val >= 25 && val < 50){
            color='background-color:#FF1493;';
        }
        if(val >= 50 && val < 75){
            color='background-color:#FFB6C1;';
        }
        if(val >= 75 && val < 85){
            color='background-color:#FFFF00;';
        }
        if(val >= 85 && val < 95){
            color='background-color:#ADFF2F;';
        }
        if(val >= 95 && val < 100){
            color='background-color:#9ACD32;';
        }
        if(val == 100){
            color='background-color:#228B22;';
        }
        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]){
             caseIDS.add(CCA.Case__c);
             }
             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) {
                selectedCases.add(cCS.cs);
            }
            //Adding a list for unselected cases to be processed
            if(cCS.selected == false){
                unselectedCases.add(cCS.cs);
                }
            }
       
        // 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;
           if(cs.Incident_Resolved_Internal__c!=NULL)
           {
              }else{
              cs.Incident_Resolved_Internal__c = chg.Implementation_End_Date_Time__c;
           }    
           //update(cs);  
           selectedcasesToUpdate.add(cs);
        }
        //Processing unselected cases.
        for(Case csun: unselectedCases){
            csun.Status = 'Pending - RCA';
            //csun.OwnerId = chg.Change_Implementer__c;
            //update(csun);
            nonselectedcasesToUpdate.add(csun);
           
        }
        //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);
        redirect.setredirect(true);
        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;
        }}
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.
Hi,

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

VisualForce
<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:selectList>
   </apex:pageBlockSectionItem> 

<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:selectList>
   </apex:pageBlockSectionItem> 


Please suggest me.

Thanks
Sudhir

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;
     }
  else
  {
  L2.UserId__c =0;
  update L2;
  }  
  }
  for (Lead e : scope) {
 
//assingn user id,distribution count and distributed flag.   
  x++;
  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.

Ideas???
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
Hi,
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.