• neeedhelp
  • NEWBIE
  • 34 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 44
    Questions
  • 97
    Replies

Hi ,

      we have  a requirement that 

 

                     we want to display dynamic Buliding(Buliding 1,Buliding 2,Buliding3.....etc)sequentially in PDF(visual page).

                    But it displaying  nonsequential(Buliding1 ,Buliding3,Buliding2.....etc

 

 

  Can any one suggest me .

 

Thanks in advance!

  • April 16, 2013
  • Like
  • 0

My code is

 

public pagereference save(){
   //some code 
     for(integer i=0;i<10;i++){
         futureprocess(strl,i);
     }
     return null;
}

@future(callout=true)
public static void futureProcess(integer i,list<string> strlist){
    try{
       //some code
     }catch(exception e){
        if(apexpages.currentpage()!=null){ //this condition never satisfies
            ApexPages.Message errMsg = new ApexPages.Message(ApexPages.severity.ERROR, e.getMessage());  
                ApexPages.addMessage(errMsg);              
         }
     }
}

 In catch block the condition never sets to true and hence unable to display the Error Message.Any Ideas on this

<apex:page >
<apex:includeScript value="{!URLFOR($Resource.jquery)}"/>

<script type="text/javascript" >

 

</script>

  <div id="sidebar">
                <ul style="display: block;" class="leftnav nav ">
                <li class="submenu1 active"><a href="#account" data-toggle="tab"><i class="icon icon-home"></i> <span> Accounts</span></a></li>
                  <li><a href="#contactandaccount" data-toggle="tab"><i class="icon icon-tasks"></i> <span>Contacts and Accounts</span> </a></li></ul>
                  <div id="account" class="tab-pane">
                        <apex:include pageName="formtemplate"/>
                </div>
                <div id="contactandaccount">
                     <apex:include pageName="Includetemplate"/>
                 </div>    
            </div>

</apex:page>

 

When I click on Account only "formTemplate" page should be displayed and "IncludeTemplate" page should be hide & vice versa.Any help on this pls

 

My Apex Class is

  Public class Myclass{

  public class tempconwrapper{
    public boolean selectedcheck;
    public void setselectedcheck(boolean b){this.selectedcheck = b;}
    public boolean getselectedcheck(){return selectedcheck;}
      public Temporary_Contact__c tempcon{get;set;}
      public tempconwrapper(temporary_contact__c temporary){
         tempcon= temporary;
         selectedcheck=false;     
        }

      }
      public list<tempconwrapper> gettemporarycontactlist(){
      list<tempconwrapper> tempwrapperlist=new list<tempconwrapper>();
      list<Temporary_contact__c> TemporaryList = [select  id,Name,First_Name__c,Last_Name__c,Email__c,contact_list__c,Installment__c,Sno__c,Check_temp__c,Map_Contact__c,OrderNumber__c,Recurring__c,Xmldata__c,Master_Transaction_Number__c from Temporary_contact__c  order by createddate desc  ];
      for(Temporary_Contact__c  tempconlist: TemporaryList ){
        tempwrapperlist.add(new tempconwrapper(tempconlist));
     }
      return wrapperlist;
     }

     public pagereference processtempcon(){
      set<Temporary_contact__c> tempconset = new set<Temporary_contact__c>();
           for(tempconwrapper temp: gettemporarycontactlist()){             
                     if(temp.selectedcheck == true) { //this Value is always false in the     constructor
                        //my code                                       
                      }                   
                  }     
          return null;      
        }
     }

 My Test Class for this is

 myclass temporary = new myclass();
 Temporary_Contact__c tc = new      Temporary_Contact__c(OrderNumber__c='1321161610784412',First_Name__c='First',Last_Name__c='Last',Map_Contact__c=con.id,Installment__c=2,Check_Temp__c=true,Master_Transaction_Number__c='1210111712415518392');
insert tc;                
 batchtemporarycls.tempconwrapper tempclass = new batchtemporarycls.tempconwrapper(tc);  
 boolean b = tempclass.getselectedcheck();
 tempclass.setselectedcheck(b);
 temporary.gettemporarycontactlist();  

 Tried different ways to cover the if(temp.selectedcheck == true) part but nothing helps.Any help would be greatly appreciated

 

Thanks

 

How can I get Id of a contact object into a custom controller class

Hi all,

 

  if the month was less than today then I should show an error message through javascript in visualforce page.......I have tried but unable to...here is my code

 

/*javascript*/
if(exm < Month(today())) { condition=1; alert("Invalid month"); jQuery(".exm").focus(); return false; } /* page */ <apex:selectlist value="{!Item.ExpirationMonth}" size="1" styleclass="exm" > <apex:selectOptions value="{!item.ExpireMonth}"/> </apex:selectlist> /* in constructor */ string dd=datetime.now().format('MM/dd/yyyy'); string mon=dd.substring(0,2); string year=dd.substring(7,10); item.ExpirationMonth=mon;

 

Hi their,

 

my code

 

<Apex:pageblockbuttons >
<Apex:commandButton value="Process" action="{!Submit}" rerender="SeeResult,SeeXml" onclick="if(!Submit()){return false;}" disabled="{!error}" oncomplete="processing();" />
</Apex:pageblockbuttons>

 

public void Submit()

{

 error = true;

 

}

 

 I would disable the button after the first click, but I cannot figure out how to do that.  I need the button disabled as soon as the user clicks the button.

 

But its not working......Help pls

Hello all,

 

   My requirement is Suppose there are 3 fields a,b,c in a object......When I enter value in field a,then b,c fields should be required....Can I do it....If yes how can I do it.....Help please

<apex:selectlist value="{!dedicationval}" size="1">
<apex:selectoption itemlabel="Not Dedication" itemvalue="Not Dedication" />
<apex:selectoption itemlabel="in honor of" itemvalue="in honor of"  />
<apex:selectoption itemlabel="on behalf of" itemvalue="on behalf of" />
<apex:selectoption itemlabel="in memory of" itemvalue="in memory of" />
</apex:selectlist>

 

except for Not dedication value for remaining  value an inputtext should be displayed......how can I do it

Unable to render...Here is th code

 

  

<apex:pageblocksectionItem >
<apex:outputpanel >
<apex:inputCheckbox value="{!Invoice.Partial_Payments__c}"/>
<Apex:outputLabel value="Allow for Partial Payments(Installments)"></Apex:outputLabel>
</apex:outputpanel>
<apex:actionSupport event="onclick" rerender="Select"/>
</apex:pageblocksectionItem>


<apex:outputpanel id="Select">
<apex:outputpanel rendered="{!Invoice.Partial_Payments__c==true}">
<apex:pageblockSectionItem >
<Apex:outputlabel value="aaaaaaaaa"></Apex:outputlabel>
</apex:pageblockSectionItem>
</apex:outputpanel>
</apex:outputpanel>

 

Thanks,

Hello Everyone,

     

I have Enabled my customer portal and placed my objects into it.....But facing some problems in it....Suppose that I have created a new record for a custom object (say transaction) and saved it and after when I clicked new on a related object (which is having lookup relatonship with the object Transaction) it is saying Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.


I have added the related objects,pages and classes 

Hello Everyone,

 

       My requirement is for two different contacts I need to assign two different Customer Portals i.e., say suppose in

Contact1------ customtab1 & Customtab2 should be visible & in

Contact2------ customtab3 & customtab4 should be visible in Customer Portal

 

For this

    I have created two contacts enabled with two different Profiles....and in this profile I have added objects,pages & classes...This two profiles are added to two different Customer Portals in developer edition.

 

Now what my problem is whenever I edit in portal1 i.e., Customize Portal Tabs  I can see changes in that respective Contact1...but when I edit in portal2 I can't see changes in Contact2

Here we go....

 <apex:outputpanel rendered="{!errorxml}">
         <apex:pageBlockSection title="Payment Result">
             <apex:pageblocksectionItem >
                  <Label class="table">Transaction Status</Label>
                  <apex:outputtext value="{!cnpxmlstring.ErrorData}"/>
              </apex:pageblocksectionItem>
              <apex:pageblocksectionItem >
                  <label>Order Number</label>
                  <apex:outputText value="{!cnpxmlstring.TransactionNumber}"></apex:outputText>
              </apex:pageblocksectionItem>

       </apex:pageblocksection>

</apex:outputpanel>

 

 <apex:commandButton value="Process payment" id="processpayment"  action="{!PaymentAPIMethod}"  reRender="seexml,errorxml"/>

 

But cant able to find the payment result values.....Any help pls

 

Thanks,
   

Hi Their,

 

     I'm getting values from api automatically...In this I dont need all values to be displayed....I want only few values how can I acheive it

  

Hi their,

 

   


list<string> checkedboxValues=new list<string>{};
public list<string> getcheckedboxValues(){
if(DefaultValue!=null){
string[] temp=DefaultValue.split(';');
for(string s : temp){
checkedboxValues.add(s);
}
}
return checkedboxValues;}
public void setcheckedboxValues(list<string> checkedboxValues){this.checkedboxValues=checkedboxValues;}

 

If I write test class like this 

 

public static testMethod void testEventListing()
{

 ApexPages.StandardController testcontroller;

EventRegistration eventreg = new EventRegistration();

string s = 'test3';
list<string> s1 = new list<string>();
s1.add(s);
eventreg.setcheckedboxValues(s1);

 }

 

Throwing an error Method does not exist or incorrect signature: [EventRegistration].setcheckedboxValues(list<string>)

help pls

Hello Everyone,

     how to write test class for the following code......Here is my piece of code

 

Public void CreateContact(contact acc,string PersonType){
system.debug('contactinformation'+acc);
system.debug('persontype'+PersonType);
list<contact> ExistingContactList=[select Id,Name,Email from contact where Email=:acc.Email and FirstName=:acc.FirstName and LastName=:acc.LastName limit 1];
if(!ExistingContactList.IsEmpty()){
PersonTypeContactId=ExistingContactList[0].Id;
PersonTypeContactName=ExistingContactList[0].Name;
//do nothing
}
else {
list<CnP_PaaS__Contact_Mail_ids__c> AlternateMailList=[select Id,CnP_PaaS__Contact_Mail_id__c,CnP_PaaS__Contact__c,CnP_PaaS__Contact__r.Name from CnP_PaaS__Contact_Mail_ids__c where CnP_PaaS__Contact_Mail_id__c=:acc.Email and CnP_PaaS__Contact__r.FirstName=:acc.Firstname and CnP_PaaS__Contact__r.LastName=:acc.Lastname limit 1];
if(!AlternateMailList.IsEmpty()){
PersonTypeContactId=AlternateMailList[0].CnP_PaaS__Contact__c;
PersonTypeContactName=AlternateMailList[0].CnP_PaaS__Contact__r.Name;
}

else{
list<Contact_information_fields__c> TempList;
// firoj
if(PersonType=='Registrant'){
TempList=[select Id,Name,Field_name__c,Order_number__c,Required__c,Visible__c,Default_value__c from Contact_information_fields__c where Event_name__c=:EventId.Id Order by Order_number__c];
}
if(PersonType=='Attendee'){
TempList=[select Id,Name,Field_name__c,Order_number__c,Visible__c,Required__c,Default_value__c from Contact_information_fields__c where Registration_level__c=:LevelName and Event_name__c=null Order by Order_number__c];
}

for(Contact_information_fields__c tm:TempList)
{
if(tm.Required__c==true && tm.Visible__c==false)
{
acc.put(tm.Field_name__c,tm.Default_value__c);

}

}
// end here
system.debug('contactinformation'+acc);

insert acc;


list<CnP_PaaS__XML_Setting__c> cnpsetting=[select CnP_PaaS__Accounts__c,CnP_PaaS__No_Account__c,CnP_PaaS__Account_lp__c from CnP_PaaS__XML_Setting__c];
if(cnpsetting.size()>0)
{
if(cnpsetting[0].CnP_PaaS__Accounts__c==true && cnpsetting[0].CnP_PaaS__No_Account__c==false)
{
account account= new account(Name=acc.FirstName+' '+acc.LastName);
insert account;
acc.AccountId=account.id;
}
if(cnpsetting[0].CnP_PaaS__Account_lp__c!=null)
{
acc.AccountId=cnpsetting[0].CnP_PaaS__Account_lp__c;
}

update acc;

}
PersonTypeContactId=acc.Id;
PersonTypeContactName=acc.FirstName+' '+acc.LastName;
}
}
if(PersonType=='Registrant'){
Event_registrant_session__c CreateRec=new Event_registrant_session__c();
CreateRec.Name=PersonTypeContactName;
CreateRec.ContactId__c=PersonTypeContactId;
CreateRec.EventId__c=EventId.Id;
CreateRec.status__c='Pending';
CreateRec.Coupon_code__c=CouponCode;
insert CreateRec;
RegistrantId=CreateRec.Id;
}

if(PersonType=='Attendee'){
Event_attendee_session__c CreateRec=new Event_attendee_session__c();
CreateRec.Name=PersonTypeContactName;
CreateRec.ContactId__c=PersonTypeContactId;
CreateRec.EventId__c=EventId.Id;
CreateRec.Registration_level__c=LevelName;
CreateRec.Registrant_session_Id__c=ApexPages.currentPage().getParameters().get('Registrant');
CreateRec.status__c='Pending';
insert CreateRec;
AttendeeId=CreateRec.Id;
}
}

 

 

part of My test class for this is

 

public static testMethod void testEventRegistration(){

EventRegistration eventreg = new EventRegistration();

eventreg.CreateContact(c,'Attendee');

eventreg.CreateContact(c,'Registrant');

}

Thanks

if(themecontent.size()>0)
{
ck=true;
}
else{
ApexPages.Message errMsg= new ApexPages.Message(ApexPages.severity.ERROR, 'Please Create a Layout First ! ');
ApexPages.addMessage(errMsg);

 } 

 

Need a test class for this.......help pls

HI their,

 

   I can't see the google map in VF page when I copy and paste the code here is my code......Dnt knw y?help pls

 

<apex:page standardController="Account">

<head>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

var myOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
}

