• Enreeco
  • SMARTIE
  • 618 Points
  • Member since 2013
  • Solution Architect
  • Webresults s.r.l.


  • Chatter
    Feed
  • 17
    Best Answers
  • 2
    Likes Received
  • 73
    Likes Given
  • 3
    Questions
  • 213
    Replies
How could I insert a product in Opportunity by the Apex (the problem is because the sentence is for tests, so how I do this?).
 
public class Teste {

    public void teste1(){
        // Insert Product
        Product2 pr = new Product2();
        pr.Name='Moto - G1';
        pr.isActive=true;
        insert pr;
        
        // Insert Pricebook
        PriceBook2 customPriceBook = new PriceBook2();
        customPriceBook.Name='Custom Pricebook';
        customPriceBook.IsActive=true;
        insert customPriceBook;
        
        // Query Standard and Custom Price Books
        Pricebook2 customPriceBookRec=[select Id from Pricebook2 where id=:customPriceBook.Id];
        Id stdPriceBookRecId = Test.getStandardPricebookId();
        
        // Create Standard PriceBookEntry
        PriceBookEntry stdPriceBookEntry = new PriceBookEntry();
        stdPriceBookEntry.Product2Id=pr.Id;
        stdPriceBookEntry.Pricebook2Id=stdPriceBookRecId;
        stdPriceBookEntry.UnitPrice=2000;
        stdPriceBookEntry.IsActive=true;
        insert stdPriceBookEntry;
        // Create Custom PriceBookEntry
        PriceBookEntry customPriceBookEntry = new PriceBookEntry();
        customPriceBookEntry.Product2Id=pr.Id;
        customPriceBookEntry.Pricebook2Id=customPriceBookRec.Id;
        customPriceBookEntry.UnitPrice=5000;
        customPriceBookEntry.IsActive=true;
        insert customPriceBookEntry;
        
        // Create Opportunity
        Opportunity opp = new Opportunity();
        opp.Name = 'Test';
        opp.CloseDate= System.Today();
        opp.StageName='Prospecting';
        insert opp;
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem = new OpportunityLineItem();
        oppLineItem.OpportunityId = opp.Id;
        oppLineItem.PricebookEntryId = customPriceBookEntry.Id;
        oppLineItem.UnitPrice = 7000;
        oppLineItem.Quantity = 5;
        insert oppLineItem;
    }
}

Please, help me.
I have some code that displays dynamic values in a selectlist

                <apex:pageBlock >
                    <apex:pageBlockTable value="{!Sample}" var="field" styleClass="table table-striped">
                        <apex:column value="{!Sample[field][0]}" headerValue="Salesforce Field"/>
                        <apex:column headerValue="CSV Field">
                             <apex:selectList value="{!Sample[field][1]}" styleClass="form-control" size="1">
                                 <apex:selectOptions value="{!csvField}"/>
                             </apex:selectList>
                         </apex:column>
                         <apex:column >
                         </apex:column>
                    </apex:pageBlockTable>
                </apex:pageBlock>

the problem is I want to remove the value that one selectlist has chosen
ex. options = Name, Gender, Age
I want to remove Name from other selectlist if one of the selectlist chooses it. It's my first time so I don't know how to do it.
The dynamic values in the selectlist are from an uploaded csv file.
Hi,
We have 1000 licenses in my org, in that few are not login regularly, I what to deactivate them automatically those are not using from last one month.

Please any one can suggest me, how can we achieve this?

Regards,
Shaik
  • December 21, 2014
  • Like
  • 0
I have a unit test that is running successfully however I cannot open the results in the developer console. Getting an error: Failed
to load data Log from Salesforce.com: Other unit test do open up in the devveloper console so I'm not sure why these recent test do not.. Any ideas on what could be casuing this ? 

User-added image

Unit test:
@isTest
private class UnitTest_Driver {
  
  //Test coverage for New Driver Creation (VF page) 
  static testmethod void testNewDriver() {

      
    Account acct = UtilityAudit.getAccount();
    insert acct;
    Audit__c audit = UtilityAudit.getAudit(acct.Id);
    insert audit; 
    Auto_Audit_Sample_Policy__c sample = UtilityAudit.getAuto_Audit_Sample_Policy(audit.Id);
    insert sample;
     Auto_Drivers__c driver = UtilityAudit.getAuto_Drivers(sample.Id);
     //driver.Driver_Birth_Year__c = '9999';
    insert driver;

    //initiate the VF page
    PageReference pageRef = Page.PROD_Audit_Auto_DriverSample_New;
    Test.setcurrentPage(pageref);
       //these parms are passed via custom button ?accId={!Audit__c.Id}&sampleId={!Auto_Audit_Sample_Policy__c.Id}
    Apexpages.currentPage().getParameters().put('AccId', audit.Id);
    Apexpages.currentPage().getParameters().put('sampleId', sample.Id);
 
    //create standard controller and extended controller instance
    ApexPages.StandardController sc = new ApexPages.standardController(driver);
    ParentChildExtensionDRIVERsample_New testDriverPage = new ParentChildExtensionDRIVERsample_New(sc);


    //save the controller to get the URL
    String testPage = sc.save().getUrl();
    System.debug('TestPage result:' + testPage);

    // Verify that page fails without parameters
    // System.assertEquals('/apex/failure?error=noParam', testPage);



    //TODO
    String accID=ApexPages.currentPage().getParameters().get('AccId');
    System.debug('accID: ' + accID);
    String sampleID=ApexPages.currentPage().getParameters().get('sampleId');
    System.debug('sampleID: ' + sampleID);
    
    List< Audit__c> drivers = [ select Id, Driver_Information__c, Age__c, Gender__c, Marital_Status__c, Named_Insured_Add_Driver__c, Occupation__c, Business_Use__c, MVR_Violations__c, Credit_Scoring__c                
         from Audit__c 
         where Id = :ApexPages.currentPage().getParameters().get('accId')]; 
    System.debug('Age : ' + drivers[0].Age__c );
    
  } 
}

 
Hi ,

I am new to Angular JS. I wrote the below code. Seems its not working. Can anyone tell where the mistake has happened.

<apex:page applyhtmltag="false" showheader="false">
   <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.min.js"/> 
  <div ng-app="app">
    <div>
         Name:<input ng-model="name" type="text"/>
         Hello {{name}}
    </div>
  </div>
</apex:page>

Regards
Visualforcepage:
 
<apex:commandButton value="CLICK TO CREATE ORDER" action="{!post}" disabled="{!hide}" >

<apex:commandButton onclick="insert_numbers()" action="{!save}" 
                value="Insert Numbers and Save" rerender="mytable" />

Apex Coding:
 
