• Leslie Kismartoni
  • 299 Points
  • Member since 2015

  • Chatter
  • 9
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 88
Apex Code

public class myClass1{

        public string out1{get;set;}
        public list<decimal> capitals{get;set;}
        public list<decimal> revenues{get;set;}
        public myClass1(){
            capitals=new list<decimal>(4);
            revenues=new list<decimal>(4);
            for(integer i=0;i<4;i++){
        public void mySave(){
          //this line should display value entered in second input text in place of 'Hello'

VisualFroce page

<apex:page controller="myClass1" showHeader="false" doctype="HTML-5.0">
    <apex:form id="form">
        <apex:tabPanel >
            <apex:tab label="one">
                <p>Tab one Content</p>
                <apex:outputtext id="out1" value="{!out1}" escape="false"/>
                <apex:commandButton value="Save" action="{!mySave}" rerender="dataTable,out1,rpt"/>
                <table id="dataTable" style="border:2px solid green">
                    <apex:repeat value="{!capitals}" var="c" id="rpt">
                        <td><apex:inputtext  value="{!c}"/></td>
            <apex:tab label="two">
ideally above code should display numbers 0 to 4 in four input Text fields.

When i assign  value="{!c}", for inputText.
i am getting an error -> 'unkown property c'
in my opinion i should work perfectly.

Please correct my mistake.
  • April 28, 2015
  • Like
  • 0
What is the best way to split large Apex Source Code (for 1 controller) into separate source files?

I have a related list button on detail page. I have wriiten some java script code on the button. I want to gett the parent id on this button. Can you please tell me how can i get the id?
I am struggling with usage of VF page for adding products to Opportunity on SF1. We have created our own page to support adding new products, but I can't use it for an global action.

User-added image

My page is set to be available for SF1 but it is not shown in the Create action "Visualforce Page" pick list after selecting "Action Type" to Custom Visualforce.

User-added image

Am I doing something wrong, or is there different way how to do it?

thank you very much in advance, 
Im trying to create a validation rule :
Here is the example AND(ISPICKVAL( Status, "ISR-Sale"),ISBLANK( Date_of_Sale__c ) ) 

I have a picklist field for Lead status. If sales user selects ISR - Sale value from Lead status the date of Sale ( custom field ) should be a required field. The above formula shows no error but its not working. Any help would be greatly appreciated
Hi All,

I am trying to display image formula field in html td tag in custom visualforce page salesforce1. But it is not displaying. Can anybody help - 

<apex:repeat value="{!contactList}" var="contact">
                        <td align="left"><a href="/{!contact.Id}">{!contact.Name}</a></td>
                        <td>{!contact.RAG_Status__c}</td> /// formula field for image

But it is displaying as below in the column. 

<img src="https://cs18.salesforce.com/resource/1427100618000/Amber_Flag" alt=" " border="0"/>

I've found some things here but not something I can get to work.

2 fields Join_Time__c, Leave_Time__c I want to produce a number in minutes by subtracting the time they joined from the time they left a webinar either 42(NN) or HH:MM will be acceptable. I need to know the field type to use and the formula. I'm not finding what I'm looking for that will work for some reason.

I have 2 time based workflows that should send an email anytime a Contract Expiration Date is 90 days away. One workflow rule is based on sending to an email to the East and one is based on sending an email to the West. I cannot figure out why they are both triggering an email when I create a new record. Can you spot what is triggering both to fire off in my workflows?

Workflow 1 West
AND(NOT( ISBLANK( Contract_Exp_Date__c)), 
AND(AccountId__r.Muni_Team_Account__c = True, AccountId__r.RegionCode__c = "W"), 
AND(AccountId__r.Owner.ProfileId = "00e30000000jMWI", AccountId__r.RecordType.DeveloperName = "Prospect", CONTAINS(AccountId__r.Owner.User_Region__c, "WESTERN"))))

Workflow 2 East
AND(NOT( ISBLANK( Contract_Exp_Date__c)), 
AND(AccountId__r.Muni_Team_Account__c = True, AccountId__r.RegionCode__c = "E"), 
AND( AccountId__r.Owner.ProfileId = "00e30000000jMWI", AccountId__r.RecordType.DeveloperName = "Prospect"), CONTAINS(AccountId__r.Owner.User_Region__c, "EASTERN")))

Additional information- the Evaluation Criteria: Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

I appreciate any help that is given!
I need to know how to extend a custom object page with APEX, such that I can change what is displayed at the top of the record. Currently the custom object record id is being displayed.  I need to CHANGE that to be the custom object's name ( a custom field on the object ).

So, I have this - " Hunter-{1001} " and I want " Bob Smith " , to display at the top of the " Hunter " object page.

Someone haaaaaaalp!

Thanks! :)

Could you please suggest how to achieve URL Normalization in Salesforce.

What I am trying to achieve is to take particluar URL and modifie it to its most basic or standard form.


String url = "Http://Example.com:80//salesforce/index.html";

URL normalizedURL = new URLNormalizer(url)
// Output: http://www.example.com/foo/

The above example was taken from existing java class called URLNormalizer. I was wondering if there is a similar way to achieve URL Normalization in Salesforce.

Please advise how to make URL Normalization in Salesforce.

I have a requirement to have the Opportunity record Last Modified Date update when a related task or event is created/updated. I am looking for advice on how to achieve this. Is this possible through an Apex Class or Trigger? Please advise. 


I have a trigger that sets the revenue schedule for opportunity line items. It works fine for updaitng line items one at a time. But I have a few hundred opportunites that I have to migrate from and old SF org and when I try to add the products to these opportunites via the data loader I get an error that it is exceeding the amount of scheudles the trigger can perform at once.  I want to avoid doing this one by one and have been told that I just need to "bulkify" my trigger.  I am new apex so can someone help me understand how I would do that?  Is this a simple change?  And would it affect how the trigger fires when my seller's are adding new line items or updating exisitng ones for indivual opportunites?  

The trigger is included below:

trigger setRevenueSchedule on OpportunityLineItem (after insert, after update) {
        if (trigger.isAfter && trigger.isInsert){
        if (trigger.isAfter && trigger.isUpdate){
            RevenueController.updateRevenue(trigger.newMap, trigger.oldMap);
    }//end of if recursionblocker is true.

Thanks in advance for any help!

Theo T

is there any way to transform a record from the data base into an xml file ??
I have a local system which is integrated to salesforce. I am passing the user name & pw through the URL for the users to get in to login to salesforce directly. But, I want them to directly access a Case# in salesforce, how can I pass teh case# through auto login/SSo?
I did a very simple Trigger to update 2 custom field
First is a custom lookup field that lead to contact: lookup_contact__c
Second is the subject field that is supposed to be populated from 2 custom field

trigger Updatelookup on Event (before insert, before update){
    for (event u : Trigger.new){
        u.lookup_contact__c = u.WhoId;
        u.Subject = u.Nom_formate__c + u.Raison_visite_formate__c;

The trigger by himself is working well exept that I'll need to run it after insert because WhoID is populated after the trigger run so .. this informations is always missing exept if i make a manual update.

the problem is if I say after insert, I have an error message because I con only use before insert.
Can you help me with that ?   (Process builder is not working at all for that because it also run .. befaore whoID is populated :( )
I want to view only the standard Calendar as my Homepage . How can i do it ?
Hi I write a test class its covered 83 but i need to cover 85 can u please helpme out....
below are the classes.
public with sharing class GE_PRM_SubDealer_Class {
 //** Variable declarations
    public String errorMessage {get;set;}
    public string schannelAppId;
    public string sBranchId;
    public Sub_Dealer__c branchOfficeObj {get; set;}
    private final Sub_Dealer__c branchOffice;
    public Id userId;
    public Id userprofileId;
    public boolean bpartnerUser{get;set;}
    public List<Profile> parnerprof = new List<Profile>();
    public string isnew_SB_from_URL;
    public Sub_Dealer__c newBO;
    public string Cloneyes;

    //** constructor
    public GE_PRM_SubDealer_Class(ApexPages.StandardController controller) 
        isnew_SB_from_URL = ApexPages.currentPage().getParameters().get('isNew');
        schannelAppId = ApexPages.currentPage().getParameters().get('ChannelAppointmentId');
        sBranchId = ApexPages.currentPage().getParameters().get('Id');
        this.branchOffice = (Sub_Dealer__c)controller.getRecord();  
        userId= UserInfo.getUserId();  
        userprofileId = UserInfo.getProfileId();
        parnerprof = [Select Id from Profile where Name in ('Channel Partner DR/VAR/Reseller user','Channel Partner Leader user - DR','Channel Partner Leader user - SR','Channel Partner Sales Rep user')];
        for(Profile p : parnerprof)
        branchOfficeObj =   [select Id, GE_PRM_Unique_Id__c,GE_PRM_Affiliate_dependent_type__c,         
                             from Sub_Dealer__c where id=:sBranchId];
    //** saving subdealer details
    public PageReference saveSubDealerDetails()
        Cloneyes = ApexPages.currentPage().getParameters().get('clone'); 
       // isadditonal_CL_from_url=ApexPages.currentPage().getParameters().get('isadditonal');
        // clicked on Commercial line Clone 
        if(Cloneyes !=null){            
            newBO = branchOfficeObj.clone(false,true);
            insert newBO;
            System.debug('new branchoffice'+newBO);            
        errorMessage = '';
            update branchOffice;            
        catch(Exception e)
            errorMessage = 'Please Fill in Required Detail';
        if(errorMessage.length() >1)
            return null;
            PageReference pageRef;
            pageRef = new PageReference('/apex/GE_PRM_Channel_Appointment_page1?Id='+schannelAppId+'#BranchOffice');
                pageRef = new PageReference('/apex/GE_PRM_PartnerViewChannel_Appointment?Id='+schannelAppId+'&sfdc.override=1');
            return pageRef;         
    //** method to redirect to channel appointment page
    public PageReference backToChApp()
        PageReference updChApp=new PageReference('/apex/GE_PRM_Channel_Appointment_View_Page1?Id='+schannelAppId);
            updChApp= new PageReference('/apex/GE_PRM_PartnerView_ChApp_page?Id='+schannelAppId+'&sfdc.override=1');
        return updChApp;
    public PageReference cancel() {
        PageReference pageRef;
            system.debug('true from url'+isnew_SB_from_URL  ); system.debug('before delete'+branchOffice);
            if(isnew_SB_from_URL == 'true'){
                delete branchOffice;
            system.debug('after delete'+branchOffice);
            pageRef = new PageReference('/apex/GE_PRM_Channel_Appointment_Page1?Id='+schannelAppId);
            return pageRef;
        catch(Exception e){
            system.debug('true from url'+isnew_SB_from_URL  ); system.debug('delete'+branchOffice);
            pageRef = new PageReference('/apex/GE_PRM_Channel_Appointment_Page1?Id='+schannelAppId);
            return pageRef;

  public with sharing class GE_PRM_SubDealer_Class_test {
  static testMethod  void Testsubdealerclass(){
         Profile p = [select id from profile where name='GE_PRM_Channel_Manager'];
       User terec = new User();
       terec.firstname = 'test';
       terec.lastname = 'record';
       terec.email = 'testrecord@ge.com';
       terec.alias = 'trecord';
       terec.profileId = p.id;
       terec.Title = 'test record';
       terec.Username = 'testrecord@ge.com';
       terec.CommunityNickname = 'trec';
       terec.TimeZoneSidKey = 'America/New_York';
       terec.LocaleSidKey = 'en_US';
       terec.EmailEncodingKey= 'ISO-8859-1';
       terec.LanguageLocaleKey= 'en_US';
        insert terec;
            List<GE_PRM_Channel_Appointment__c > ChAppList = new List<GE_PRM_Channel_Appointment__c >();
            RecordType rt = [select id,Name from RecordType where SobjectType='Account' and Name='CMF Approved' Limit 1];          
            account acc= new account();
            acc.name= 'newaccount';
            acc.recordtype = rt;
            insert acc;
            GE_PRM_Channel_Appointment__c ChannelApp = new GE_PRM_Channel_Appointment__c();
            ChannelApp.GE_PRM_Current_Status__c= 'Approved'; 
            ChannelApp.GE_PRM_Master_appointment_type__c ='New';
            ChannelApp.GE_PRM_Primary_bank_account_country__c = 'INDIA';
            ChannelApp.GE_PRM_Primary_bank_name_address__c = 'test12';
            ChannelApp.GE_PRM_Primary_bank_contact__c = 'test21';
            ChannelApp.GE_PRM_Primary_bank_account__c = 'test12';
            ChannelApp.GE_PRM_Payment_term_requested__c= '21';
            ChannelApp.GE_PRM_Prior_growth_rating__c = 'Medium';
            ChannelApp.GE_PRM_Prior_performance_rating__c = 'Medium';
            ChannelApp.GE_PRM_Prior_year_orders__c = '<$100K';
            ChannelApp.GE_PRM_With_GE_since__c = 0;
            ChannelApp.GE_PRM_In_Business_Since__c = Date.today();
            ChannelApp.GE_PRM_Mandated_by_End_Customer__c = 'No';
            ChannelApp.GE_PRM_Convicted_of_any_felony_crims_r_s__c= 'No';
            ChannelApp.GE_PRM_Do_you_have_Officers_in_Gov__c= 'No';
            ChannelApp.GE_PRM_High_Risk_product_lines__c= 'No';
            ChannelApp.GE_PRM_Sell_to_Nuclear_industry__c= 'No';
            ChannelApp.GE_PRM_Des_Chnl_Partner_hv_sb_dea_sbagnt__c= 'No';
            ChannelApp.GE_PRM_Does_Channel_Partner_have_subsid__c= 'No';
            ChannelApp.GE_PRM_Export_Controlled_products__c= 'No';
            ChannelApp.GE_PRM_Export_outside_own_country__c= 'No';
            ChannelApp.GE_PRM_Approved_exclusivity_from_P_L__c= 'No';
            ChannelApp.GE_PRM_Tier_2_P_L__c='Measurement & Control (M&C)';
            insert ChannelApp; 
            System.assertEquals(ChannelApp.GE_PRM_Tier_2_P_L__c,'Measurement & Control (M&C)');  
            Sub_Dealer__c subdeal = new Sub_Dealer__c();
            subdeal.GE_PRM_Country__c='UNITED STATES';              
            insert subdeal; 
            Apexpages.currentpage().getparameters().put('id' ,subdeal.id);  
            Apexpages.currentpage().getparameters().put('Clone' ,'true');
            Apexpages.currentpage().getparameters().put('isNew' ,'true');  
            Apexpages.currentpage().getparameters().put('bpartnerUser' ,'true');
            Apexpages.currentpage().getparameters().put('bpartnerUser' ,'false');
            Apexpages.currentpage().getparameters().put('ChannelAppointmentId' ,ChannelApp.id);
            GE_PRM_SubDealer_Class controller=new GE_PRM_SubDealer_Class(new ApexPages.StandardController(subdeal));

I would like to retrieve the system settings data of salesforce instance I am using . I know that describeGlobal() call is able to return those data. But does anyone know how can I use this call  ? In the Salesforce Developer Console , how can I write this call ? Or is there a easist way to use this call ? For instance, in unix we just need to write a command in the terminal.

Hi All,

Can you Please tell me how to achive these
New_Date__c //Custom Field
Activity_Date__c // Another Custom Field

 New_Date__c = (Activity date + 1 Year) - ( 3 Months + 7 Days)

Thanks in Advance
I got the following error "Unable to find schema for element; {http://tempuri.org/}BDRequestResponse" while parsing the WSDL file.
Here is the snippet of WSDL file:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="Service1" targetNamespace="http://tempuri.org/">
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/WCFlib" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/WCFlib">
<xs:complexType name="CompositeType">
<xs:element minOccurs="0" name="BoolValue" type="xs:boolean"/>
<xs:element minOccurs="0" name="StringValue" nillable="true" type="xs:string"/>
<xs:element name="CompositeType" nillable="true" type="tns:CompositeType"/>
<xs:complexType name="ArrayOfCompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l">
<xs:element minOccurs="0" maxOccurs="unbounded" name="CompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l" nillable="true" type="tns:CompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l"/>
<xs:element name="ArrayOfCompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l" nillable="true" type="tns:ArrayOfCompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l"/>
<xs:complexType name="CompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l">
<GenericType xmlns="http://schemas.microsoft.com/2003/10/Serialization/" Name="CompositeType.GetBaseResultOf{0}{#}" Namespace="http://schemas.datacontract.org/2004/07/WCFlib">
<GenericParameter Name="CompositeType.RetailerContract" Namespace="http://schemas.datacontract.org/2004/07/WCFlib" NestedLevel="1"/>
<xs:element minOccurs="0" name="count" type="xs:long"/>
<xs:element minOccurs="0" name="data" nillable="true" type="tns:ArrayOfCompositeType.RetailerContract"/>
<xs:element minOccurs="0" name="result" nillable="true" type="xs:string"/>
<xs:element name="CompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l" nillable="true" type="tns:CompositeType.GetBaseResultOfCompositeType.RetailerContractx0Ls4Q3l"/>
<xs:complexType name="ArrayOfCompositeType.RetailerContract">
<xs:element minOccurs="0" maxOccurs="unbounded" name="CompositeType.RetailerContract" nillable="true" type="tns:CompositeType.RetailerContract"/>
<xs:element name="ArrayOfCompositeType.RetailerContract" nillable="true" type="tns:ArrayOfCompositeType.RetailerContract"/>
<xs:complexType name="CompositeType.RetailerContract">
<xs:element minOccurs="0" name="Brand" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Color" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="MRP" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="ModelName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="SKUCode" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Serial" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="Serial2" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="SubCategory" nillable="true" type="xs:string"/>
<xs:element name="CompositeType.RetailerContract" nillable="true" type="tns:CompositeType.RetailerContract"/>
<xs:complexType name="CompositeType.TertiarySales">
<xs:element minOccurs="0" name="ISDCode" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="count" type="xs:int"/>
<xs:element minOccurs="0" name="retailerCode" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="salesdata" nillable="true" type="tns:ArrayOfCompositeType.TertiaryData"/>
This is my first test class and I'm not at all sure what I'm doing wrong, I get the error expecting a semi-colon, found '<EOF>' when trying to run this
 test class.  The code is as follows:
public class ICNFILLTest {
    static testMethod void validateICN() {
        BMCServiceDesk__Incident__c b = new BMCServiceDesk__Incident__c(ICN_Circuit_No__c ='a0AM0000005KitpMAC');
       insert b;
    b.ICN_Circuit_No__c = '';
    update b;

I tried to make it as simple as possible and I still get the error.  Any help would be greatly appreciated!