• swapna9
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 22
    Replies

Hi,

 

I am working on soap integration.In one method I am calling webservice method and adding all the values into one list then displayed list in visualforce page.Upto this its working fine.After this I am trying to call the same list in another method.In debug log i am getting null.

 

can anyone suggest me how to call static webservice method data(list) to other method.

 

here is the code:

global class WebserviceCall1 {

public static List<QlitemDetail> QlitemDetailList {get;set;}

public WebserviceCall1(ApexPages.StandardController controller) {
}
public WebserviceCall1() {
}
@future (callout=true)
WebService static void getPin() {
//Here Authentication code I written.
QlitemDetailList = new List<QlitemDetail>();
XmlStreamReader xsr = new XmlStreamReader(getRes.GetInfoResult);
while(xsr.hasNext()) {
if(xsr.getEventType()==XmlTag.START_DOCUMENT)
{
xsr.next();
xsr.next();
while(xsr.getEventType()!=XmlTag.END_DOCUMENT)
{
String PNumber ='';
if(xsr.getLocalName() == 'PNUMBER')
{
system.debug(xsr.getLocalName());
xsr.next();
system.debug(xsr.getEventType());
if (xsr.getEventType() == XmlTag.CHARACTERS)
{
PNumber = xsr.getText();
xsr.next();
}
}
QlitemDetail q = new QlitemDetail();
q.Number = PNumber;
QlitemDetailList.add(q);
xsr.next();
system.debug('------------------'+QlitemDetailList);
}
}
}
}
public void Sendpin1() {
system.debug('-------Sendpin-----------'+QlitemDetailList);
//here QlitemDetailList is displaying null
}
public class QlitemDetail {
public String PNumber {get;set;}
}
}

 

Thanks in advance,

 

Hi,

 

I have a checkbox field in task "Test_Check__c".

 

I want to compare Remider Date/Time with now() i.e If Reminder Date/Time is equals to now() then i want to update "Test_Check__c" as true.

But I am not able to compare Remider Date/Time with now() in entri criteria.In formula criteria also "Remider Date/Time" field is not appearing.

 

Can anyone suggest me...

 

 

 

Thanks,

 

 

 

Hi,

 

I have one custom object as service request(Service_Request__C).it is having lookup to user (filed name:Service_Assistant__c).

I am updating this field value with one user name using work flow.

After creating record in service request i want to create 2 tasks. one is with the current user name and another one is with another user name which i am updating with work flow.(Service_Assistant__c).

 

but my trigger is creating two tasks with same owner id.task is not getting created with the other username which i am updating with work flow..

 

below is my code

 