public PageReference save() {  
     update ob; 
     refreshPage=true;             
     return null;    
    }

  public void post(){        
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http(); 
        req.setMethod('POST' ); // Method Type

What i am doing .I am updating in the save button and http post is done in the second button.

I have tried to update it on post method but it is not taking .

I want to use only one button for these two actions .How can i do it
Hai All,
I am facing a Problem while deploying Trigger into Production.I am Facing the below error while deploying:

Error Message
testAccountHierarchy testAccountHierarchy System.Exception: Apex CPU time limit exceeded
Stack Trace: Class.InlineAcountHerachy_TestUtilities.checkObjectCrud: line 39, column 1 Class.InlineAcountHerachy_TestUtilities.updateAccountList: line 101, column 1 Class.AccountHierarchyTestData.createTestHierarchy: line 33, column 1 Class.testAccountHierarchy.testAccountHierarchy: line 6, column 1.

This is because of a Class .InlineAcountHerachy_TestUtilities that we installed from Appexchange developed by Force.com Labs.
This is the name of the app Inline Account Hierarchy, please find the link
https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016chCEAQ.

Please anyone help me on this issue and tell me how to resolve this quickly because this is little bit urgent .Because of this i am  not able to share Accounts .

I am attaching the scrrenshot of the Error Message for reference.

User-added image
hi all,
i need to get the ids of all the contacts associated to an event.
i.e the contacts that we add into the name field.
However,when i query the whoId field,i just get the primary contact id and not all the other assciated contact ids.

can anyone please help?
Hi All,
I am trying for test coverage for one class as below
Class::
Public class sample123{
    public sample123(){
    
    }
     public PageReference PostBtn(){   
    
        // Workaround for getting the current page name
        String pageName = ApexPages.CurrentPage().getUrl();          
        pageName = pageName.replaceFirst('/apex/','');         
        pageName = EncodingUtil.urlEncode(pageName, 'UTF-8');         
        string[] pageNameExtra = pageName.split('%3F',0);                    
        pageName = pageNameExtra[0];         
        
        pagereference pr = new pagereference('/apex/sample?prevpg='+pageName);
        pr.setredirect(true);
        return pr;  
    }
}

Test class::
Public class sampletest{
     public static testmethod void sample123Method(){
        sample123 smp = new sample123();
        apexpages.currentpage().getparameters().put('/','/apex/');
        smp.PostBtn();
    }

}

I am getting this error 'System.NullPointerException: Attempt to de-reference a null object' at the execution of this statement
pageName = pageName.replaceFirst('/apex/','');

Please give me solution for this test coverage, thanks in advance
 
I get an "UNKNOWN_EXCEPTION" error when I try to save a component after adding a ui:inputSelect component. I'm following the examples provided here: http://documentation.auraframework.org/auradocs#reference?descriptor=ui:inputSelect&defType=component (http://documentation.auraframework.org/auradocs#reference?descriptor=ui:inputSelect&defType=component" target="_blank). Are the examples incorrect?
  • November 05, 2014
  • Like
  • 1
Below is my code. The case record through debug log says it updates however it does not populate the field on the record.  When I run the code through Developer Console and run it anonyomusly the code runs properly and the field populates on the record.  
This code is part of a TriggerHandler class for Case on BeforeUpdate.  Basically anytime a case is update where:
Case Reason = Withdrawal
Case Sub_Type__c = Multiple
and I get the Banking_Site value from the first record in the related list Failed_Transactions
and populate the case field ExtAPIBankSite__c with the value.



        set<ID> myCase = new set<ID>();
        list<Case> cList = new list<case>();
        Map<Id,String> cMap = new map<Id,String>();
       
        for(Case c : lstCases){
            if(c.Reason == 'Withdrawal' && c.Sub_Type__c == 'Multiple'){
                if(c.ExtAPIBankSite__c == null){
                    myCase.add(c.id);  
                }                                   
            }
        }
       
       cList = [SELECT Id,ExtAPIBankSite__c,(SELECT Id,Banking_Sites__c FROM Failed_Transactions__r ORDER BY Process_Order__c ASC Limit 1)FROM      Case WHERE Id in:myCase];
       
        for(Case cLoop : cList){                     
            cMap.put(cLoop.Id,cLoop.Failed_Transactions__r[0].Banking_Sites__c);
            if(cMap.get(cLoop.Id)!= null){                               
                 cLoop.ExtAPIBankSite__c = cMap.get(cLoop.Id);
            }
        }
     }
Hi,

I am new to SalesForce and having research.  I had created developer free license user.
I had created two user with Salesforce Platform user license and one with System Administrator.  I observed i can accces data using system administrator. But while accessing the Product2 object using Salesforce Platform user license. It gives following error.

https://workbench.developerforce.com/restExplorer.php

select name,id from product2 ^ ERROR at Row:1:Column:21 sObject type 'product2' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

Please need your help to understand why i can't access. Is this limitation because of license or i am doing something wrong here.

Thanks
Hello...

I tried to get a value into pageBlockTable and to delete the line table (a job)... but the job isnt deleted.
Why??

Thank you
public String strJobName {get;set;}

//CONSTRUTOR:
global Class() {strJobName='';}

public void deleteJob() {
if(strJobName != '')
{
    idJobDel= new List<CronTrigger>();
    idJobDel= [SELECT  Id FROM CronTrigger where CronJobDetail.Name =: strJobName];
    System.abortJob(idJobDel[0].id);
   }
   else
{
system.debug('NOT NAME');
}
}

PAGE:

          <apex:actionfunction name="callDeleteJob" action="deleteJob" rerender="pbBlockTable">
              <apex:param name="JobName" value="" assignTo="{!strJobName}" />
          </apex:actionFunction>
          
          <apex:pageBlockTable value="{!jobRecords}" var="ac" id="pbBlockTable">
              <apex:column headervalue="Name Job" value="{!ac.CronJobDetail.Name}"/>
                <apex:column headervalue="Status" value="{!ac.State}"/>
                <apex:column headervalue="Expression" value="{!ac.CronExpression}"/>
                
                <apex:column><apex:commandButton value="X" onClick="callDeleteJob('{!ac.CronJobDetail.Name}')"/> </apex:column>
                  
              </apex:pageBlockTable>

I'm new to triggers and apex, but was attempting a simple trigger to create a child object on Contact object. Goal is to establish a contact to account relationship when creating a contact using the contacts Name and Account to populate the relationship object. Here is the trigger I wrote, which worked in Sandbox.

trigger CreateContactAccountAssociation on Contact (after insert)
{    List<Contact_Account_Association__c> Associations = new List<Contact_Account_Association__c>();
 
    //For each Contact processed by the trigger, add a new
    //Association record for the specified user.
    //Note that Trigger.New is a list of all new Contacts
    //That are being created.
 
    for (Contact newContact: Trigger.New) {
        if (newContact.RecordTypeId !='012700000009iHg' ) {
            Associations.add(new Contact_Account_Association__c(
                Account__c = newContact.AccountId,
                Contact__c = newContact.Id));
        }
    }

    insert Associations;
}

Trigger worked in Sandbox......Created below apex class  which passed in Sandbox

@IsTest(SeeAllData=True)
public class TestTrigger {

    static testmethod void insertContact() {
  
        Contact u = new Contact();
      
            u.Salutation = 'Mr.';
            u.FirstName = 'Test';
            u.LastName = 'Trigger';
            u.AccountId = '00170000011BckQ';
      
        insert u;
    }
}

Received below errors when deploying to production

Deployment Validation Errors

Any assistance is appreciated!!
Hi,

I have a requirement to display/provide download link to the http blob response in visualforce page.
I am able to create a new attachment/document from blob value and provide a download link to that in vf page using {!URLFOR($Action.Attachment.Download,ReportName)}".
But i dont want to create a new attachemnt, just pass it from apex to vf page.
Any ideas ?

