• Devendra@SFDC
  • SMARTIE
  • 1820 Points
  • Member since 2011

  • Chatter
    Feed
  • 61
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 110
    Questions
  • 617
    Replies

Hi,

         I am new to salesforce i am trying to understand visualforce page and apex .I have wriiten piece of code  in visual force without the controller as suggested by the developer book for salesforce but which is giving me error when i tried to save saying it is java.lang.IllegalArgumentException: Illegal view ID !{save}. The ID must begin with /

 

<apex:form >
<apex:pageBlock title="Edit Account for {!$User.FirstName}">
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="!{save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!account.Start_Date__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
</apex:pageBlock>
</apex:form>
</apex:page>

 

Can someone tell me what am i making mistake in this code.I really appreciate your help.

I've written this super easy trigger which only sets a date. I'm still learning how to write test code, so I was wondering if anybody could show me what it would be like for something this simple :

 

trigger SetContractEndDates on Contract_Terms__c (before insert, before update) {

  for (Contract_Terms__c ct : Trigger.new) {
          if (ct.Auto_Renewal_Contract_End_Date__c== null)
          ct.Overall_End_Date__c= ct.Contract_End_Date__c;
        else
          ct.Overall_End_Date__c = ct.Auto_Renewal_Contract_End_Date__c;  
  }
}

 

Thank you very much.

  • May 13, 2013
  • Like
  • 0

@future  if we use  our code executes  asynchroniously. ok good.  but  what is meant by  asynchroniously executed. what  happens to the code when we   write @future and @istest.  i  am confuse. and what is mean by synchronious and asynchronious.

Hi I imported some records from excel using import wizard, but only record ID's are imported..

Now I want to delete all the records and load again.

How do I delete all the records at once?

or should I delete one by one?

Please reply.

Thanks.

Trying to modify a test trigger for the Chat Up app as advised in the documentation, but my test fails.

 

/* Create 1 test recurring donation */
npe03__Recurring_Donation__c a = new npe03__Recurring_Donation__c(name = 'testRecurringDonation',npe03__Contact__c = '003J0000006W3j4',npe03__Organization__c
='001J0000007ZAD7');
insert a;

 

I get this error:

Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You must select an Organization or Contact: []

 

The code provided in the documentation only included adding the name field, so after the first time I got this error, I added the fields for Contact and Organization, but I still get the same error.

 

Additional info: in the form, Contact and Organization (aka Account) are lookup fields, and you would normally enter a Contact or an Organization, but not both- I'm using the Nonprofit Starter Pack, so there is a person Account associated with each Contact.  The IDs used in the code reflect the ID of the Contact and the Contact's associated Account (aka Organization) 

 

The sample code for the test trigger is provided in this documentation:

 

What am I missing?

 

Thanks, Amanda

 

Hi , I am tring to do the same functionslity as lead. I have created a custom object whhich as a custom button"convert". When we click "convert" button i must creat a account and related contact. But when doing this I am not getting the Account name in contact.

Error Message :

 

Error: Compile Error: invalid ID field: Cus_obj_Record_ID at line 40 column 22

Code:

 

public class LeadConversion {

public PageReference RedirecttoLead()
{
String currentLead = '/' + siteObj.Id;
PageReference pageRef = new PageReference(currentLead);
return pageRef;
}

private Site__c siteObj,temp_siteObj;
public ID Cus_Account_ID;
public ID Cus_obj_Record_ID;
// The extension constructor initializes the private member
// variable acct by using the getRecord method from the standard
// controller.
public LeadConversion(ApexPages.StandardController stdController)
{
System.debug('******welcome******');
siteObj = (Site__c)stdController.getRecord();
Cus_obj_Record_ID = siteObj.Id;
}

public void convertLead(){

Account acc = new Account();
acc.Name = siteObj.Name;
acc.CurrencyIsoCode = siteObj.CurrencyIsoCode;

try
{
insert acc;
}
Catch (Exception ex1)
{
ex1.getmessage();
}
Contact cc = new Contact();
cc.LastName = siteObj.LastName__c;

temp_siteObj=[select AccountId from contact where Id ='Cus_obj_Record_ID'];
Cus_Account_ID = temp_siteObj;
cc.AccountId= Cus_Account_ID;
// cc.accountId = siteObj.Name;
//Id accountId = [select AccountId from Contact where Id = {ID}][0].AccountId;
//System.Debug(accountId);

try
{
insert cc;
}
Catch (Exception ex2)
{

ex2.getmessage();
}

}

}

 