trigger taskcreation on Service_Request__c (after insert) {

for(Service_Request__c sr:trigger.new)
{
 Task t= new Task();
 t.ActivityDate = sr.Due_Date__c;
 t.WhatId = sr.id;
 insert t;


 Task t1= new Task();
 t1.ActivityDate = sr.Due_Date__c;
 t1.WhatId = sr.id;
 if(t1.OwnerId !=null)
  t1.OwnerId = sr.Service_Assistant__r.Id;   //This is not working
 insert t1;

}

 

pleaseguide me...

 

Thanks in advance.....

 

Hi,

 

Under Opportunities Service_Request Object is there.In Service_Request__c object Contact_name__c Is lookup to contacts.
Here i want to filter contact name by account name.In Service_Request__C ,I pulled the account name using formula field and also i updated account name using work flow.

 

Formula field and related to work flow field is not appearing in filter criteria.

 

Can any one guide me how can i filter contact name by Account name...

 

Thanks in Advance,
Swapn

Hi,

 

I was able to search one field in one object using vf page and controller.But i want to search diiferent fileds from different objects in single vf page.

In my code i can search student name ( input field) from  student object.At the same time i want search account name( which is another input field).from account object.My problem is i am able to get the record in standard controller only.

 

Can any one guide me.....

 

here is my code:

 

<apex:page StandardController="Student__c" extensions="SearchAppointments " showHeader="false" sidebar="False">
<apex:form >
<table>
<apex:pageBlock >
<apex:outputText > <font size="2" color="blue" >Search Appointments</font></apex:outputText>
<tr>
<td><b> Name : </b> 
<apex:inputField value="{!Student__c.Name}"/>  
<apex:commandButton action="{!AppSearch}" value="Search Appointments"/>
</td>
</tr>
</apex:pageBlock>
</table><br></br><br></br>
<apex:pageBlock >
<apex:pageBlockSection columns="1" title="Results">
<table>
<tr align="center">
<td align="center">
<apex:pageBlockTable value="{!AppSearchData}" var="DS" title="Available Doctors" width="100%">
<apex:column value="{!DS.Name}"/>
</apex:pageBlockTable>
</td>
</tr>
</table>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

apex class:

Public class SearchAppointments {

public PageReference AppSearch() {
return null;
}

public Student__c AppSearch {get;set;}
public SearchAppointments (ApexPages.StandardController controller) {
AppSearch=(Student__c)controller.getRecord();
}

public List<Student__c> getAppSearchData(){
List<Student__c> listBd=[select Id,Name from Student__c where Name=:Appsearch.Name ];
return listBd;
}
}

 

Thanks in advance...

Hi,

 

I am new to wrapper classes.I wanted to know on which situations we will use wrapper classes.

I am using the following code.But if i check the check boxes its not displaying only those records.

 

Here is my code:

 

public class wrapperClassController {

 
    //Our collection of the class/wrapper objects cContact

    public List<cContact> contactList {get; set;}

 

    //This method uses a simple SOQL query to return a List of Contacts

    public List<cContact> getContacts() {

        if(contactList == null) {

            contactList = new List<cContact>();

            for(Contact c : [select Id, Name, Email, Phone from Contact limit 10]) {

                // As each contact is processed we create a new cContact object and add it to the contactList

                contactList.add(new cContact(c));

            }

        }

        return contactList;

    }
 

 

    public PageReference processSelected() {

 

                //We create a new list of Contacts that we be populated only with Contacts if they are selected

        List<Contact> selectedContacts = new List<Contact>();

 

        //We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list

        for(cContact cCon : getContacts()) {

            if(cCon.selected == true) {

                selectedContacts.add(cCon.con);

            }

        }

 

        // Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc

        System.debug('These are the selected Contacts...');
        for(Contact con : selectedContacts) {

            system.debug(con);

        }

        return null;

    }

 
 

    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value

    public class cContact {

        public Contact con {get; set;}

        public Boolean selected {get; set;}

 

        //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false

        public cContact(Contact c) {

            con = c;

            selected = false;

        }

    }

}

 

Vf page:

 

<apex:page controller="wrapperClassController">

    <apex:form >

        <apex:pageBlock >

            <apex:pageBlockButtons >

                <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>

            </apex:pageBlockButtons>

            <!-- In our table we are displaying the cContact records -->

            <apex:pageBlockTable value="{!contacts}" var="c" id="table">

                <apex:column >

                    <!-- This is our selected Boolean property in our wrapper class -->

                    <apex:inputCheckbox value="{!c.selected}"/>

                </apex:column>

                <!-- This is how we access the contact values within our cContact container/wrapper -->

                <apex:column value="{!c.con.Name}" />

                <apex:column value="{!c.con.Email}" />

                <apex:column value="{!c.con.Phone}" />

            </apex:pageBlockTable>

        </apex:pageBlock>

    </apex:form>

</apex:page>

 

can any one guide me...

 

Thanks in advance...

Hi,

 

I am trying Jeff Douglas code to search contacts dynamically in visual force.

It is not searching properly.In Debug-SOQL it is not updating query.

 

Can any one guide me.

 

here is my code:

 

VF page:

<apex:page controller="ContactSearchController" sidebar="false" >
 
  <apex:form >
  <apex:pageMessages id="errors" />
 
  <apex:pageBlock title="Find Me A Customer!" mode="edit">
 
  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">
 
      <apex:pageBlock title="Parameters" mode="edit" id="criteria">
 
      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("firstName").value,
          document.getElementById("lastName").value,
          document.getElementById("accountName").value,
                    );
      }
      </script>
 
      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors">
          <apex:param name="firstName" value="" />
          <apex:param name="lastName" value="" />
          <apex:param name="accountName" value="" />
          
      </apex:actionFunction>
 
      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">First Name<br/>
        <input type="text" id="firstName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Last Name<br/>
        <input type="text" id="lastName" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Account<br/>
        <input type="text" id="accountName" onkeyup="doSearch();"/>
        </td>
      </tr>
            </table>
 
      </apex:pageBlock>
 
    </td>
    <td valign="top">
 
    <apex:pageBlock mode="edit" id="results">
 
        <apex:pageBlockTable value="{!contacts}" var="contact">
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="First Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="firstName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.firstName}"/>
            </apex:column>
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="lastName" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.lastName}"/>
            </apex:column>
 
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Account" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="account.name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!contact.account.name}"/>
            </apex:column>
 
            
 
        </apex:pageBlockTable>
 
    </apex:pageBlock>
 
    </td>
  </tr>
  </table>
 
  <apex:pageBlock title="Debug - SOQL" id="debug">
      <apex:outputText value="{!debugSoql}" />           
  </apex:pageBlock>    
 
  </apex:pageBlock>
 
  </apex:form>
 