Thanks
Sid
Getting error 'Object reference not set to an instance of an object.' when adding 'implements Database.Batchable<sObject> to a class.
I'm using BrainEngine 5.0.1.81. Eclipse won't save to the server either.


global  class TransactionExclusionFromSSISHiHwBatch implements Database.Batchable<sObject>
{
}
I've found tons of information on how to render a Visualforce page as PDF; but that's not what I want to do.

I have a PDF that I've added to a zip file and uploaded as a static resource.

I now want to create a Visualforce page, with a link that when clicked a new browser tab is launched and the PDF from the static resource is displayed to the user.

Any assistance is always appreciated!

Virginia
Hello guys! I'm just wondering if it is possibile to retrieve Einstein certificate if I lose it?
May the Force.com be with you!
Hello everyone!
I'm trying to configure the login page on my client's ORG (both sandbox and production) and change it to a custom Visual Force page.
But every time I save the changes, it resets back to "Default Page".
I've succesfully did it in other ORGs, so what could be wrong with this ORG (permissions? profiles?).
User-added image
Hi big audience!
I've developer several components since the release of Lightning framework but I still have a strange problem.
When I load external libraries (most common case is Bootstrap and jQuery) sometimes the jQuery library is not correctly loaded on startup, thus causing problems on dynamically loaded UI.
The docs say I should use the "renderer" with the afterRender event, but doing this I don't see any trace of jQuery (like it is not yet loaded, the $ plugin is undefined), so I can't init my UI from that method.
This leads to random crash of the app on first load, because sometimes the jQUery library is not loaded on startup.
Do you have any suggestions on this?
I'm currently using "setTimeout" to run the UI initializazione asynchronously, but I don't think this is a clean and good solution.
Thanks
Enrico
 
Hi big audience!
I've developer several components since the release of Lightning framework but I still have a strange problem.
When I load external libraries (most common case is Bootstrap and jQuery) sometimes the jQuery library is not correctly loaded on startup, thus causing problems on dynamically loaded UI.
The docs say I should use the "renderer" with the afterRender event, but doing this I don't see any trace of jQuery (like it is not yet loaded, the $ plugin is undefined), so I can't init my UI from that method.
This leads to random crash of the app on first load, because sometimes the jQUery library is not loaded on startup.
Do you have any suggestions on this?
I'm currently using "setTimeout" to run the UI initializazione asynchronously, but I don't think this is a clean and good solution.
Thanks
Enrico
 
Hi, 
The content of my WSDL is as such:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www........">
<soapenv:Header/>
<soapenv:Body>
<sch:InsertValueRequest>
<credential>
<userName> </userName>
<password> </password>
</credential>
<ActorVO>
    <value1> </value1>
    <value2> </value2>
    <value3> </value3>
    <value4> </value4>    
</ActorVO>
<sch:InsertValueRequest>
All the apex class was generated successfully with the WSDL. A class was created which contain the credential parameter and one which contain the values.

The problem I am facing is that when I send the request, the request is generated without the credential part, hence no request is done between the external service and salesforce. How can I modify my request being it is send?

Viewed from the debug log, i noticed the request is generated as such : 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www........">
<soapenv:Header/>
<soapenv:Body>
<sch:InsertValueRequest>
<values>
<value1> </value1>
<value2> </value2>
<value3> </value3>
<value4> </value4>
</values>
<sch:InsertValueRequest>

Below is my sample class: 

public class ActorSchema {
    public class Credential {
            public String userName;
            public String password;
            private String[] userName_type_info = new String[]{'userCode','http://.......',null,'0','1','true'};
            private String[] password_type_info = new String[]{'password','http://.....',null,'0','1','true'};        
            private String[] field_order_type_info = new String[]{'userName','password'};
        }
        
    public class ActorVO {
        public String value1;
        public String value1;
        public String value1;
        public String value1;
        private String[] apex_schema_type_info = new String[]{'http://......','false','false'};
        private String[] field_order_type_info = new String[]{'value1','value2','value3','value4'};
    }    
}


public class ActorActorimport {
    public class InsertActorResponse_element {
        public ActorSchema.ActorVO actorVO;        
        private String[] actorVO_type_info = new String[]{'actorVO','http://......',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://......','true','false'};
        private String[] field_order_type_info = new String[]{'actorVO'};
    }
    public class InsertActorRequest_element {
        public ActorSchema.ActorVO actorVO;
        private String[] actorVO_type_info = new String[]{'actorVO','http://.....',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://.....','false','false'};
        private String[] field_order_type_info = new String[]{'actorVO'};            
    }
    
    public ActorSchema.ActorVO InsertActor(ActorSchema.ActorVO actorVO) {
                ActorActorimport.InsertActorRequest_element request_x = new ActorActorimport.InsertActorRequest_element();                        
                request_x.actorVO = actorVO;           
                ActorActorimport.InsertActorResponse_element response_x;
                Map<String, ActorActorimport.InsertActorResponse_element> response_map_x = new Map<String, ActorActorimport.InsertActorResponse_element>();            
                response_map_x.put('response_x', response_x);
                WebServiceCallout.invoke(
                  this,
                  request_x,
                  response_map_x,
                  new String[]{endpoint_x, '','http://......', 'InsertActorRequest', 'http://......','InsertActorResponse','ActorActorimport.InsertActorResponse_element'}
                );
                response_x = response_map_x.get('response_x');            
                return response_x.actorVO;
            }
}

=============My Request==========
ActorActorImport.ActorImportServicePort test1 = new ActorActorImport.ActorImportServicePort();
test1.clientCert_x = ' ';
//test1.clientCertName_x = ' ';
test1.clientCertPasswd_x = ' ';
test1.endpoint_x = 'http://......';
test1.timeout_x = 50000;
 
ActorSchema.ActorVO actorVo = new ActorSchema.ActorVO();
actorVo.value1 = 'val1';
actorVo.value2 = 'val2';
actorVo.value3 = 'val3';
actorVo.value4 = 'val4';

test1.InsertActor(actorVo);

Please help!!!
How to Get Content Type if content type is blank in attchment object.Is there any method that help to get content type with using Name Field of attchment object.


Thanks
 
Hey everybody!

I'm trying to write my first wrapper class whic will allow me to create records related to both a custom object (Site__c) and the Quote object. What I am having an issue with is passing the QuoteId to the SOQL query on line 11. I have tried it with a hardcoded QuoteId and it works correctly. Right now when I try and save it gives me the error 'Invalid bind expression type of Object for column of type Id'. 

What is the issue here? Is it because of the standard controller is my other custom object (Associated_Location__c)? Thanks in advance! 

Apex:
public with sharing class quoteAssociatedSiteExtension {

	//Our collection of the class/wrapper objects cContact 
	public Quote theQuote {get; set;}
    public List<assLoc> assLocList {get; set;}
    
    
    public quoteAssociatedSiteExtension(ApexPages.StandardController controller) { 

        controller.addFields(new List<String>{'Quote__c'});
		theQuote = [select Id, AccountId from Quote where Id =:controller.getRecord().get('Quote__c') limit 1];
    }

	//This method uses a simple SOQL query to return a List of Contacts
	public List<assLoc> getAssLoc() {
		if(assLocList == null) {
			assLocList = new List<assLoc>();
			for(Site__c s: [select Id, Name, Account__r.Id from Site__c where Account__r.Id=:theQuote.AccountId limit 10]) {
				// As each contact is processed we create a new cContact object and add it to the contactList
				assLocList.add(new assLoc(s));
			}
		}
		return assLocList;
	}


	public PageReference processSelected() {

                //We create a new list of Contacts that we be populated only with Contacts if they are selected
		List<Associated_Location__c> selectedAssociatedLocations = new List<Associated_Location__c>();

		//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
		for(assLoc aLoc: getAssLoc()) {
			if(aLoc.selected == true) {
				selectedAssociatedLocations.add(aLoc.ac);
			}
		}

		// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
		System.debug('These are the selected Contacts...');
		for(Associated_Location__c ac: selectedAssociatedLocations) {
			system.debug(ac);
		}
		assLocList=null; // we need this line if we performed a write operation  because getContacts gets a fresh list now
		return null;
	}


	// 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 Contact and a Boolean value
	public class assLoc {
		public Associated_Location__c ac {get; set;}
        public Site__c st {get; set;}
        public Quote qt {get; set;}
		public Boolean selected {get; set;}

		//This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
		public assLoc(Associated_Location__c a) {
			ac = a;
			selected = false;
		}
        
        public assLoc(Site__c s) {
			st = s;
			selected = false;
		}
        
		public assLoc(Quote q) {
			qt = q;
			selected = false;
		}        
	}
}

Visualforce: 
 
<apex:page standardController="Associated_Location__c" extensions="quoteAssociatedSiteExtension">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cContact records -->
            <apex:pageBlockTable value="{!AssLoc}" var="a" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!a.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cContact container/wrapper -->
                <apex:column value="{!a.st.Name}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
How could I insert a product in Opportunity by the Apex (the problem is because the sentence is for tests, so how I do this?).
 
public class Teste {