var map;
var marker;

var geocoder = new google.maps.Geocoder();
var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";

var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
});

geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);

//center map
map.setCenter(results[0].geometry.location);

//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Account.Name}"
});

//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});

}

} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});

function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}

});
</script>

<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>

</head>

<body>
<div id="map"></div>
</body>
</apex:page>

 

 

I have edited the layout of Account by Visualforce page also....

Whenever I run eclipse it is sahwing error as Java runtimr error No java virtual machine was found after searching the location

hello Everyone,

   I'm writing  a test class for a simple controller and it gave me 85% of code covered........ I want 100% of it how can I get it

 

@istest
private class sharewidgettest{
public static testmethod void testsharewidget(){

ApexPages.StandardController Controller;
sharewidget wid = new sharewidget(controller);
wid.save();

}
}

 

and this is my class

 

public class ShareWidget {

public string widgetid{get;set;}

public Share_Widget__c element{get;set;}
public ShareWidget(ApexPages.StandardController controller)
{

widgetid = apexpages.currentpage().getparameters().get('id');
system.debug('iiiiid'+widgetid);

if(widgetid == null)
{
element = new Share_Widget__c();
}
else
{
element = [select Name,Widget_Code__c from Share_Widget__c where id = :widgetid];
}
}

public pagereference Save() {

if(widgetid == null)
{

insert element;
}
else {

update element;

}
system.debug('ele'+element);
pagereference widpage = new apexpages.standardcontroller(element).view();
widpage.setredirect(true);
return widpage;
}

}

  

 Where can I find a test class written for a particular apex class.......I can only see the code covered for a particular class but unable to find the test class for it..... 