Anyone pls tell me how to resolve this issue.

Thanks,

Regards,

Lavanya.

staff,

I wish my Visualforce page was built according to the form elements. Show an accurate information block from a value of a field. I did so, but it does not work: (When passed a single parameter, it works, but as I used the formula OR, did not work)

 

<apex:pageBlockSection title="Produtos e Acessoria Técnica" columns="3" rendered="OR({!Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'CONCRETEIRA'},{!Pesquisa_de_mercado__c.Canal_de_Distribui_o__c == 'INDUSTRIA'} )" >

 

 

Does anyone know a way to accomplish?

 

thank you

Hi,

 

I am looking for possible solution to get this result:

 

                          Account Name                                      Contact Name

                     United Oil & Gas Corp.                               Lauren Boyle

                     United Oil & Gas Corp.                               Avi Green

                     sForce                                                            Jake Llorrac

                     University of Arizona                                    Jane Grey

                     University of Arizona                                    Arthur Song

 

 

 Though, I am getting this result with my regular code:

                    

                         Account Name                                       Contact Name

                    United Oil & Gas Corp.                                 Lauren Boyle

                                                                                              Avi Green

                    sForce                                                             Jake Llorrac

                    University of Arizona                                     Jane Grey

                                                                                              Arthur Song

 

 

Now, here is my code on Visualforce Page:

 

<apex:pageblocksection id="pbsAccnt" rendered="true">
    <apex:pageBlockTable id="pbtAccnt" value="{!lstACcount}" var="AC">
        <apex:column headerValue="Account(s)" value="{!AC.Accnt__c}" />
        <apex:column headerValue="Contact(s)" value="{!AC.Cont__c}" />
    </apex:pageBlockTable>
</apex:pageblocksection>

 

I already tried with Wrapper class with <apex:repeat> but it is not working.

 

Any help would be greatly appreciated.

Hi All,

 

I have inserted some Images in my Custom Objects using Rich Text Area Data type but i am not able to view them in the List view(That is when i click the Object Tab all created records are displayed except the Image even though its Column is available and also the URL inserted in it gets displayed but not the Image).

 

Please Kindly Help and Guide...!

Iam displaying a campaigns on opportunity detail page using a visual force page and when the campaign is clicked which is displauyed on opportunity campign detail is opening in that visual force page (block in opportunity page). when the campaign is clicked it should open  in a new window 

 

can anyone help me doing that 

  • April 01, 2013
  • Like
  • 0

Hi,

public void view()
{
aid=apexpages.currentpage().getparameters().get('conname');
con=[select id,lastname,name,phone,email,Department,Mailingcity,Mailingstreet,Mailingcountry,Mailingpostalcode,accountid from contact where id=:aid];
}

 

How to call view() in test class am calling following way am getting Error

 

System.QueryException: List has no rows for assignment to SObject Stack Trace Class.Contactview.view: line 30, column 1
Class.Contactview.Test: line 115, column 1

 

 

========This is my test method=========

@isTest
Static void Test()
{
account a=new account(name='acc');
insert a;
contact c=new contact();
c.lastname='suresh';
c.firstname='reddy';
c.phone='8899887778';
c.email='test@test.com';
c.Department='sales';
c.Mailingcity='Hyd';
c.Mailingstreet='anand nagar';
c.Mailingcountry='india';
c.Mailingpostalcode='500082';
c.accountid=a.id;
insert c;
if(c.id!=null)
{
apexpages.currentpage().getparameters().put('Id',c.id);
}
Contactview con=new Contactview();
con.getcontactpage();
con.view();
con.getconview();
}

 

 

 

Thanks in Advance

In Page layouts I want to change the Order of the layout.how can you do that?

Diff between Profile and permission sets?

Hi,

 

I have received a mesage from salesforce which say that they are going to move our org to a new one. from EU0 to EU3.

I have searched in all my org and I have found an Apex Class where this url is hard-coded.

I need to know how to re-write this with a function because it is not "nice" to have this and I don't want to replace eu0 by EU3...

 

str='https://c.cs4.visual.force.com/apex/eventview?id='+eid;
            //prod : str='https://c.eu0.visual.force.com/apex/eventview?

 

Could you help me here?thank you very much in advance.

 

 