    public void teste1(){
        // Insert Product
        Product2 pr = new Product2();
        pr.Name='Moto - G1';
        pr.isActive=true;
        insert pr;
        
        // Insert Pricebook
        PriceBook2 customPriceBook = new PriceBook2();
        customPriceBook.Name='Custom Pricebook';
        customPriceBook.IsActive=true;
        insert customPriceBook;
        
        // Query Standard and Custom Price Books
        Pricebook2 customPriceBookRec=[select Id from Pricebook2 where id=:customPriceBook.Id];
        Id stdPriceBookRecId = Test.getStandardPricebookId();
        
        // Create Standard PriceBookEntry
        PriceBookEntry stdPriceBookEntry = new PriceBookEntry();
        stdPriceBookEntry.Product2Id=pr.Id;
        stdPriceBookEntry.Pricebook2Id=stdPriceBookRecId;
        stdPriceBookEntry.UnitPrice=2000;
        stdPriceBookEntry.IsActive=true;
        insert stdPriceBookEntry;
        // Create Custom PriceBookEntry
        PriceBookEntry customPriceBookEntry = new PriceBookEntry();
        customPriceBookEntry.Product2Id=pr.Id;
        customPriceBookEntry.Pricebook2Id=customPriceBookRec.Id;
        customPriceBookEntry.UnitPrice=5000;
        customPriceBookEntry.IsActive=true;
        insert customPriceBookEntry;
        
        // Create Opportunity
        Opportunity opp = new Opportunity();
        opp.Name = 'Test';
        opp.CloseDate= System.Today();
        opp.StageName='Prospecting';
        insert opp;
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem = new OpportunityLineItem();
        oppLineItem.OpportunityId = opp.Id;
        oppLineItem.PricebookEntryId = customPriceBookEntry.Id;
        oppLineItem.UnitPrice = 7000;
        oppLineItem.Quantity = 5;
        insert oppLineItem;
    }
}

Please, help me.
I want to add Lead and Question__c.this object on this code, i tried but getting error

public with sharing class contrllr {

    Public id Current_Acc_Id;
    public Boolean isEdit { set; get;}
    public List<Contact> lstContact {set;get;}
    public contrllr (ApexPages.StandardController controller) {
        Current_Acc_Id = controller.getRecord().id;
        isEdit = false;
        lstContact = New List<Contact>(); 
        for(Account acc:[select id,name,(select lastName,firstName,name,id,email from contacts) from account where id=:Current_Acc_Id]){
           for(contact con:acc.contacts)
               lstContact.add(con); 
        }
    }
    public void editProcess(){
        isEdit = true;
    }
    public  void save(){
        
        if(lstContact.size() > 0){
            upsert lstContact;
            lstContact.clear();
        }
        
        for(Account acc:[select id,name,(select lastName,firstName,name,id,email from contacts) from account where id=:Current_Acc_Id]){
           for(contact con:acc.contacts)
               lstContact.add(con); 
        }
        isEdit = false;
    } 
    public void addContact(){
        lstContact.add(new Contact(AccountId = Current_Acc_Id));
        isEdit = true;
    }
}
Hi I have schedule a job to send email on a daily basis how ever Its noy working and giving following error

Scheduler: failed to execute scheduled job: jobId: 7075800000IN0MU, class: common.apex.async.AsyncApexJobObject, reason: Not Serializable: com/salesforce/api/fast/List$$lcom/salesforce/api/Messaging/SingleEmailMessage$$r

what could be be the possible reason. what is the meaning of serializable?

Need help !!!
Abhilash Mishra
 
I go to the Accounts page and start creating a new account. I fill up this form and press 'Save". At the next page I click on "Enable Customer User" and after that I see the information of a user including the name of a Role that seems to be dynamically created and that also is not existent in the UserRole table. How this could be happening? The system is able to save the user information in this case. (we use person accounts)

Thanks
Jose
 
Can someone help me with this error? 

Apex Data Loader - Export to Salesforce failed.
We are using Apex Data Loader 24.0.0 and cliq_process.  Using Apex Data Loader & Cliq_process, we are exporting the data into Salesforce custom object. The process was working fine until yesterday. We are getting the following error:

2016-05-10 11:30:49,081 INFO  [main] controller.Controller initLog (Controller.java:404) - The log has been initialized
2016-05-10 11:30:49,088 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:103) - Loading process configuration from config file: C:\Program Files\salesforce.com\Data Loader\cliq_process\CIFWHDG\config\process-conf.xml
2016-05-10 11:30:49,161 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\Program Files\salesforce.com\Data Loader\cliq_process\CIFWHDG\config\process-conf.xml]
2016-05-10 11:30:49,238 INFO  [CIFWHDG] controller.Controller initConfig (Controller.java:365) - The controller config has been initialized
2016-05-10 11:30:49,240 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:116) - Initializing process engine
2016-05-10 11:30:49,244 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:119) - Loading parameters
2016-05-10 11:30:50,565 INFO  [CIFWHDG] config.LastRun load (LastRun.java:96) - Last run info will be saved in file: C:\Program Files\salesforce.com\Data Loader\cliq_process\CIFWHDG\log\CIFWHDG_lastRun.properties
2016-05-10 11:30:50,581 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:127) - Logging in to: https://login.salesforce.com/services/Soap/u/24.0
2016-05-10 11:30:50,587 INFO  [CIFWHDG] client.PartnerClient login (PartnerClient.java:478) - Beginning Partner Salesforce login ....
2016-05-10 11:30:50,608 INFO  [CIFWHDG] client.PartnerClient loginInternal (PartnerClient.java:519) - Salesforce login to https://login.salesforce.com/services/Soap/u/24.0/services/Soap/u/24.0 as user data.integration@f-s-b.com
2016-05-10 11:30:51,064 INFO  [CIFWHDG] dao.DataAccessObjectFactory getDaoInstance (DataAccessObjectFactory.java:51) - Instantiating data access object: H:\AS400flr\SForce\CIFWHDG.csv of type: csvRead
2016-05-10 11:30:51,069 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:132) - Checking the data access object connection
2016-05-10 11:30:51,075 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:137) - Setting field types
2016-05-10 11:30:51,115 ERROR [CIFWHDG] client.PartnerClient runOperation (PartnerClient.java:332) - Error while calling web service operation: describeSObject, error was: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
com.sforce.ws.ConnectionException: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:120)
 at com.sforce.soap.partner.PartnerConnection.describeSObject(PartnerConnection.java:1115)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:185)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:177)
 at com.salesforce.dataloader.client.PartnerClient.runOperation(PartnerClient.java:328)
 at com.salesforce.dataloader.client.PartnerClient.describeSObject(PartnerClient.java:723)
 at com.salesforce.dataloader.client.PartnerClient.setFieldTypes(PartnerClient.java:676)
 at com.salesforce.dataloader.controller.Controller.setFieldTypes(Controller.java:133)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:138)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
 at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
 at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
 at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
 at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:133)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:92)
 at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:88)
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
 ... 10 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
 at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
 ... 23 more