I have a controller extension for a custom object where I am trying to insert a record according to input from selectCheckbox. I am getting 'URL No Longer Exists'  and am unable to debug this or find out what is going wrong. 
Markup:

<apex:page standardcontroller="Equipment_Type__c" extensions="addMakesController1">
  <apex:pageBlock id="pageBlock1">    
        <apex:pageBlockTable value="{!usedMakes}" var="ma" style="width:20px">           
            <apex:column headerValue="Action">
                <apex:form >
                <apex:commandlink action="{!delMake}">Del</apex:commandlink>
                </apex:form>
            </apex:column>
            <apex:column value="{!ma.name}" />
        </apex:pageBlockTable>
        </apex:pageBlock>
        <apex:pageBlock id="pageBlock2">
        <apex:form >
            <apex:selectCheckboxes value="{!selectedMakes}" style="float:left"  layout="PageDirection" >
                <apex:selectOptions value="{!validMakes}" />
            </apex:selectCheckboxes><br/>
            
        </apex:form>
  </apex:pageBlock>
      <apex:form >
      <apex:commandButton action="{!addMakes}"  value="Add selected Makes" rerender="pageBlock1,pageBlock2" status="updateStatus"/>
                <apex:actionStatus startText="Please wait..." stopText="Records updated successfully" id="updateStatus"  />
      </apex:form>