public PageReference redirect1()
    {    
    
     String eventId=ApexPages.currentPage().getParameters().get('newid');
     String eid=ApexPages.currentPage().getParameters().get('id');
     string str;
     System.debug('#######'+eventId+'@@@@@@@'+eid);
       // if((eid.length()<6) && (eventId.length()>10))
       if(eid.length()>10)
        {
            str='https://c.cs4.visual.force.com/apex/eventview?id='+eid; 
            //prod : str='https://c.eu0.visual.force.com/apex/eventview?id='+eventId;    
            system.debug(str);     
          }
    PageReference r= new PageReference(str);
      r.setRedirect(true);
      System.debug('##str=https://c.cs4.visual.force.com/apex/eventview?id=+eventId =##'+str);
  //    return null;
        return r;
        
    } 

 

Hi,

 

 How to get all products using opportunity id through soql?

 

any one help me?

 

Thanks in advance

 

 

Hi,

 

I am using one Fieldset in two different Visualforce pages.  I want to change one field label in one visualforce page. Second Visualforce page will remaining same.How can I achieve this?

  • March 22, 2013
  • Like
  • 0

Hi All,

I am Creating a Simple VF Page for adding it to me Salesforce Site.

The page contains a Link for a Survey and the link is as follows :-

https://c.ap1.visual.force.com/apex/TakeSurvey?id=a009000000AgSNmAAN&cId=none&caId=none

But when i am clicking on the link it shows the following :-


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.


What could be the issue please help....My profile is of System Administrator,still not able to access the page.

Hello Folks,

 

I am using a string to concatenate address fields. Say Address1__c, Address__C, Address__c. When I concatenate these fields it becomes a longer string.

 

Hence I want to add a new line character into the string, so that when it displays on the page - address 1, address 2 and address 3 would appear on the new line.

 

How can we achive this? I was trying with adding a '\n' character into the string. But it wasn't working.

 

Thanks,
Devendra S

 

 

 

 

 

 

 

Hello Folks,

 

How to use retURL with multiple parameters in apex method?

 

Thanks,

Devendra

 

 

Hello Board,

 

I am having a problem with the <apex:composition> tag. I have created my Sites application in my development org and packaged the VF pages and Controller into a managed package.

When I install the package into the destination org, the only Site Template I'm able to use is the site template that I packaged with my app. I want to allow the user to create their own Site Template (unmanaged, in their org) and set this page as the Site Template.

 

<apex:page>
<apex:composition template="{!$Site.Template}">
<apex:define name="myContent">
Hello Salesforce!!!
</apex:define>
</apex:composition>
</apex:page>

 

And the template I package with my app:

<apex:page >
<div class="content">
<apex:insert name="myContent" />
</div>
</apex:page>

 


When I deploy my package, if i configure my Site to use the template that I've packaged, everything works fine. But the moment I change the Site Template to point at a different template that didn't come with my package.

 

I want to allow user to select template which is not a part of managed package.

 

Thanks,
Devendra

Hello Board,

 

The standard Camppaign object can define status values for every record. These status values then assign to campaign member. Currently, I am retrieving Status values using Describe Schema. But I am getting all the status values assigned to all campaigns. I am looking to retrieve status values of specific campaign and display those values in dropdown list. Will this be possible?

 

Thanks,
Devendra

 

Hello Board,

 

How to create Permission Set for Force.com Site Guest User?

 

Which license type to be choosen for Guest User?

 

Thanks,

Devendra

Hello Board,

 

We have created a managed beta package and installed it into the DEV org.

 

Apex classes are visible in Setup-->Develop-->Apex Classes.

 

Now we were looking for adding some of these classes to force.com site. But package classes are not visible under "Enable Apex Class" section. What is missing here?

 

Also we tried to uninstall same package, It gives following error:

 

 

Error
Unable to uninstall package
Problems  
Component Type Name ProblemRecord Type
 This installed component is referenced by a locally created component. Test EVENT

 

But there is no record of 'Test EVENT' in our org.

What causing this error?

 

 

Thanks,

Devendra

 

Hello Board,

 

I am stuck with one scenario here,

 

I have implemented one visualforce page, which will be part of Managed Package and will be represented on a force.com website.

 

As this package can be used by multiple organizations. I would like this page would have the branding (css, logo, header, footer etc.) as per the organization.

 

The question arises here, how we can make these css, logo, header, footer as dynamic? So that whichever orgnaization uses this package can do their branding customization, even though this page is part of managed package?

 