2016-05-10 11:30:51,125 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process CIFWHDG
java.lang.RuntimeException: com.sforce.ws.ConnectionException: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:162)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
 at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.sforce.ws.ConnectionException: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:120)
 at com.sforce.soap.partner.PartnerConnection.describeSObject(PartnerConnection.java:1115)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:185)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:177)
 at com.salesforce.dataloader.client.PartnerClient.runOperation(PartnerClient.java:328)
 at com.salesforce.dataloader.client.PartnerClient.describeSObject(PartnerClient.java:723)
 at com.salesforce.dataloader.client.PartnerClient.setFieldTypes(PartnerClient.java:676)
 at com.salesforce.dataloader.controller.Controller.setFieldTypes(Controller.java:133)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:138)
 ... 2 more
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
 at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
 at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
 at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:133)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:92)
 at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:88)
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
 ... 10 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
 at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
 ... 23 more
 
After our Sandboxes were moved to Summer 16 the Class section on the Developer console never loads the list of classes.

We have tried with different Browers on Different Computers and The same result, the Class list never appear. This is Happening it at least 3 Sandboxes Environments
User-added image

Does Someone knows how to fix this ? or if its a general Salesforce Issue ?

Thanks
Hi Friends,

I have tested a dynamic component for  outputText.

On the Visualforce page show correctly, but where I run my test display the next error:

System.VisualforceException: Invalid value for property label: null

This is the piece of code
dynOutputText = new Component.Apex.outputText();
dynOutputText.value = wrapfee.numCuotaPendiente;                           
dynOutputText.label = Label.label_fee_number;
dynPageBlockSection.childComponents.add(dynOutputText);

​Regards.
I use a code that initially works, but after some tests it stops working. I copy all the code when it works and after that it stops, I paste it, but doesn't works.
This is the part of the code (that belongs to class Catalog Controller from Catalog Order package):
public PageReference toCatalog() {
   
 // begins here    

        Product2 p2 = new Product2();
        p2.Name = 'P2';
        p2.isActive = true;
        insert p2;
        
        Opportunity opp2 = new Opportunity();
        opp2.Name = 'OPP TESTE';
        opp2.CloseDate = System.Today();
        opp2.StageName = 'Prospecting';
        insert opp2;

//ends here

        if(!Product2.sObjectType.getDescribe().isAccessible()) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,'Insufficient access'));
            return null;
        }
        PageReference next = new PageReference('/apex/catalog_products');
        next.setRedirect(false);
       
        // Directing to Catalog
        return next;
        }

 
Does anyone has experience work out the Apex Class with an @RestResource annotation and this does not support transferring cookies from the proxied server to the client?

 
The Enhanced Formula Editor chrome extension provides a code editor for formulas with syntax highlighting.  It also has a new feature for listing field details for fields found in the formula.

https://chrome.google.com/webstore/detail/salesforcecom-enhanced-fo/cnlnnpnjccjcmecojdhgpknalcahkhio

User-added image