</apex:page>

 Controller:

public with sharing class addMakesController1 {
    private Equipment_Type__c type;
    public addMakesController1(ApexPages.StandardController controller) {
        this.type = (Equipment_Type__c)controller.getRecord();
        
        list<Equipment_Type__c> type1=[select id,Functional_Group__r.Id from Equipment_Type__c where id=:this.type.id limit 1];
        if(type1.size()!=0)
        this.type = type1[0];
    }
    public list<Make__c> allMakes=new list<Make__c>();
    public list<SelectOption> temp=new list<SelectOption>();
    public list<Make__c> displayMakes=new list<Make__c>();       
    public list<Make__c> getUsedMakes(){
        allMakes=[select name from Make__c where Functional_Group__c=:type.Functional_Group__r.Id];
        list<Make__c> usedMakes=new list<Make__c>();
        for(Make__c m:allMakes){
            list<Type_Make__c> tmtemp=new list<Type_Make__c>();
            tmtemp=[select id from Type_Make__c where Type__c=:type.id AND Make__c=:m.id];
            if(tmtemp.size()!=0){
                usedMakes.add(m);
            }
        }
        return usedMakes;
    }         
    public list<string> selectedMakes{get;set;}
    public list<SelectOption> getValidMakes(){
        allMakes=[select name from Make__c where Functional_Group__c=:type.Functional_Group__r.Id];
        list<SelectOption> validMakes=new list<SelectOption>();
        for(Make__c m:allMakes){
            list<Type_Make__c> tmtemp=new list<Type_Make__c>();
            tmtemp=[select id from Type_Make__c where Type__c=:type.id AND Make__c=:m.id];
            if(tmtemp.size()==0){
                validMakes.add(new SelectOption(m.name,m.name));
            }
           
        }    
        if(validMakes.size()!=0){
            return validMakes;
        }
        else{
            return null;
        }
    }
    public void delMake(){}
    public void addMakes(){
            list<Type_Make__c> tmList=new list<Type_Make__c>();
            for(String m:selectedMakes){
                tmList.add(new Type_Make__c(Type__c=type.id,Make__c=[select id,name from Make__c where name=:m].id));
                 
           if(tmList.size()!=0)insert tmList;
        }
    
}

 

My code is

 

public pagereference save(){
   //some code 
     for(integer i=0;i<10;i++){
         futureprocess(strl,i);
     }
     return null;
}

@future(callout=true)
public static void futureProcess(integer i,list<string> strlist){
    try{
       //some code
     }catch(exception e){
        if(apexpages.currentpage()!=null){ //this condition never satisfies
            ApexPages.Message errMsg = new ApexPages.Message(ApexPages.severity.ERROR, e.getMessage());  
                ApexPages.addMessage(errMsg);              
         }
     }
}

 In catch block the condition never sets to true and hence unable to display the Error Message.Any Ideas on this

Hi,

 

 

 How to disable command button based on opportunity stage name.

 

My requirement is i have designed a visual force page same as stadard edit oppotunity page i have command custom button like "Sign-up" when select stage "Closed-won" enable "sign-up" button and click on sign up it will redirect to other page. other wise button disable even page load first check stage name withoout "Closed-won" button disable only.

 

 

Can nay one help?

 

 

Thank you

 

Hi, I am using below code to change my page block background color. body .bPageBlock .pbBody .red .pbSubheader{ background-color:#91AF6A !important; font-weight: bold ; font-face: comic sans ms ; color:#ffffff !important; } When i am using vf page with custom controller it is working fine, But problem is when i am using vf page with standard controller it is not applying background color mentioned above. Kindly help. Regards, Mayur

Hi guys i am new to salesforce when i tried to update the date its showing Method does not exist or incorrect signature: TODAY()

please let me know how to do

here its my code

public class updatedate
{

public date update1()
{
Student__c s1 = [ select Closed_Date__c from Student__c];

if(s1.Closed_Date__c == null)
{
s1.Closed_Date__c = TODAY();
upsert s1;

}
}
public updatedate()
{
updatedate u = new updatedate();
u.update1();
}
}

thanks advance

I receieve the following error with this Apex Controller

System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: Bid__c.Name

Apex Controller:

public with sharing class RenderController
{
  public RFQ__C rfq {get; set;}
  public boolean privatefleet {get; set;}
  public boolean Dryvan{get; set;}
  public boolean Flatbed{get; set;}
  public boolean Reefer{get; set;}
  public boolean IMDL{get; set;}
  public boolean LTL{get; set;}
  public boolean RFI{get; set;}
  public Bid__c bid{get;set;}

  public RenderController()
  {
     rfq  = new  RFQ__C();
     String rfqid = Apexpages.Currentpage().getparameters().get('rfqid');
     rfq = [select name,f_Account_Owner__c,Account_Owner__c,Mode_s__c from RFQ__c where id=:rfqid];

     if(rfq.Mode_s__c.contains('Private Fleet'))
     {
       privatefleet = true;
       bid = [select Will_Load_Following_Trailers__c,Days_of_Week__c,Must_be_food_grade_trailer__c,Driver_Work__c,Lead_Time__c,Shipper_Hours_To__c,Shipper_Hours_From__c,Cons_Hours_To__c,Cons_Hours_From__c from Bid__C where RFQ__C=:rfqid and Modes__C = 'Private Fleet'];
     }

     if(rfq.Mode_s__c.contains('Dry Van'))
     {      
     }

     if(rfq.Mode_s__c.contains('Flatbed'))
     {
      Flatbed = true;
      bid = [select Ready_at__c,Securing_Accessories__C,Deliver_by__c,Level_of_flexibility__c,Are_moves_Over_Dimensional__c,Dimensions__c,Well_Space_Needed_or_Floor_Space__c,Tarps__c,Products_Overhang_on_Front_or_Rear__c from Bid__C where RFQ__C=:rfqid and Modes__C = 'Flatbed'];
     }

      if(rfq.Mode_s__c.contains('Reefer'))
     {
      Reefer= true;
      bid = [select Temp_Low_del__c,Temp_High_del__C from Bid__C where RFQ__C=:rfqid and Modes__C = 'Reefer'];
     }

      if(rfq.Mode_s__c.contains('IMDL'))
     {
      IMDL= true;
      bid = [select Container_Size__c,f_IMDL_Opportunity_Type__C,f_Shipment_Types__c,f_Current_IMDL_provider_types__c,f_Incumbent_IMDL_Providers__c,f_Other_IMDL_providers_notes__c from Bid__C where RFQ__C=:rfqid and Modes__C = 'IMDL'];
     }

      if(rfq.Mode_s__c.contains('LTL'))
     {
      LTL= true;
      bid = [select LTL_Class__c,Class_Distribution_Notes__C,FAK_Applicable__c,FAK_Notes__c,Tariff_Base_Year__c,FSC_Schedule__c from Bid__C where RFQ__C=:rfqid and Modes__C = 'LTL'];
     }

      if(rfq.Mode_s__c.contains('RFI'))
     {
       RFI= true;
       bid = [select RFI_Required__c,RFI_Status__C,RFI_Dependent__c,RFI_Due_Date__c from Bid__C where RFQ__C=:rfqid and Modes__C = 'RFI'];
     }
  }
  public pagereference save()
  {
   upsert bid;
   Pagereference pg = new Pagereference('/a0B/o');
   return pg;
  }
  public PageReference Cancel()
  {
    Pagereference pg = new Pagereference('/a01/o');
    return pg;
  }
 VF page:

<apex:page controller="RenderController" tabStyle="RFQ__c">
   <apex:form >
       <apex:sectionHeader title="RFQ Edit" subtitle="New RFQ"/>
       <apex:pageBlock id="rfqmain" title="RFQ Information" mode="Edit">
        <apex:pageBlockButtons >
         <apex:commandButton value="Save" action="{!save}"/>
         <apex:commandButton value="Cancel" action="{!Cancel}"/>
          </apex:pageBlockButtons>
          <apex:pageBlockSection title="RFQ Information">
            <apex:outputField value="{!rfq.name}"/>
            <apex:outputField value="{!rfq.f_Account_Owner__c}"/>
            <apex:outputField value="{!rfq.Account_Owner__c}"/>
            <apex:outputField value="{!rfq.Mode_s__c}"/>
          </apex:pageBlockSection>
          <apex:pageBlockSection title="Information">
             <apex:outputField value="{!bid.name}"/>
             <apex:outputField value="{!bid.Modes__c}"/>
             <apex:outputField value="{!bid.RFQ__c}"/>
             <apex:outputField value="{!bid.f_RFQ_Due_Date__c}"/>
             <apex:outputField value="{!bid.Lanes__c}"/>
             <apex:outputField value="{!bid.RFQ_Status__c}"/>
             <apex:outputField value="{!bid.Expected_LPD__c}"/>
             <apex:outputField value="{!bid.Bid_Status__c}"/>
             <apex:outputField value="{!bid.Bid_Stage__c}"/>
             <apex:outputField value="{!bid.FSC_Type__c}"/>
             <apex:outputField value="{!bid.FSC_Peg__c}"/>
             <apex:outputField value="{!bid.LPD_Goal__c}"/>
             <apex:outputField value="{!bid.Total_LPD__c}"/>   
             <apex:outputField value="{!bid.Send_to_Pricing_Team__c}"/>                                                                                                     
          </apex:pageBlockSection>
           <apex:pageBlockSection title="Notes">
             <apex:outputField value="{!bid.Notes__c}"/>
           </apex:pageBlockSection>         
             <apex:pageBlockSection title="private fleet" id="Privatefleet" rendered="{!Privatefleet}">
             <apex:inputField value="{!bid.Will_Load_Following_Trailers__c}"/>
             <apex:inputField value="{!bid.Days_of_Week__c}"/>
             <apex:inputField value="{!bid.Must_be_food_grade_trailer__c}"/>
             <apex:inputField value="{!bid.Driver_Work__c}"/>
             <apex:inputField value="{!bid.Lead_Time__c}"/>
             <apex:inputField value="{!bid.Shipper_Hours_To__c}"/>
             <apex:inputField value="{!bid.Shipper_Hours_From__c}"/>
             <apex:inputField value="{!bid.Cons_Hours_To__c}"/>
             <apex:inputField value="{!bid.Cons_Hours_From__c}"/>
           </apex:pageBlockSection>
           
           <apex:pageBlockSection title="Dry Van" id="Dryvan" rendered="{!Dryvan}">
           </apex:pageBlockSection>
                        
           <apex:pageBlockSection title="Flatbed" id="Flatbed" rendered="{!Flatbed}">
             <apex:inputField value="{!bid.Ready_at__c}"/>
             <apex:inputField value="{!bid.Securing_Accessories__c}"/>
             <apex:inputField value="{!bid.Deliver_by__c}"/>
             <apex:inputField value="{!bid.Level_of_flexibility__c}"/>
             <apex:inputField value="{!bid.Are_moves_Over_Dimensional__c}"/>
             <apex:inputField value="{!bid.Dimensions__c}"/>
             <apex:inputField value="{!bid.Well_Space_Needed_or_Floor_Space__c}"/>
             <apex:inputField value="{!bid.Tarps__c}"/>
             <apex:inputField value="{!bid.Products_Overhang_on_Front_or_Rear__c}"/>
           </apex:pageBlockSection>   
           
           <apex:pageBlockSection title="Reefer Requirements" id="Reefer" rendered="{!Reefer}">
             <apex:inputField value="{!bid.Temp_Low_del__c}"/>
             <apex:inputField value="{!bid.Temp_High_del__c}"/>
           </apex:pageBlockSection>  
           
           <apex:pageBlockSection title="Intermodal" id="IMDL" rendered="{!IMDL}">
             <apex:inputField value="{!bid.Container_Size__c}"/>
             <apex:inputField value="{!bid.f_IMDL_Opportunity_Type__c}"/>
             <apex:inputField value="{!bid.f_Shipment_Types__c}"/>
             <apex:inputField value="{!bid.f_Current_IMDL_provider_types__c}"/>
             <apex:inputField value="{!bid.f_Incumbent_IMDL_Providers__c}"/>
             <apex:inputField value="{!bid.f_Other_IMDL_providers_notes__c}"/>
           </apex:pageBlockSection>  

           <apex:pageBlockSection title="LTL" id="LTL" rendered="{!LTL}">
             <apex:inputField value="{!bid.LTL_Class__c}"/>
             <apex:inputField value="{!bid.Class_Distribution_Notes__c}"/>
             <apex:inputField value="{!bid.FAK_Applicable__c}"/>
             <apex:inputField value="{!bid.FAK_Notes__c}"/>
             <apex:inputField value="{!bid.Tariff_Base_Year__c}"/>
             <apex:inputField value="{!bid.FSC_Schedule__c}"/>
           </apex:pageBlockSection>
           
           <apex:pageBlockSection title="RFI" id="RFI" rendered="{!RFI}">
             <apex:inputField value="{!bid.RFI_Required__c}"/>
             <apex:inputField value="{!bid.RFI_Status__c}"/>
             <apex:inputField value="{!bid.RFI_Dependent__c}"/>
             <apex:inputField value="{!bid.RFI_Due_Date__c}"/>
           </apex:pageBlockSection>
           
           <apex:pageBlockSection title="System Information">
            <apex:outputField value="{!bid.CreatedBy}"/>
            <apex:outputField value="{!bid.LastModifiedBy}"/>
           </apex:pageBlockSection>
          
       </apex:pageBlock>
     </apex:form>
   </apex:page>

  • May 22, 2013
  • Like
  • 0

hi,

i have a question can anyone please help.

how to convert instance of string to instance of schema.sobjectfield in salesforce.

Is there any method for it?

Please give a small example of the method.

 

Thanks

<apex:page >
<apex:includeScript value="{!URLFOR($Resource.jquery)}"/>

<script type="text/javascript" >

 

</script>

  <div id="sidebar">
                <ul style="display: block;" class="leftnav nav ">
                <li class="submenu1 active"><a href="#account" data-toggle="tab"><i class="icon icon-home"></i> <span> Accounts</span></a></li>
                  <li><a href="#contactandaccount" data-toggle="tab"><i class="icon icon-tasks"></i> <span>Contacts and Accounts</span> </a></li></ul>
                  <div id="account" class="tab-pane">
                        <apex:include pageName="formtemplate"/>
                </div>
                <div id="contactandaccount">
                     <apex:include pageName="Includetemplate"/>
                 </div>    
            </div>

</apex:page>

 

When I click on Account only "formTemplate" page should be displayed and "IncludeTemplate" page should be hide & vice versa.Any help on this pls

 

Hello all.

 

I'm new to apex so apologies for the ignorant questions.  I'm getting a System.NullPointerException on the following trigger.  After insert and after update work fine.  I don't think it's failing on the method as it still occurs when I comment it out.  It seems to fail on List<Asset> assets = trigger.newMap.values();  Any help would be greatly appreciated.

 

trigger Customer_Since on Asset (after insert, after update, before delete) {
        List<Asset> assets = trigger.newMap.values();
        List<String> accountIds = new List<String>();

        for (Asset a : assets){
        accountIds.add(a.accountId);
        }
    System.Debug (accountIds);
    UpdateCustomerSince.updateCustomerSince(accountIds);       
 
}

 

Thanks in advance.

 

dave

 

  • May 15, 2013
  • Like
  • 0

<apex:page controller="selectobject" >
<apex:form >
<apex:pageBlock id="pb">
<apex:outputLabel ><b>Objects :</b></apex:outputLabel>&nbsp;
<apex:SelectList value="{!selectedObject}" size="1" >
<apex:SelectOptions value="{!objectsList}"/>
<apex:actionSupport event="onchange" rerender="pb"/>
</apex:SelectList>
<apex:commandButton value="Get Fields" action="{!showFields}" reRender="pb1" status="fetchStatus" />&nbsp;
<apex:actionStatus id="fetchStatus" >
<apex:facet name="start">
<img src="/img/loading.gif" class="waitingImage" title="Please Wait..."/>
</apex:facet>
</apex:actionStatus> <br/><br/>
</apex:pageBlock>
<apex:pageBlock id="pb1">
<apex:SelectList value="{!selectedField}" size="1">
<apex:SelectOptions value="{!items}"/>
</apex:SelectList>
</apex:pageBlock>
</apex:form>
</apex:page>

Hi i need to create a visualforce page which has the capability to add the rows and delete the rows dynamically using JQuery .

Also i need to Show 2 text fields  in a row . 

 

Can u help me with the code since i have never used Jqery and i dont knw wht is it used for?

My Apex Class is

  Public class Myclass{

  public class tempconwrapper{
    public boolean selectedcheck;
    public void setselectedcheck(boolean b){this.selectedcheck = b;}
    public boolean getselectedcheck(){return selectedcheck;}
      public Temporary_Contact__c tempcon{get;set;}
      public tempconwrapper(temporary_contact__c temporary){
         tempcon= temporary;
         selectedcheck=false;     
        }

      }
      public list<tempconwrapper> gettemporarycontactlist(){
      list<tempconwrapper> tempwrapperlist=new list<tempconwrapper>();
      list<Temporary_contact__c> TemporaryList = [select  id,Name,First_Name__c,Last_Name__c,Email__c,contact_list__c,Installment__c,Sno__c,Check_temp__c,Map_Contact__c,OrderNumber__c,Recurring__c,Xmldata__c,Master_Transaction_Number__c from Temporary_contact__c  order by createddate desc  ];
      for(Temporary_Contact__c  tempconlist: TemporaryList ){
        tempwrapperlist.add(new tempconwrapper(tempconlist));
     }
      return wrapperlist;
     }

     public pagereference processtempcon(){
      set<Temporary_contact__c> tempconset = new set<Temporary_contact__c>();
           for(tempconwrapper temp: gettemporarycontactlist()){             
                     if(temp.selectedcheck == true) { //this Value is always false in the     constructor
                        //my code                                       
                      }                   
                  }     
          return null;      
        }
     }

 My Test Class for this is

 myclass temporary = new myclass();
 Temporary_Contact__c tc = new      Temporary_Contact__c(OrderNumber__c='1321161610784412',First_Name__c='First',Last_Name__c='Last',Map_Contact__c=con.id,Installment__c=2,Check_Temp__c=true,Master_Transaction_Number__c='1210111712415518392');
insert tc;                
 batchtemporarycls.tempconwrapper tempclass = new batchtemporarycls.tempconwrapper(tc);  
 boolean b = tempclass.getselectedcheck();
 tempclass.setselectedcheck(b);
 temporary.gettemporarycontactlist();  

 Tried different ways to cover the if(temp.selectedcheck == true) part but nothing helps.Any help would be greatly appreciated

 

Thanks

 

Hopefully someone can help me out here. I have written the following code:

 

 

public with sharing class insertPatientProtocolSchedule {
  //added an instance varaible for the standard controller
     private ApexPages.StandardController controller {get; set;}
         
     // initialize the controller
     public insertPatientProtocolSchedule(ApexPages.StandardController controller) {
 
        //initialize the stanrdard controller
        this.controller = controller;
        
        //Define Master Objects
  Protocol_Arm__c pa = new Protocol_Arm__c();
  Patient_Protocol_Record__c ppr = new Patient_Protocol_Record__c();
  //Create a list of objects.  Populate it with a query to the database.
  list<Protocol_Arm_Activities__c> pactList = [SELECT Name FROM Protocol_Arm_Activities__c WHERE Protocol_Arm__r.Id = :ppr.Protocol_Arm__r.Id];
//Cycle through the list, and for each object create a new one, the only difference being the MasterId
  list<Protocol_Arm_Activities__c> NewList = new list<Protocol_Arm_Activities__c>();
  for (Protocol_Arm_Activities__c paa : pactList) {
     Patient_Protocol_Activity__c ppa = new Patient_Protocol_Activity__c();
     ppa.Name = paa.Name;
     ppa.Patient_Protocol_Record__c = ppr.Id;
     NewList.add(ppa); // Error Line
  }
// insert new records
  insert NewList;
    }
 
    // method called from the VF's action attribute to clone the schedule
    public PageReference addSchedule() {
}
}
And I am getting the following Error In Eclipse on the line I have marked with //Error Line:
Save error: Incompatible element type SOBJECT:Patient_Protocol_Activity__c for collection of SOBJECT:Protocol_Arm_Activities__c
I am not seeing any issues.
Both Patient_Protocol_Activity__c and Protocol_Arm_Activities__c are the Detail in a Master-Detail relationship.
Thank you for any help you can provide.

 

This makes absolutely no sense to me. I am trying to insert two OpportunityLineItems that are exactly the same but I get this exception. What good reason is there to stop the insertion of two Records that are the same?

I understand if this was an upsert operation as you can't insert and update and the same time but I am inserting two brand new OpportuntiyLineItem records.

Thanks,
Jason


Message Edited by TehNrd on 09-24-2008 04:48 PM
  • September 24, 2008
  • Like
  • 0

I'm posting this in the hopes of helping "the next guy" that hits this.  

 

Our ant-based deployments, which had been going flawlessly for months, suddenly started failing, with lots of UNABLE_TO_LOCK_ROW errors in the logs from our various Apex test methods.  The same exact test methods passed when executed from "Run All Tests" in the UI.  We tried deploying with Eclipse and Change Sets, but got the same UNABLE_TO_LOCK_ROW errors.

 

The lines of code that were failing were all record inserts for certain objects.  We realized that if we removed those objects from our package.xml, we could complete the deployment without the errors.  However, we are making lots of object-level changes (new fields, etc), so this was a bad long-term solution.

 

After much troubleshooting, SFDC Tech Support finally found the root cause.  It turns out that if you modify the format of an auto-number field - say, change the name from "C-{0000}" to "CDM-{0000}" - subsequent deployment of that object will fail if any test methods insert records of that object.

 

Ouch.  Ugly, bad bug.  But once we knew the cause, we matched up all auto-number field formats in our source & destination orgs, and then re-ran the full ant script (with all objects) again, and the deployment was successful.

 

Hopefully SFDC will fix this odd bug quickly.  But in the meantime, if you get UNABLE_TO_LOCK_ROW" errors during deployment, check your auto-number field formats!