What do you all suggest here?

 

Thanks,

Devendra

Hello Board,

 

Salesforce doc says,

 

When a rich text area field is used in a formula, the HTML tags are stripped out before the formula is run. For example, when a rich text area field is used in a validation rule's criteria, the HTML tags are removed before the evaluation.

 

I am creating a cross object formula field with return type TEXT to access Rich Text Area field. But RTA field was not available there.

 

What I am missing here?

 

Thanks,

Devendra

 

I have two inline VF pages on the same Page Layout.

 

I want to refresh one of the inline VF page from another inline VF page.

 

How this can be possible?

 

Thanks,

Devendra

 

 

 

Hello,

 

A site page is accessed by Guest User with Guest Profile and a Guest User wants to perform update operation on Standard Object (Campaign, Contact, Campaign Member).

 

Will that be possible using Guest Profile? If not then what would be the workaround?

 

Thanks,
Devendra

 

Hello Board,

 

I have a custom object "Object 1" and I want to create a Lookup relationship with the CampaignMember Standard object.

 

But I Can not see the same object in the Lookup relationship list?

 

How to create relationship with CampaignMember object?

 

Thanks,

Devendra

Hello Board,

 

We need to setup Sales/CRM App for following scenario.

 

Scenario:


1) A company has their branches across the state.


2) Each branch would like to create records(accounts,contacts) in sales app, set up the workflow, generate reports-dashboards etc.


3) How to set up for them? Does single use credential is enough for all branches or to have separate user for each branch? What if hirearchy in branch incrases (They might need more users), which will increase cost?


4) How we can minimize the cost in this case?

 

Had anyone setup for such scenarios? Idea's are welcome.

 

Thanks,

Devendra

Hello Board,

 

We have a managed package which has Job as one of the object.

 

We have introduced a new field(TextField) for the Job object in new version.

 

We want to populate data for this field.

 

How can we populate data for this field?

 

Thanks,
Devendra

 

Hello Board,

 

I have created VF page and Apex class to create Roles in the organization. But it is allowing user to create duplicate Roles as well. I want to restrict users from creating duplicate Roles.

 

I also checked salesforce fucntionality to create Role from Setup--> Manage User--> Create Role. The standard functionality restricts user from creating duplicate Roles.

 

Here is my VF and Apex code:

 

VF Page:

<!-- This Page is used to create new Role under Admin section -->
<apex:page standardController="UserRole" extensions="UserRoleExtension" tabstyle="MyAdmin__tab">
   <apex:sectionHeader title="Role Creation"></apex:sectionHeader>
   <apex:form >
      <apex:pageBlock mode="edit">
         <apex:pageMessages/>
         <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" value="Save"></apex:commandButton>
            <apex:commandButton action="{!cancelme}" value="Cancel" immediate="true"></apex:commandButton>
         </apex:pageBlockButtons>
              
         <apex:pageBlockSection title="Role Information" columns="2" collapsible="false">  
             <apex:pageBlockSectionItem >
                 <apex:outputLabel value="{!$ObjectType.UserRole.Fields.Name.Label}"></apex:outputLabel>
                 <apex:inputField value="{!UserRole.Name}"/> 
             </apex:pageBlockSectionItem>
         </apex:pageBlocksection>
      </apex:pageBlock>
   </apex:form>
</apex:page>
<!-- End of Page -->

 Apex Class:

 

// This class is used to create New UserRole
public with sharing class UserRoleExtension 
{
    // Global variables 
 //   public boolean isError{get;set;}
    private final UserRole objRole{get;set;}

    // ENd of Global variables 
    
    // Standard Controller Constructor 
    public UserRoleExtension(ApexPages.StandardController controller)
    {
     //   isError=false;
        this.objRole=(UserRole)controller.getRecord();
    }
    // End Constructor 
    
    // Method called on to Save New Role 
    public Pagereference Save()
    {
       try
       {
           insert objRole;
       }
        catch(DMLException e)
        {
        //  isError = true;
           ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, string.valueOf(e))); 
          return null;
        }
        // After saving Role, navigate to Role Tab in Admin section
        PageReference p=new PageReference('/apex/AdminListView?intFocus=6');
        p.setRedirect(true);
        return p;
    }
    // End Save Role
}// End of Class

What changes are required in apex to restrict user from creating duplicate Roles? 

 

Thanks,

Devendra

 

 