User-added image
Hello. I have 3 custom objects, WorkRequest, Project and ProjectRequirements. ProjectRequirements is child to Project and Project can be associated to a WorkRequest. In single query I can query data easily as such:

 requirementList = [SELECT  id, 
                            ResourceAssigned__c,
                            Project__r.Work_Request__r.Work_Request_Status__c, 
                            Status__c ,  
                            Project__r.Name, 
                            Project__r.Project_Status__c, 
                            Project__r.Work_Request__r.Name,
                            Project__r.Work_Request__r.Short_Description__c,  
                            Project__r.Work_Request__r.Problem_Description__c,
                            Comments__c,
                            Name,
                            AddRequirementDetails__c
                      FROM USD_ProjectRequirements__c
                     WHERE Project__r.Work_Request__r.Name  != null
                       AND (ResourceAssigned__c IN :idList];    

However, what I also want to do is query in single query WorkRequests assigned to a rresource which have not been related to a Project. Anywat to do this in APEX?  Basically, the equivalent of SQL UNION operator.

Thanks in advance,

Jon
Hi all,

I am creating a trigger to prevent users entering the same "Business_Planning__c" record for the same Month ("Broker_BPMonth__c" field).

How do I refer this trigger to only look at the current Account and not all accounts on SF?
 
trigger ForecastPreventDup on Business_Planning__c (before insert, before update) {
    
    Map<String, Business_Planning__c> monthMap = new Map <String, Business_Planning__c>();
    //Map<Id, Business_Planning__c> accMap = new Map <Id, Business_Planning__c>();
    for (Business_Planning__c b:System.Trigger.new){
        if((b.Broker_BPMonth__c!=null)&&
            (System.Trigger.isInsert ||
            ((b.Broker_BPMonth__c!=
             System.Trigger.oldMap.get(b.Id).Broker_BPMonth__c )
             && b.Account__c == System.Trigger.oldMap.get(b.Id).Account__c))){
                 
                 if(monthMap.containsKey(b.Broker_BPMonth__c)){
                     b.Broker_BPMonth__c.addError('Forecast for this month already exists');
                 }else{
                     monthMap.put(b.Broker_BPMonth__c, b);
                 }
             }
    }
    
    for(Business_Planning__c b:[Select Broker_BPMonth__c From Business_Planning__c 
                                WHERE Broker_BPMonth__c IN :monthMap.keySet()]){
                                    Business_Planning__c newBP = monthMap.get(b.Broker_BPMonth__c);
                                    newBP.Broker_BPMonth__c.addError('Forecast for this month already exists');
                                }
    
    

}


Thanks

Adam
Hi, 
The content of my WSDL is as such:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www........">
<soapenv:Header/>
<soapenv:Body>
<sch:InsertValueRequest>
<credential>
<userName> </userName>
<password> </password>
</credential>
<ActorVO>
    <value1> </value1>
    <value2> </value2>
    <value3> </value3>
    <value4> </value4>    
</ActorVO>
<sch:InsertValueRequest>
All the apex class was generated successfully with the WSDL. A class was created which contain the credential parameter and one which contain the values.

The problem I am facing is that when I send the request, the request is generated without the credential part, hence no request is done between the external service and salesforce. How can I modify my request being it is send?

Viewed from the debug log, i noticed the request is generated as such : 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www........">
<soapenv:Header/>
<soapenv:Body>
<sch:InsertValueRequest>
<values>
<value1> </value1>
<value2> </value2>
<value3> </value3>
<value4> </value4>
</values>
<sch:InsertValueRequest>

Below is my sample class: 

public class ActorSchema {
    public class Credential {
            public String userName;
            public String password;
            private String[] userName_type_info = new String[]{'userCode','http://.......',null,'0','1','true'};
            private String[] password_type_info = new String[]{'password','http://.....',null,'0','1','true'};        
            private String[] field_order_type_info = new String[]{'userName','password'};
        }
        
    public class ActorVO {
        public String value1;
        public String value1;
        public String value1;
        public String value1;
        private String[] apex_schema_type_info = new String[]{'http://......','false','false'};
        private String[] field_order_type_info = new String[]{'value1','value2','value3','value4'};
    }    
}


public class ActorActorimport {
    public class InsertActorResponse_element {
        public ActorSchema.ActorVO actorVO;        
        private String[] actorVO_type_info = new String[]{'actorVO','http://......',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://......','true','false'};
        private String[] field_order_type_info = new String[]{'actorVO'};
    }
    public class InsertActorRequest_element {
        public ActorSchema.ActorVO actorVO;
        private String[] actorVO_type_info = new String[]{'actorVO','http://.....',null,'1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://.....','false','false'};
        private String[] field_order_type_info = new String[]{'actorVO'};            
    }
    
    public ActorSchema.ActorVO InsertActor(ActorSchema.ActorVO actorVO) {
                ActorActorimport.InsertActorRequest_element request_x = new ActorActorimport.InsertActorRequest_element();                        
                request_x.actorVO = actorVO;           
                ActorActorimport.InsertActorResponse_element response_x;
                Map<String, ActorActorimport.InsertActorResponse_element> response_map_x = new Map<String, ActorActorimport.InsertActorResponse_element>();            
                response_map_x.put('response_x', response_x);
                WebServiceCallout.invoke(
                  this,
                  request_x,
                  response_map_x,
                  new String[]{endpoint_x, '','http://......', 'InsertActorRequest', 'http://......','InsertActorResponse','ActorActorimport.InsertActorResponse_element'}
                );
                response_x = response_map_x.get('response_x');            
                return response_x.actorVO;
            }
}

=============My Request==========
ActorActorImport.ActorImportServicePort test1 = new ActorActorImport.ActorImportServicePort();
test1.clientCert_x = ' ';
//test1.clientCertName_x = ' ';
test1.clientCertPasswd_x = ' ';
test1.endpoint_x = 'http://......';
test1.timeout_x = 50000;
 
ActorSchema.ActorVO actorVo = new ActorSchema.ActorVO();
actorVo.value1 = 'val1';
actorVo.value2 = 'val2';
actorVo.value3 = 'val3';
actorVo.value4 = 'val4';

test1.InsertActor(actorVo);

Please help!!!
How to Get Content Type if content type is blank in attchment object.Is there any method that help to get content type with using Name Field of attchment object.


Thanks
 
Hey everybody!

I'm trying to write my first wrapper class whic will allow me to create records related to both a custom object (Site__c) and the Quote object. What I am having an issue with is passing the QuoteId to the SOQL query on line 11. I have tried it with a hardcoded QuoteId and it works correctly. Right now when I try and save it gives me the error 'Invalid bind expression type of Object for column of type Id'. 

What is the issue here? Is it because of the standard controller is my other custom object (Associated_Location__c)? Thanks in advance! 

Apex:
public with sharing class quoteAssociatedSiteExtension {

	//Our collection of the class/wrapper objects cContact 
	public Quote theQuote {get; set;}
    public List<assLoc> assLocList {get; set;}
    
    
    public quoteAssociatedSiteExtension(ApexPages.StandardController controller) { 

        controller.addFields(new List<String>{'Quote__c'});
		theQuote = [select Id, AccountId from Quote where Id =:controller.getRecord().get('Quote__c') limit 1];
    }

	//This method uses a simple SOQL query to return a List of Contacts
	public List<assLoc> getAssLoc() {
		if(assLocList == null) {
			assLocList = new List<assLoc>();
			for(Site__c s: [select Id, Name, Account__r.Id from Site__c where Account__r.Id=:theQuote.AccountId limit 10]) {
				// As each contact is processed we create a new cContact object and add it to the contactList
				assLocList.add(new assLoc(s));
			}
		}
		return assLocList;
	}


	public PageReference processSelected() {

                //We create a new list of Contacts that we be populated only with Contacts if they are selected
		List<Associated_Location__c> selectedAssociatedLocations = new List<Associated_Location__c>();

		//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
		for(assLoc aLoc: getAssLoc()) {
			if(aLoc.selected == true) {
				selectedAssociatedLocations.add(aLoc.ac);
			}
		}

		// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
		System.debug('These are the selected Contacts...');
		for(Associated_Location__c ac: selectedAssociatedLocations) {
			system.debug(ac);
		}
		assLocList=null; // we need this line if we performed a write operation  because getContacts gets a fresh list now
		return null;
	}


	// 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 Contact and a Boolean value
	public class assLoc {
		public Associated_Location__c ac {get; set;}
        public Site__c st {get; set;}
        public Quote qt {get; set;}
		public Boolean selected {get; set;}

		//This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
		public assLoc(Associated_Location__c a) {
			ac = a;
			selected = false;
		}
        
        public assLoc(Site__c s) {
			st = s;
			selected = false;
		}
        
		public assLoc(Quote q) {
			qt = q;
			selected = false;
		}        
	}
}

Visualforce: 
 
<apex:page standardController="Associated_Location__c" extensions="quoteAssociatedSiteExtension">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>
            </apex:pageBlockButtons>
            <!-- In our table we are displaying the cContact records -->
            <apex:pageBlockTable value="{!AssLoc}" var="a" id="table">
                <apex:column >
                    <!-- This is our selected Boolean property in our wrapper class -->
                    <apex:inputCheckbox value="{!a.selected}"/>
                </apex:column>
                <!-- This is how we access the contact values within our cContact container/wrapper -->
                <apex:column value="{!a.st.Name}" />
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
How could I insert a product in Opportunity by the Apex (the problem is because the sentence is for tests, so how I do this?).
 
public class Teste {

    public void teste1(){
        // Insert Product
        Product2 pr = new Product2();
        pr.Name='Moto - G1';
        pr.isActive=true;
        insert pr;
        
        // Insert Pricebook
        PriceBook2 customPriceBook = new PriceBook2();
        customPriceBook.Name='Custom Pricebook';
        customPriceBook.IsActive=true;
        insert customPriceBook;
        
        // Query Standard and Custom Price Books
        Pricebook2 customPriceBookRec=[select Id from Pricebook2 where id=:customPriceBook.Id];
        Id stdPriceBookRecId = Test.getStandardPricebookId();
        
        // Create Standard PriceBookEntry
        PriceBookEntry stdPriceBookEntry = new PriceBookEntry();
        stdPriceBookEntry.Product2Id=pr.Id;
        stdPriceBookEntry.Pricebook2Id=stdPriceBookRecId;
        stdPriceBookEntry.UnitPrice=2000;
        stdPriceBookEntry.IsActive=true;
        insert stdPriceBookEntry;
        // Create Custom PriceBookEntry
        PriceBookEntry customPriceBookEntry = new PriceBookEntry();
        customPriceBookEntry.Product2Id=pr.Id;
        customPriceBookEntry.Pricebook2Id=customPriceBookRec.Id;
        customPriceBookEntry.UnitPrice=5000;
        customPriceBookEntry.IsActive=true;
        insert customPriceBookEntry;
        
        // Create Opportunity
        Opportunity opp = new Opportunity();
        opp.Name = 'Test';
        opp.CloseDate= System.Today();
        opp.StageName='Prospecting';
        insert opp;
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem = new OpportunityLineItem();
        oppLineItem.OpportunityId = opp.Id;
        oppLineItem.PricebookEntryId = customPriceBookEntry.Id;
        oppLineItem.UnitPrice = 7000;
        oppLineItem.Quantity = 5;
        insert oppLineItem;
    }
}

Please, help me.
I want to add Lead and Question__c.this object on this code, i tried but getting error

public with sharing class contrllr {

    Public id Current_Acc_Id;
    public Boolean isEdit { set; get;}
    public List<Contact> lstContact {set;get;}
    public contrllr (ApexPages.StandardController controller) {
        Current_Acc_Id = controller.getRecord().id;
        isEdit = false;
        lstContact = New List<Contact>(); 
        for(Account acc:[select id,name,(select lastName,firstName,name,id,email from contacts) from account where id=:Current_Acc_Id]){
           for(contact con:acc.contacts)
               lstContact.add(con); 
        }
    }
    public void editProcess(){
        isEdit = true;
    }
    public  void save(){
        
        if(lstContact.size() > 0){
            upsert lstContact;
            lstContact.clear();
        }
        
        for(Account acc:[select id,name,(select lastName,firstName,name,id,email from contacts) from account where id=:Current_Acc_Id]){
           for(contact con:acc.contacts)
               lstContact.add(con); 
        }
        isEdit = false;
    } 
    public void addContact(){
        lstContact.add(new Contact(AccountId = Current_Acc_Id));
        isEdit = true;
    }
}
Hi I have schedule a job to send email on a daily basis how ever Its noy working and giving following error

Scheduler: failed to execute scheduled job: jobId: 7075800000IN0MU, class: common.apex.async.AsyncApexJobObject, reason: Not Serializable: com/salesforce/api/fast/List$$lcom/salesforce/api/Messaging/SingleEmailMessage$$r

what could be be the possible reason. what is the meaning of serializable?

Need help !!!
Abhilash Mishra
 
I go to the Accounts page and start creating a new account. I fill up this form and press 'Save". At the next page I click on "Enable Customer User" and after that I see the information of a user including the name of a Role that seems to be dynamically created and that also is not existent in the UserRole table. How this could be happening? The system is able to save the user information in this case. (we use person accounts)

Thanks
Jose
 
Can someone help me with this error? 

Apex Data Loader - Export to Salesforce failed.
We are using Apex Data Loader 24.0.0 and cliq_process.  Using Apex Data Loader & Cliq_process, we are exporting the data into Salesforce custom object. The process was working fine until yesterday. We are getting the following error:

2016-05-10 11:30:49,081 INFO  [main] controller.Controller initLog (Controller.java:404) - The log has been initialized
2016-05-10 11:30:49,088 INFO  [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:103) - Loading process configuration from config file: C:\Program Files\salesforce.com\Data Loader\cliq_process\CIFWHDG\config\process-conf.xml
2016-05-10 11:30:49,161 INFO  [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\Program Files\salesforce.com\Data Loader\cliq_process\CIFWHDG\config\process-conf.xml]
2016-05-10 11:30:49,238 INFO  [CIFWHDG] controller.Controller initConfig (Controller.java:365) - The controller config has been initialized
2016-05-10 11:30:49,240 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:116) - Initializing process engine
2016-05-10 11:30:49,244 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:119) - Loading parameters
2016-05-10 11:30:50,565 INFO  [CIFWHDG] config.LastRun load (LastRun.java:96) - Last run info will be saved in file: C:\Program Files\salesforce.com\Data Loader\cliq_process\CIFWHDG\log\CIFWHDG_lastRun.properties
2016-05-10 11:30:50,581 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:127) - Logging in to: https://login.salesforce.com/services/Soap/u/24.0
2016-05-10 11:30:50,587 INFO  [CIFWHDG] client.PartnerClient login (PartnerClient.java:478) - Beginning Partner Salesforce login ....
2016-05-10 11:30:50,608 INFO  [CIFWHDG] client.PartnerClient loginInternal (PartnerClient.java:519) - Salesforce login to https://login.salesforce.com/services/Soap/u/24.0/services/Soap/u/24.0 as user data.integration@f-s-b.com
2016-05-10 11:30:51,064 INFO  [CIFWHDG] dao.DataAccessObjectFactory getDaoInstance (DataAccessObjectFactory.java:51) - Instantiating data access object: H:\AS400flr\SForce\CIFWHDG.csv of type: csvRead
2016-05-10 11:30:51,069 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:132) - Checking the data access object connection
2016-05-10 11:30:51,075 INFO  [CIFWHDG] process.ProcessRunner run (ProcessRunner.java:137) - Setting field types
2016-05-10 11:30:51,115 ERROR [CIFWHDG] client.PartnerClient runOperation (PartnerClient.java:332) - Error while calling web service operation: describeSObject, error was: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
com.sforce.ws.ConnectionException: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:120)
 at com.sforce.soap.partner.PartnerConnection.describeSObject(PartnerConnection.java:1115)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:185)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:177)
 at com.salesforce.dataloader.client.PartnerClient.runOperation(PartnerClient.java:328)
 at com.salesforce.dataloader.client.PartnerClient.describeSObject(PartnerClient.java:723)
 at com.salesforce.dataloader.client.PartnerClient.setFieldTypes(PartnerClient.java:676)
 at com.salesforce.dataloader.controller.Controller.setFieldTypes(Controller.java:133)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:138)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
 at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
 at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
 at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
 at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:133)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:92)
 at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:88)
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
 ... 10 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
 at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
 ... 23 more