</apex:page>




Apex Class:

public with sharing class ContactSearchController {
 
  // the soql without the order and limit
  private String soql {get;set;}
  // the collection of contacts to display
  public List<Contact> contacts {get;set;}
 
  // the current sort direction. defaults to asc
  public String sortDir {
    get  { if (sortDir == null) {  sortDir = 'asc'; } return sortDir;  }
    set;
  }
 
  // the current field to sort by. defaults to last name
  public String sortField {
    get  { if (sortField == null) {sortField = 'lastName'; } return sortField;  }
    set;
  }
 
  // format the soql for display on the visualforce page
  public String debugSoql {
    get { return soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20'; }
    set;
  }
 
  // init the controller and display some sample data when the page loads
  public ContactSearchController() {
    soql = 'select firstname, lastname, account.name  from contact where account.name != null';
    runQuery();
  }
 
  // toggles the sorting of query from asc<-->desc
  public void toggleSort() {
    // simply toggle the direction
    sortDir = sortDir.equals('asc') ? 'desc' : 'asc';
    // run the query again
    runQuery();
  }
 
  // runs the actual query
  public void runQuery() {
 
    try {
      contacts = Database.query(soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20');
    } catch (Exception e) {
      ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Ooops!'));
    }
 
  }
 
  // runs the search with parameters passed via Javascript
  public PageReference runSearch() {
 
    String firstName = Apexpages.currentPage().getParameters().get('firstname');
    String lastName = Apexpages.currentPage().getParameters().get('lastname');
    String accountName = Apexpages.currentPage().getParameters().get('accountName');
     
    soql = 'select firstname, lastname, account.name from contact where account.name != null';
    if (!firstName.equals(''))
      soql += ' and firstname LIKE \''+String.escapeSingleQuotes(firstName)+'%\'';
    if (!lastName.equals(''))
      soql += ' and lastname LIKE \''+String.escapeSingleQuotes(lastName)+'%\'';
    if (!accountName.equals(''))
      soql += ' and account.name LIKE \''+String.escapeSingleQuotes(accountName)+'%\'';  
     
    // run the query again
    runQuery();
 
    return null;
  }

   

}

 

 

 

Thanks in advance:

Hi,

 

I have done visualforce page for satndard quote.I want to prepopulate opportunity name in this visualforce page.

 

Can any one give idea.

 

Thanks in advance

 

 

Hi,

 

I want to reatin all input,picklist and lookup field values in the visulforce page after saving the record.

 

Can any one guide me.

 

Thanks in advance

Hi,

 

in certailn condition i want dispaly an error in visual force page.but it is not happening in my code.

in my visual force page i am inserting records.in one condition i dont want to insert the record just display an error while saving the record.

in my code in that condition it is not inserted record but it is not displaying error message.it is going back to decision object.

 

Please guide me how to display an error in visual froce page.

 

my code is as follows.

 

vf page:

 

<apex:page controller="AddAssignments_controller" sidebar="false">
<script type = "text/javascript">
    function MutExChkList(chk)
    {
        var chkList = chk.parentNode.parentNode.parentNode;
        var chks = chkList.getElementsByTagName("input");
        for(var i=0;i<chks.length;i++)
        {
            if(chks[i] != chk && chk.checked)
            {
                chks[i].checked=false;
            }
        }
    }
</script>
<!--<style>
.employeeError { color: green; font-weight: strong;}
</style>-->
<apex:messages />
<apex:pageBlock >
    <html xmlns="http://www.w3.org/1999/xhtml">
    <apex:form >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
   
    <apex:sectionHeader title="Add Assignments"/>
         
         
        <table width="60%" cellspacing="3" cellpading="2">
       <!-- <tr><td><table width="70%" cellpadding="1" cellspacing="3"> -->
        <tr>
           
            <td align="center"><b>Name</b></td>           
            <td align="center"><b>Accountable</b></td>          
                               
        </tr>    
       
        <tr><td>
        <table width="70%" cellpadding="1" cellspacing="3"> -->
        <tr>      
        <td align="center" width="14%"><apex:inputField value="{!assignment1.NameofUser__c}"/></td>       
        <td align="center" width="14%"><apex:inputField value="{!assignment1.Accountable__c}"  /></td>     
        
        </tr>
        
        <tr>      
        <td align="center" width="14%"><apex:inputField value="{!assignment2.NameofUser__c}"/></td>       
        <td align="center" width="14%"><apex:inputField value="{!assignment2.Accountable__c}" /></td>       
        </tr>
        
        <tr>       
        <td align="center" width="14%"><apex:inputField value="{!assignment3.NameofUser__c}"/></td>       
        <td align="center" width="14%"><apex:inputField value="{!assignment3.Accountable__c}" /></td>       
        </tr>      
               
        </table>          
              
        <apex:commandButton value="Save" action="{!save}"/>
    
    </apex:form>
   </html>
   </apex:pageBlock>  
</apex:page>

 

Apex class:

 

public class AddAssignments_controller  {
    public String getGetraci() {
        return null;
    }
    

integer tttt;
    public AddAssignments_controller(ApexPages.StandardSetController controller) {

    }
    public AddAssignments_controller(ApexPages.StandardController controller) {
    }
     Raci__c r = new Raci__c();
    public Raci__c getraci()    
    {      
    r = [select  Name,decision__c,
    Id from Raci__c
    where Id =:ApexPages.CurrentPage().getParameters().get('id')];              
    return r;
    }
    
   
    Public Id I = ApexPages.CurrentPage().getParameters().get('id');       
    public Raci__c assignment1{ get; set; }
    public Raci__c assignment2{ get; set; }     
             
    public AddAssignments_controller()
    {
        assignment1= new Raci__c();
        assignment2= new Raci__c();          
    }   
     
     public  PageReference save()   {
     
      if((assignment1.NameofUser__c!=null))
      {
          try
          {
          if( assignment1.Decision__r.Number_of_Accountable_Members__c >= 1 )
          {
             ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));
            //assignment1.addError('Failed');            
           //here i need raise an error and should display in visual force page
          }
          else
          {
             assignment1.Decision__c=I;  
             insert assignment1;
          }
          }
           catch(DmlException ex){
            ApexPages.addMessages(ex);        
           
          }
      }     
       
       if(assignment2.NameofUser__c!=null)
       {
         assignment2.Decision__c=I;  
         insert assignment2;        
       }    
                 
      
        PageReference customer = new PageReference('https://ap1.salesforce.com/'+ I);
        customer.setRedirect(true);
        return customer ;
   }
    
     
}

 