What is the difference term Data.com, Database.com and Force.com?

 

How these terms are interrelated with each other as well as with salesforce?

 

Thanks,

Devendra

 

Hello Board,

 

Can we write Trigger on UserRole object?

 

Thanks,

Devendra

Hi,

 

I am looking to develop below functionality for Custom Object.

Contact Role Functionality

 

I am creating child records for opportunity record. By standard way I can create single record at a time. But I am looking to build above functionality. So that user can create multiple child records at a time. How we can do it using vf and apex classes?

 

Thanks,

Devendra

Hi,

 

<select id="makeList" name="make" onfocus="this.select();">
<apex:repeat value="{!makeList}" var="lst">
<option value="{!lst}">{!lst}</option>
</apex:repeat>
</select>

 

<input type="text" id="promoDueDt1" name="promoduedt1" onfocus="DatePicker.pickDate(false,'promoDueDt1', false);" size="10"/>


I am using above code to display Datepicker on VF page. It display the datepicker. But at the time page load, datepicker pops up. I want to give setFocus to the select list and not to the datepicker at the time of pageload. The date picker should pop up only when user clicks on this field.

 

How can I give control to select list at the time of page load and stop popping up datepicker at the time of page load?

 

Thanks,
Devendra

Hello Board,

 

Salesforce Summer'12 gives an enhanced version of lookup realationship.

 

But If we have Managed Package application then Will it allow us to modify the older lookup relationships to enhanced version of lookup relationship?

 

I dont think it will be possible, but just wanted to confirm on this. Because SF does not provide us an option to change datatypes etc after packaging.

 

Thanks,
Devendra

Hello Board,

 

How to loop through child objects, find the parent records?

 

Child 1
Parent 1
Child 2
Parent

 

Summary by Child object

 

Thanks,

Devendra

 

Hello Board,

 

I have a custom object "Object 1" and I want to create a Lookup relationship with the CampaignMember Standard object.

 

But I Can not see the same object in the Lookup relationship list?

 

How to create relationship with CampaignMember object?

 

Thanks,

Devendra

 

Hello Board,

 

I have given PNG image ( size : 5 KB) to Custom Application.

 

The issue i am facing is, when i click on Home Tab or Chatter tab, the image flashes when respective page gets load.

 

What would be issue casuing this problem?

 

Thanks,
Devendra

displaying all the objects in one block.
if we click on any object it should show that perticular object filed..
like that it shoud go on...
...like a formula table structure

Here is my code .....i didnot pass id value from pageblocktable column (param tag) to apex class ... it gives null....value...so please help me...

 

 

<apex:page controller="approvalclass" sidebar="false">
<apex:form >
<apex:pageBlock >
<apex:pageblockTable value="{!data}" var="d">
<apex:column >
<apex:outputPanel >
<apex:commandButton action="{!approvalagent}" value="Approv">
<apex:param value="{!d.id}" name="{!passid}" assignTo="{!passid}"/>
</apex:commandButton>
<apex:commandButton action="{!rejectagent}" value="Regect">
<apex:param value="{!d.id}" assignTo="{!passid}" name="passid"/>
</apex:commandButton>
</apex:outputPanel>
</apex:column>
<apex:column value="{!d.Account__c}"/>
<apex:column value="{!d.State_Territory__c}"/>
<apex:column value="{!d.Policy_Types__c}"/>
<apex:column value="{!d.Policie_status__c}"/>
<apex:column value="{!d.State_Territory__c}"/>
<apex:column value="{!d.Commission_Rate__c}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

-------------------------

class

 

 

public with sharing class approvalclass {
public string passid { get; set; }
public list<policie__c> p=new list<policie__c>();
list<policie__c> pc=new list<policie__c>();
public approvalclass(){
passid= System.currentPageReference().getParameters().get('id');
system.debug('*********************************************'+passid);  }
    public PageReference rejectagent() {
    system.debug('*********************************************'+passid);
       pc=[select id,name,Maturity_Amount__c,Commission_Rate__c,Account__c,Policie_status__c,Policy_Types__c,Premium_Amount__c,State_Territory__c from policie__c];
   for(policie__c pt:pc )
   {
     if(pt.Commission_Rate__c!=null && pt.id==passid)
     pt.Approval_status__c='Reject';
     
          upsert pt;  
    }  
      return null;
    }


    public PageReference approvalagent() {
       system.debug('*********************************************'+passid);
   pc=[select id,name,Maturity_Amount__c,Commission_Rate__c,Account__c,Policie_status__c,Policy_Types__c,Premium_Amount__c,State_Territory__c from policie__c];
   for(policie__c pts:pc)
   {
      if(pts.Commission_Rate__c!=null && pts.id==passid)
       pts.Approval_status__c='approval';
    
      upsert pts;   
    }
    
        pagereference ref = new pagereference('https://ap1.salesforce.com'+passid);
        ref.setredirect(true);
        return ref;

 
 }

    public list<policie__c>getData() {
    p=[select id,name,Maturity_Amount__c,Account__c,Policie_status__c,Policy_Types__c,Premium_Amount__c,Commission_Rate__c,State_Territory__c from policie__c where ownerid=:userinfo.getuserid()];
    
        return p;
    }



}