2016-05-10 11:30:51,125 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process CIFWHDG
java.lang.RuntimeException: com.sforce.ws.ConnectionException: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:162)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
 at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.sforce.ws.ConnectionException: Failed to send request to https://na12.salesforce.com/services/Soap/u/24.0/00DU0000000Xwe5
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:120)
 at com.sforce.soap.partner.PartnerConnection.describeSObject(PartnerConnection.java:1115)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:185)
 at com.salesforce.dataloader.client.PartnerClient$10.run(PartnerClient.java:177)
 at com.salesforce.dataloader.client.PartnerClient.runOperation(PartnerClient.java:328)
 at com.salesforce.dataloader.client.PartnerClient.describeSObject(PartnerClient.java:723)
 at com.salesforce.dataloader.client.PartnerClient.setFieldTypes(PartnerClient.java:676)
 at com.salesforce.dataloader.controller.Controller.setFieldTypes(Controller.java:133)
 at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:138)
 ... 2 more
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source)
 at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
 at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
 at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
 at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:133)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:97)
 at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:92)
 at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:88)
 at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:94)
 ... 10 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
 at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
 ... 23 more
 
After our Sandboxes were moved to Summer 16 the Class section on the Developer console never loads the list of classes.

We have tried with different Browers on Different Computers and The same result, the Class list never appear. This is Happening it at least 3 Sandboxes Environments
User-added image