Thanks in advance

 

Hi All,

 

how to keep query out side of the loop .

 

my code is as below..

 

 public List<Double> getAmount()
    {   
    List<Training_Schedule__c> Training= new List<Training_Schedule__c>();
    List<Revenue_Schedule__c> revenue=new List<Revenue_Schedule__c>();
    revenue=[select id,Date__c from Revenue_Schedule__c where Price_Book_Name__c=:price[0].Id];     
    for(Integer k=0;k<revenue.size();k++)    
    {       
        Training=[select id,Amount__c,Revenue_Date__c from Training_Schedule__c where  Revenue_Schedule__c=:revenue[k].Id ];
        amt=0;    
        for(Integer j=0;j<Training.size();j++)
        {         
         if(Training[j].Amount__c!=null)
          {      
          amt=amt+(Training[j].Amount__c);                                 
          }                      
        }       
       Amount.add(amt);           
    }
    return Amount;            
   }

 

Thanks...

Hi,

 

Actually my requirement is under Price_Book__c related list is Revenue_Schedule__c ,under Revenue_Schedule__c related list  is  training_Schedule__c.

In Price_Book__c one button is there.once i click on that button it will open visualforce page and displays some fields from price_book__c,some fields from Revenue_Schedule__c and some fields from Training_schedule__c.In controller i am rolling up all the training schedule amount to the related revenue schedule and displaying in visual force page.First i got error as Too Many Soql Queries:101. So I kept query out side of the loop.after that amount is not rolling up properly.and again it is dispalying error as Too many script statements:200001.

 

Please any one give me suggestion.

 

My code is as follows:

 

public class MultipelRevenueEditFee
{

    public MultipelRevenueEditFee(ApexPages.StandardController controller) {

    }
   
    List<Double> Amount=new List<Double>();
    List<Double> FTES=new List<Double>();
    Double fte=0;
    Double amt=0;
    List<Price_Book__c> price = new List<Price_Book__c>();  
    public List<Price_Book__c> getprice()
    {
     //Price_Book__c pp=[select id, opportunity_Name__r.id,FTE_Based_Services__c,Related_FTE_Service__c from Price_Book__c where id =:ApexPages.CurrentPage().getParameters().get('id')];  
     price =[Select Name,                                
                 Related_FTE_Service__c,          
                 FTE_Based_Services__c,
                 RecordTypeID from Price_Book__c                
                  where id =: ApexPages.CurrentPage().getParameters().get('id')];      
     return price;
    
    }