Hi

 

I am trying to create my own custom home page. Is there a quick and easy way I can place the standard Salesforce Home Page components on this VF page (before I add my own stuff). In particular I need Calendar ,Tasks and Messages and Alerts.

 

 

Many thanks for any and all help,.

Ross

 

Recruiting App is bast for Admin (Configuration)  , But Whitch is best App for Developer like Apex, Triggers, VF pages 

If u know any one ple  refer me as pdf or any link 

                                     

                                                                                           Thank u.

What should be the code coverage for a Trigger? 

Hi All

 

I have 2 lakhs records, out of 2 lakhs i want to display 1 lakh records only? what is the query ?

 

thanksin adavance

 

pavan

hi 

i am new to salesforce could anyone please help.

i have a problem

i have 3 pages using the same controller

page1

page2

page3

controller1

 

i am calling page2 using

 PageReference page2 = new PageReference('/apex/page2');
  page2.setRedirect(false);
  return page2;

 

i m calling page3 using:

 PageReference newpage = new PageReference('/apex/page3');
  newpage.setRedirect(true);
  return newpage;

 

does setredirect(false) call the page 2 times?

i mean first time when i call the page2, as set redirect is false its url is still showing page1

but next time when i try to call page3 when im on url of page1 but internally from server im on page2

page3 is not displayed n it calls page2 again.

Could you please help or provide an example of calling next pages with setRedirect(false);

with the urls.

 

Thanks.

Hi,

         I am new to salesforce i am trying to understand visualforce page and apex .I have wriiten piece of code  in visual force without the controller as suggested by the developer book for salesforce but which is giving me error when i tried to save saying it is java.lang.IllegalArgumentException: Illegal view ID !{save}. The ID must begin with /

 