Does Someone knows how to fix this ? or if its a general Salesforce Issue ?

Thanks
I wrote a simple test class today in a sandbox.
When I attempt to run it from the developer console by itself using
Test->New Run
it fails and the results look like 
image of test failure from developer console

If I run the same test in a new run with pre-existing tests it runs fine.
The test also runs correctly from the Apex Test Execution Window.  I tried this on 2 sandboxes with same result.

The test only calls a method in 1 class that I wrote today.

is this related to the new release? Could be related to the known issue with opening classes in the dev console https://success.salesforce.com/issues_view?id=a1p30000000T2sSAAS I am unable to open a class from the console - although I do not get the same error as reported in the known issue.
Hi Friends,

I have tested a dynamic component for  outputText.

On the Visualforce page show correctly, but where I run my test display the next error:

System.VisualforceException: Invalid value for property label: null

This is the piece of code
dynOutputText = new Component.Apex.outputText();
dynOutputText.value = wrapfee.numCuotaPendiente;                           
dynOutputText.label = Label.label_fee_number;
dynPageBlockSection.childComponents.add(dynOutputText);

​Regards.
I use a code that initially works, but after some tests it stops working. I copy all the code when it works and after that it stops, I paste it, but doesn't works.
This is the part of the code (that belongs to class Catalog Controller from Catalog Order package):
public PageReference toCatalog() {
   
 // begins here    

        Product2 p2 = new Product2();
        p2.Name = 'P2';
        p2.isActive = true;
        insert p2;
        
        Opportunity opp2 = new Opportunity();
        opp2.Name = 'OPP TESTE';
        opp2.CloseDate = System.Today();
        opp2.StageName = 'Prospecting';
        insert opp2;

//ends here

        if(!Product2.sObjectType.getDescribe().isAccessible()) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,'Insufficient access'));
            return null;
        }
        PageReference next = new PageReference('/apex/catalog_products');
        next.setRedirect(false);
       
        // Directing to Catalog
        return next;
        }

 
Does anyone has experience work out the Apex Class with an @RestResource annotation and this does not support transferring cookies from the proxied server to the client?

 
I went on a trailhead training course and completed a number of badges and am wondering how i can transfer these to my account linked to my company? I need to do this for our partner status and don't want to have to spend hours again retaking all the challenges again..
I am writing a custom Lightening connect connector. However, none of the classes in new DataSource namespace are available, I get the error 'Invalid class'. I have tried the code in a sandbox environment running summer 15 code, the same error exists in summer 15 sandbox also.

Any help on how to address this issue is much appreciated.
Hello,

My component code is
 
<apex:component >
<apex:attribute name="label" description="" type="String" required="true"/>
<apex:attribute name="input" description="" type="sObject" required="true"/>
<div class="form-group col-md-6">
  <label for="input" class="col-md-2 control-label">{!label}</label>
  <div class="col-md-6 form-control-wrapper">
    <apex:inputField styleClass="form-control" id="input" value="{!input}" />
    <span class="material-input"></span>
  </div>
</div>
</apex:component>
When I use this, I get this error

Error: Could not resolve the entity from value binding '{!input}'. can only be used with SObjects, or objects that are Visualforce field component resolvable.

What binding am I missing?
 
When I'm adding script files to a lightning component i'm getting an error as 'script tags only allowed in templates: Source'. Is there another way to add script links to the lightning application?

There is a governor limit, that limits you to 20 concurrent API calls to the same URL endpoint. Any other concurrent calls will receive an exception. This is a hard limit and salesforce won't increase it for us (possible for other limits).

 

"A callout request to a given URL is limited to a maximum of 20 simultaneous requests."

 

I'll start with explaining why this is an issue to us, we're developing a site on force.com,  in where our customers will be able to manage their account,  manage their  sub-users and search our catalog, place&manage orders, etc. Some of that is located in salesforce, but some data, like or catalog is too big. I is stored in a seperate database, fully focussed on performing fast search on huge data quantities, at which salesforce still performs under our requirements.

 

Now, our idea was to just get the data from the other database over REST, and i've already implemented a test scenario using Remote Javascript functions, and it works great. Search functionality is a core concept of our website, and we're making  calls to the catalogue to perform autosuggest, per keystroke. This combined with calls that will be made on actual search, and other features of our website we expect to hit this governor limit very fast, as soon as having only 100 users online at the same time. We have a large international customerbase, and are thus worried and looking for a way around this governor limit.

 

Expecting the exception and making  new call in the catch (in recursive fashion) isn't something we believe is the way to go on this (are we wrong ?).  Has any of you already faced (and overcome ) this problem ? Or insights on how you would tackle this, are both grealy appreciated !

The documentation for javascript remoting says, "Your method can take Apex primitives as arguments," and I'd like to pass a Javascript Date into my remoted function. Javascript Date has a time component, so it's analogous to an Apex DateTime.

 

However, when I pass in the Date from javascript calling my remoted function, the remoting javascript code throws an exception complaining that I'm not passing in a DateTime but rather the time as an ISO string. 

 

I noticed that in the opposite direction, DateTimes get marshaled as an integer of the number of milliseconds since the epoch (Jan 1, 1970), which javascript can use in a Date constructor, so I tried passing that in for the DateTime arg, but it still complained.

 

Is there a way to pass a Javascript Date directly to a remoted function as an Apex DateTime??

 

My workaround in the meantime was to accept the Date as an ISO string, replace the "T" with a space, and use the result to construct the Apex DateTime with DateTime.valueOf. It'd be nice to be able to skip this, though. 

 

Thanks,

--Kevin

We are doing a massive upgrade of an org with a managed package. The package must be switched out with a new version (since managed packages can't be changed). Unfortunately we have about 200 custom fields on top of a managed package component. I can't seem to find the meta-data in the IDE. I know that there is a section for "Referenced Packages" which shows the schema of the packaged object only, no customizations. Also I can't see the customizations under src -> objects either. I would really like to copy and paste the XML and not recreate these 200 fields from scratch. Any ideas??

  • March 12, 2011
  • Like
  • 3