• Rizwi
  • NEWBIE
  • 25 Points
  • Member since 2012

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

hii,

 

 

i have a wrapper class cContact in an controller......  

i hane an another method in another apex class.......can i pass list of objects of this wrapper class in the method of another apex class ....and can i have a return type of this method of List<WrapperClass>

 

 

 

 

apex class

{

List<<Wrapper> method(List<Wrapper> lst)

{

}

}

Hi,

We can hide tabs from users by hiding them from the profile.

But user can go to the tab by entering the tab URL.

Is there a way to avoid this ?

Thanks

  • January 17, 2012
  • Like
  • 0

"if the first name of leads is test then add those leads under Test Campaign as campaign members
 if  the first name of leads is not test then add those leads under Final campaign as campaign members"

 

trigger Campaign on Lead (after insert)
{
    for(Lead l:Trigger.new)
    {
        if(Trigger.isInsert)
        {
            List<Lead> lst=[Select Id,Name,Company,Status from Lead where id=:l.Id];
            Campaign camp=[Select Id,Name from Campaign where Name=:'Test Campaign'];
            
            for(Lead b:lst)
            {
                if(b.Name=='Test')
                {
                b.Campaign=camp.Id;
                }
            }
        }
    }
}

 

i am getting a error"INVALID FIELD CAMPAIGN ON SOBJECT LEAD"

please help me i am new to apex.

  • January 22, 2012
  • Like
  • 0

 

 

 

Hi friend's

,
I have custom field named hello__c  and a dummy controller class named mycontroller1.when the page loads it has hello__c field and a cancel button .All I am trying to do when I click on  cancel button I should be able to show alert to the user  that hello__c field has been left empty.

 

I have created function verify in which I am extracting the value from the hello __c and then I am checking the length of the data in the field .If length is zero then a user should  see an alert box .

 

All the above given things I am trying is not working.Can somebody please help.

 

 

<apex:page controller="mycontroller1">
   
    <apex:form >
    
      <script type ="text/javascript">
  function verify()
  {
  var string;
  string=document.getelementbyid('n').value;
    document.write('the value in the variable s is'+string);
  if(string.length==0)
  {
 
  Alert('U have left field blank');
  return false;
  }
  }
  </script>
     <apex:pageBlock Title="Great">
    <apex:pageBlockButtons >  <apex:commandButton action="{!cancel}" value="Cancel" onclick="return verify()" immediate="true"/></apex:pageBlockButtons>
    <apex:pageblocksection title="Part of greatness">
     <apex:inputField id="N" value="{!account.Hello__c}"/>
 
    </apex:pageblocksection>
    </apex:pageBlock>
    </apex:form>
   </apex:page>

 

 

public with sharing class mycontroller1 {
Account account;
    public PageReference cancel() {
        return null;
    }
    
    public Account getAccount() {
if(account == null) account = new Account();
return account;
}

}

 

 

 

 

  • January 22, 2012
  • Like
  • 0

hii,

 

 

i have a wrapper class cContact in an controller......  

i hane an another method in another apex class.......can i pass list of objects of this wrapper class in the method of another apex class ....and can i have a return type of this method of List<WrapperClass>

 

 

 

 

apex class

{

List<<Wrapper> method(List<Wrapper> lst)

{

}

}

Hi,

We can hide tabs from users by hiding them from the profile.

But user can go to the tab by entering the tab URL.

Is there a way to avoid this ?

Thanks

  • January 17, 2012
  • Like
  • 0

hi ,

 i m creating a daynamic query .its thorughing error

System.QueryException: unexpected token: '.'

 

Query is like this

 

soql = 'p.Name, p.Location__c From Property__c p where Name != null';
        
                string[] locations = t.Location_Tenant__c.split(';',0);
                list<String> loc= new list<String>();
                for(string l :locations){
                    loc.add( '\''+l+'\'');
                }            
                   if (loc != null && loc.size() > 0){                                   
                    soql += ' and Location__c in '+loc ;                
                   }       
             
                pList = Database.query(soql );

  system.debug('--soql---'+soql);

|DEBUG|--soql---Select p.Name, p.Location__c, p.Id From Property__c p where Location__c in ('Art Museum', 'Avenue of the Arts', 'Bella Vista', 'Brewerytown', 'Chestnut Hill', 'Chinatown', 'East Falls', 'East Oak Lane', 'Fairmount', 'Fishtown', ...)


here i m quering for location.its working fine till the last vlaue in location(Fishtown). but after adding one more location it gives me above error.

 

I m asuming that the dot in the query is giving me error, but should not give.

 

How can i resolve this error..?

 

 

Thanks

Shailu

 


  • January 17, 2012
  • Like
  • 0

i made a trigger  after insert and after update on  account object , and in this trigger i want to insert contact into account.

but if any problem occurs in contacts and contact could not be inserted then  i wnat to show error in  corresponding account obj.

 

 

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

for(Accoubnt a:Trigger.new)

{

               contact c=new contact(account.Id=a.Id);

              contactLst.add(c);


}

insert    contactLst;

 

 

 

if i write insert command on contact list then how to idientify that on which account i have to add error....and if i write it into loop  then its wrong approach(dml statement should not be in loops)

 

 

 

 

 

 

 

 

I wrote a trigger to invoke this class, but ths  is populating the same record when ever i am creating the new contact

public class createphantom
{
//contact cnt = new contact();
List<contact> cnt=[select Name,id,ReportsToId, AccountId from Contact limit 10];
phantom__c pnt = new phantom__c();
public void phantom()  //Method to be invoked by the trigger
{
    pnt.Name = 'patient123';
    pnt.External_Key__c = cnt[0].Id;
    pnt.Last_Name__c = cnt[0].Name;
    pnt.Reports_To__c = cnt[0].ReportsToId;
    pnt.Account_Name__c = cnt[0].AccountId;

Insert pnt;

}
}

I have created a VF page that renders a Word doc. It works but is there any way to automatically open up Word. Right now the Word doc is downloading (I have Windows 7, Word 2010), but if somoeone doesn't know it's downloading, they might think nothing is happening. If it could open Word up rather than just save it to the download folder it would be much more obvious to a user.

 

Thanks

 

<apex:page standardController="Investment__c" showheader="false" contentType="application/msWord" cache="true">