<apex:form >
<apex:pageBlock title="Edit Account for {!$User.FirstName}">
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="!{save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField value="{!account.Start_Date__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
</apex:pageBlock>
</apex:form>
</apex:page>

 

Can someone tell me what am i making mistake in this code.I really appreciate your help.

So let me preface this by stating that I have searched the boards and Google in general and have not been able to find a simplified explanation for what I am trying to do. I have very limited coding skills and no experience when it comes to Apex triggers so I appreciate in advance any and all help you can provide. I will do my best to explain below what I am trying to do.

 

On my lead records, I have a look up field to a custom object called 'Distributors.' If a lead comes in from an outside distributor, then the internal sales rep can look up and add the appropriate distributor. Sometimes these outside distributors have co-branded web landing pages so that visitors can fill out a web form, which becomes a new lead record. What I need is a way to have the distributor automatically filled in, something that doesn't necessarily need to occur upon the initial record creation, but could happen following this initial creation or during the subsequent record editing.

 

What I have in mind is a hidden pick list with all distributors listed. The web form would be set to default to the specified distributor value and the apex trigger would then take the text of this value and insert it into the look up field. If this doesn't work because of the source being a pick list, then I could create a workflow that takes the pick list value and inserts it into a text box. 

 

What I need help with is the basic code to make this happen as it's something that I will need to perhaps extend to campaigns and other custom objects that rely on the use of a look up fields on the lead record.

 

Once again, thank you in advance for taking the time to read this and for any help that can be provided.

Hi,

 

I am migrating data from one salesforce org to another. Can any one tell me how do I migrate Attachments?

I used the file exporter to download the attachments from the source org but while uploading attachments to the new org

I got the error "Error Converting value to correct data type"

 

Any help would be highly appreciated.

 

Hi, I am trying to create a managed package in a Dev Org but the problem is as soon as I create the managed package and compile all the classes in the org, i get the below error. Surprisingly when I comment these lines also, i get the same error . Looks like it is being picked from cache.

line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote
line -1, column -1: Previous load of class failed: Espresso_MP.cloneQuoteController: line 39, column 24: quotefieldset is not a fieldSet of Quote

This field set is part of the managed package. So not sure what is the issue here ? I see this issue everywhere where field sets are used. We need to create the managed package and deliver it to the testing team ASAP so that it can be delivered to the client. Any help would be highly appreciated. Below are the Org details.

Org Id : 00Db0000000XxKP
Instance : eu2

Important Note : I have tried deploying all the code in 3 different Dev orgs and everywhere I got the same error.\

 

 

-Vik

 I have a inputtext  in my VF page  as

 

        <apex:pageBlockSection >
         <apex:pageblockSectionItem >
          <apex:outputLabel for="searchText" style="font-size:14px">RefID/FileNumber</apex:outputLabel>
          <apex:panelGroup >
          <apex:inputText id="searchText" value="{!searchText}"/>
          <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>
          </apex:panelGroup>
         </apex:pageblockSectionItem>
        </apex:pageBlockSection>

 

I'm using that text field in my controller to compare one of my text field in the LeadBackup__c object as

 

public PageReference search() {
   // String qry = 'select id,Ref_ID_File_Number__c, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall__c from LeadBackup__c' + where Ref_ID_File_Number__c = searchText  order by name';
    searchResults1 = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];
    //searchResults = Database.query(qry);
   
     
     //searchResults = [select id, name, FirstName, LastName, Status, Ref_ID_File_Number__c, Email, Phone, Street, City, State, Country, PostalCode, TAB_Message__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,DoNotCall from Lead where Ref_ID_File_Number__c =:searchText  order by name];

   
    if(searchResults1.size()==0){

          LeadBackup__c lb = new  LeadBackup__c(RefID_FileNumber__c = searchText,
                                                Name=[select name,id from lead where Ref_ID_File_Number__c=:searchtext ].Name,
                                                City__c=[select name,id,city from lead where Ref_ID_File_Number__c=:searchtext ].City,
                                                Street__c=[select name,id,street from lead where Ref_ID_File_Number__c=:searchtext ].street,
                                                State__c=[select name,id,state from lead where Ref_ID_File_Number__c=:searchtext ].state,
                                                Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id,
                                                Email__c = [select name,id,Email from lead where Ref_ID_File_Number__c=:searchtext ].Email,
                                                Phone__c = [select name,id,Email,Phone from lead where Ref_ID_File_Number__c=:searchtext].Phone,
                                                Evening_Phone__c = [select name,id,Evening_Phone__c  from lead where                 Ref_ID_File_Number__c=:searchtext ].Evening_Phone__c,
                                                Preferred_Call_Time__c = [select name,id,Evening_Phone__c,Preferred_Call_Time__c   from lead where Ref_ID_File_Number__c=:searchtext ].Preferred_Call_Time__c,
                                                Notes__c = [select name,id,Evening_Phone__c,Notes__c   from lead where Ref_ID_File_Number__c=:searchtext ].Notes__c,
                                                Do_Not_Call__c = [select name,id,Evening_Phone__c,DoNotCall   from lead where Ref_ID_File_Number__c=:searchtext ].DoNotCall);
          //searchResults.add(lb);
          system.debug('lb'+lb);
          insert lb ;
          
          searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

          
    }else{
    
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'<b>Please confirm name and address below. Address will be where the letter was received/addressed. If these do not match, you will need to re-verify Ref ID, as it may have been entered incorrectly</b>'));
       
       searchResults = [select id,RefID_FileNumber__c,Name, Email__c, Phone__c, Street__c, City__c, State__c, TAB_Message__c, TAB_Time_stamp__c, Evening_Phone__c, Preferred_Call_Time__c, Notes__c,Do_Not_Call__c from LeadBackup__c where RefID_FileNumber__c =:searchText  order by name];

       return null;
    }
    return null;
  }
 
 
  public PageReference save() {
   
   if(!(String.isEmpty(searchText))){  -----------------From Here my code is not covering how to pass this search text in test class
          
       try {
            
            list<LeadBackup__c> lstupdate = new list<LeadBackup__c>();
            
                 
             For(LeadBackup__c le:searchResults){
             
             //le.Id = lead.Id;
             le.RefID_FileNumber__c = searchResults[0].RefID_FileNumber__c ;
             le.Lead__c = [select name,id from lead where Ref_ID_File_Number__c=:searchtext ].id;
             le.Name = searchResults[0].Name;
             le.Email__c = searchResults[0].Email__c;
             le.Phone__c = searchResults[0].Phone__c;
             le.Evening_Phone__c = searchResults[0].Evening_Phone__c ;
             le.Preferred_Call_Time__c = searchResults[0].Preferred_Call_Time__c;
             le.Notes__c = searchResults[0].Notes__c;
             le.Do_Not_Call__c = searchResults[0].Do_Not_Call__c;
             le.TAB_Message__c = True;
             le.TAB_Time_stamp__c = System.now();
             lstupdate.add(le);
             }
             
             update lstupdate;
      
      ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Record <b>'+searchResults[0].Name+'</b> has been Updated'));
            
    } Catch (DMLException e) {
      ApexPages.addMessages(e);
      return null;
    }
   
    searchText='';
    searchResults.clear();
    return null;
       
  }
  else
  {
       ApexPages.addmessage(new ApexPages.message(ApexPages.severity.info,'Please enter REFID/FileNumber'));
  }
 
  return null;
 
}

 