   List<Revenue_Schedule__c> rev = new List<Revenue_Schedule__c>();
   public List<Revenue_Schedule__c> getrev()
   {
  
     rev=[Select Price_Book_Name__r.Name,                                
                 Fee_Based_Amount__c,          
                 Name,
                 Date__c,
                 No_of_FTE__c,
                 Additional_Fees__c,Total_Value__c,Date_by_Plan__c,No_of_FTE_Per_Month_by_Plan__c,Gain_Share_Amount_by_Plan__c,
                 Fee_Based_Amount_by_Plan__c,Date_by_Forecast__c,No_of_FTE_Per_Month_by_Forecast__c,Gain_Share_Amount_by_Forecast__c,
                 Fee_Based_Amount_by_Forecast__c,Date_by_A_C_Mgr_Estimate__c,Fee_Based_Amount_by_A_C_Mgr__c,Gain_Share_Amount_by_A_C_Mgr_Estimate__c,
                 No_of_FTE_Per_Month_by_A_C_Mgr__c,Date_by_Actuals__c,Fee_Based_Amount_by_Actuals__c,Gain_Share_Amount_by_Actuals__c,
                 No_of_FTE_Per_Month_by_Actuals__c,Total_Value_by_A_C_Mgr_Estimates__c,Total_Value_by_Plan__c,Total_Value_by_Actuals__c,
                 Price_FTE_in_US__c,Total_Value_by_Forecast__c,Comments__c,No_of_FTE_s_for_Training__c
                 from Revenue_Schedule__c
                 where Price_Book_Name__c =: ApexPages.CurrentPage().getParameters().get('id') order by date__c ];
                 return rev;    
   } 
   
   public List<Double> getAmount()
    {  
    List<Training_Schedule__c> Training= new List<Training_Schedule__c>();
    List<Revenue_Schedule__c> revenue=new List<Revenue_Schedule__c>();
    revenue=[select id,Date__c from Revenue_Schedule__c where Price_Book_Name__c=:price[0].Id];
    set<Id> pbID = new set<Id>();
    List<Revenue_Schedule__c> rsc = [select Id from Revenue_Schedule__c];
    for(Revenue_Schedule__c  p: rsc)  
    {
     pbID.add(p.Id);
    }
    Training = [select id,Amount__c,Revenue_Date__c,Incremental_FTEs__c,No_of_FTE_for_Training__c from Training_Schedule__c where  Revenue_Schedule__c IN: pbID];
    
    for(Integer k=0;k<revenue.size();k++)   
    {
        //Training=[select id,Amount__c,Revenue_Date__c from Training_Schedule__c where  Revenue_Schedule__c=:revenue[k].Id ];
        amt=0;   
        for(Integer j=0;j<Training.size();j++)
        {        
         if(Training[j].Amount__c!=null)
          {     
          amt=amt+(Training[j].Amount__c);                       
          }             
        }
         Amount.add(amt);          
    }
   
    return Amount;       
    }
    
       
       
    Public Id op;   
    Public PageReference return1()
    { 
        Price_Book__c p=[select id, opportunity_Name__r.id from Price_Book__c where id =:ApexPages.CurrentPage().getParameters().get('id')];
        op=p.opportunity_Name__r.id;
        PageReference Opp1 = new PageReference('https://cs1.salesforce.com/'+ op);
        Opp1.setRedirect(true);
        UPDATE rev; 
        UPDATE price;   
        return Opp1;  
    }
   
    Public Id I = ApexPages.CurrentPage().getParameters().get('id');   
    public PageReference save()    
    {  
        PageReference opp = new PageReference('https://cs1.salesforce.com/'+ I);
        Opp.setRedirect(true);       
        UPDATE rev; 
        UPDATE price;   
        return Opp;     
    }
   
 }

 

Thanks in advance..

 

I have two custom objects with a parent/child relationship.  Using the standard SF pages, if I click on the "New [Child Object]" button in the related list section of the Parent record the new child record page comes up with the reference field to the parent pre-filled with the parent's name.

 

If, however, I override the "New [Child Object]" button to point to my VisualForce page for the child the Parent's reference field is not pre-filled with the parent's name.  I don't want to force my users to manually enter the parent's name as that's not consistent with standard SF pages plus it's a pain.

 

Is there a way to pre-fill fields on a VisualForce page in this scenario?