How to pass this search text to the test class ......

Any help would appreciated greatly...

 

 

I've written this super easy trigger which only sets a date. I'm still learning how to write test code, so I was wondering if anybody could show me what it would be like for something this simple :

 

trigger SetContractEndDates on Contract_Terms__c (before insert, before update) {

  for (Contract_Terms__c ct : Trigger.new) {
          if (ct.Auto_Renewal_Contract_End_Date__c== null)
          ct.Overall_End_Date__c= ct.Contract_End_Date__c;
        else
          ct.Overall_End_Date__c = ct.Auto_Renewal_Contract_End_Date__c;  
  }
}

 

Thank you very much.

  • May 13, 2013
  • Like
  • 0

Dear All,

 

We had created a custom check box in the user object, as per the check box value ( checked/ Un checked),   

i would like to restrict the user to not to enter values in the pick list fields.

 

If the pick list value is checked then user can enter values to the pick list fields. If it is unchecked, then i should restrict him.

 

Any one can help me in this scenario.

 

Promt responses will highly appriciated.

 

Thank you

 

Regards,

Prakki 

I created a Custom Object application on my regular Salesforce account.  I then created a Customer portal and enabled the tab and the custom object on the Portal site. 

 

It seems to be working, the portal user can view and access the tab and the object.. However, after the portal user enters the data and the record is created it is only saved on their portal account.    That data is not available to other portal users and is not transferring back to my Salesforce account?

 

I can't seem to find any information on this issue, so any suggestions would be appreciated.

 

Thanks

Scott

 

I have an apex component in which the constructor in the controller is exectuting twice. I have made all the pages and classes as simple as possible to reproduce and this is what we have:

 

The Page

<apex:page >	
    <c:myComponent />
</apex:page>

 

The Component

<apex:component controller="MyController" >
    <apex:form >
        <apex:actionFunction name="thisIsMyName" action="{!doSomething}"  />	
    </apex:form>
</apex:component>

 

The Controller

public class MyController {
	
    //Constructor
    public MyController(){
        system.debug('I am a constructor and I am executing multiple times to drive you crazy.');
    }
    
    public void doSomething(){
    	//Blah blah blah
    }

}

 

The Debug Log

23.0 APEX_CODE,DEBUG
18:56:46.028 (28871000)|EXECUTION_STARTED
18:56:46.028 (28903000)|CODE_UNIT_STARTED|[EXTERNAL]|066500000008tEE|VF: /apex/mypage
18:56:46.039 (39198000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.039 (39850000)|METHOD_ENTRY|[1]|01p50000000DYoB|MyController.MyController()
18:56:46.039 (39939000)|METHOD_EXIT|[1]|MyController
18:56:46.041 (41245000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41308000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.041 (41830000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.041 (41872000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41894000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.071 (71248000)|CODE_UNIT_FINISHED|VF: /apex/mypage
18:56:46.071 (71263000)|EXECUTION_FINISHED

Any ideas why this is happening. It is making me go a little crazy.

 

If I move everything that is in the component directly to the page it will only execute once, as expected, but I need use components.

 

Thanks,

Jason

  • April 29, 2012
  • Like
  • 1