• Naveen Rahul 3
  • NEWBIE
  • 159 Points
  • Member since 2014

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 66
    Replies
trigger CopyChildtoParent on class__c (after insert)
{

Child con = [Select Name from class__c where ID=:trigger.id];
Hi all
 a am trying to create a trigger that copy chield obj to parent .  but  i keep getting the following error: compile error :unexpected token: ':' at line no 8
here is my code
// SOQL to get the exact account with matching name as child

 Parent par : [select Id, Roll_No__c from Student__c where Student__c.name in :Trigger.new.Name](here is error)
 par.Roll_No__c = con.Roll_No__c
 update con; 
    
}
Hi,
I amcalling vf page on button click through onclickjavascipt  for this i am using below scipt

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
    {!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} 
    var x;
    if (confirm("If Industry Analysis Records Already Exist Press Cancel If Not Press OK") == true) {
        x = "OK";
    } else {
        x = "Cancel";
    }
    if(x == 'OK'){ 
       window.location='/apex/Industry_Analysis?id={!Activities__c.Id}';
    }

My requirement is whether there is related list record is exist or not ,if not call the vf page . if related records exist there shoud show message like record already exist.

can any one help me out for this,
Regards,
Sarvesh.
 
Hi folks,
          Can anyone tell me how to reload or refresh a whole page after clicking a follow button on Visualforce Page?
My VFP as follows;
<script>
       funtion reload(){
           window.location.reload( true );
       }
   </script>
   
   <apex:repeat value="{!userList}" var="user">
      <apex:outputText value="{!user.Name}" /><chatter:follow entityId="{!user.id}" onComplete="reload();"/>
      
      
   </apex:repeat>

I have to reload the page after clicking either follow or unfollow button.
But the above code doesnt perform very well!

So What Ive to modify in that page?

Thanks in advance
Karthick
I want to delete all the open tasks that are associated with an account when the account owner is changed. I would post the code that i have written, but none of it is useful.

it can either be batch apex or a trigger.

Thanks.

Kevin
Hi, I developed a workflow rule that also includes an Email Alert.  I know that the workflow rule is triggering because it also does a Field Update that IS functioning as desired.

However the emails aren't firing.  About 6 months ago I had a similiar problem, and SF tech support fixed it for me, it had something to do with some security setting somewhere, but I can't find a record of that at present.

Any advice appreciated!  Cheers.

Hi all,

came up with a doubt,can i combine two different standard objects into single LIST

ie

List<contact> listname =  List<contact>;
List<campaignmember> listname =  List<campaignmember>;

i need to combine above two List into single one may be like (contact.campaignmember.date,contact.campaignmember.name)

i wrote a wrapper where i have access to those two list of data.now just need to combine  and return them as list ,is that possible ??.

please post possible ideas to do that.

 

Thanks
D Naveen Rahul.

Hi,

i am trying to print the campaign member list in my vf page but it's giving me an error
Can anyone please help me?
below is my code..
<apex:page StandardController="Campaign"  extensions="CampaignMemController">
    <apex:form >
        <apex:pageBlock title="Campaign Members Details" mode="maindetail">
            <apex:pageBlockSection title="Campaign Members"  id="cm3">
                <apex:pageblocktable value="{!cm}" var="lead">
                        <apex:column headerValue="Name">
                            <apex:outputfield value="{!lead.Id}" />
                        </apex:column>
    
   </apex:pageblocktable>
                      </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
 
 
public with sharing class CampaignMemController {

    public Campaign camp {get; set; }
    list<contact> con = [SELECT id FROM contact];
    
    list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
    list<contact> conlist = new list<contact>();
     public CampaignMemController(ApexPages.StandardController controller) {
         camp  = (Campaign)controller.getRecord();
  
  
    for(campaignmember cm : cmlist)
{
     for(contact c : con)
    {
             if(c.id == cm.contactid)
                              conlist.add(c);
     }
    
//System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
        }  
    } 

}

Hi everyone,

I'm trying to put a charset in my Visualforce Page, but that doesn't work.

I tried this >>> <apex:page showHeader="false" contentType="text/html; charset=UTF-8">

and this >>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

Sorry my bad english!

Hi All,
I have a ‘Status’ field in Accounts with values below
1. Inactive
2. Active
3. New
4. Reactivated
Can we automate the following:
a. Change the status of an Account with ‘Active’ status to ‘Inactive’ if they haven’t had an opportunity closed won in the last 12 months
b. Change the status of an Account with ‘Inactive’ status to ‘Reactivated’ as soon as the Account has a Closed Won opportunity

Thanks.

Regards,
Samuel
Hello,

Consider a class A with function A, The function is global & static (for remote invocation) & another class B with function B which is also global & static. I need to invoke the function A from within function B. How do I do it??
Hi,

I need to add a rotating banner to a visualforce page to display images for our community. Is this possible and if so how? I am new to this so any help would be appreciated!
trigger CopyChildtoParent on class__c (after insert)
{

Child con = [Select Name from class__c where ID=:trigger.id];
Hi all
 a am trying to create a trigger that copy chield obj to parent .  but  i keep getting the following error: compile error :unexpected token: ':' at line no 8
here is my code
// SOQL to get the exact account with matching name as child

 Parent par : [select Id, Roll_No__c from Student__c where Student__c.name in :Trigger.new.Name](here is error)
 par.Roll_No__c = con.Roll_No__c
 update con; 
    
}
Hi,
I am new to Apex..I am trying to write the below controller code but i am getting an error that..expecting right curly bracket, found 'for' 

Can anyone please help?

public with sharing class CampaignMemController {

    public Campaign camp {get; set; }
    list<contact> con = new list<contact>();
    public CampaignMemController(ApexPages.StandardController controller) {
     camp = (Campaign)controller.getRecord();
    }
    for(contact con:[select name,id,(select id from CampaignMembers) from contact]){
     List<CampaignMember > camList = New List<CampaignMember>();
     for(CampaignMember camp: con.CampaignMembers){
     camList.add(camp);
}
System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
}
}
Hi,

I am Generating PDF with repeated header and footer.

<apex:page standardController="contact" ShowHeader="false" extensions="InvestorAttachmentCtrl"  standardStylesheets="false"  renderAs="pdf" applyHtmlTag="false">
    <head>
    <style>
        @page {

        @top-center {
            content: element(header);
        }

        @bottom-left{
            content: element(footer);
        }
        }

        div.header {
        position: running(header);
        }

        div.footer {
        position: running(footer);
        }

    </style>
    </head>
     <div class="header" >  
        <table width="700" cellspacing="0" cellpadding="5" border="0"  height="85">
            <tbody>
                <tr>
                  <td rowspan="2"><span style="padding-left: 5px"><apex:image url="{!$Resource.Logo}" width="100" height="50" style="margin: 0px 10px 0px 0px; width: 171px; height: 55px; border-color: #000000;"/></span></td>
                  <td><img src="images/line.gif" width="2" height="50"/></td>
                   <td style="padding-left: 15px" rowspan="2"><span style="font-family:'StoneSansStd-Semibold';  font-size:40px; color:#6D6E71"><b> LIST</b> 
                    
                     </span></td>
                </tr>
           </tbody>
        </table>                               
        <hr/>
    </div>
    <hr style="border-bottom: dotted 1px #000" />
    <span style="font-family:'StoneSansStd-Semibold'; color:#6D6E71"><b>ADVISOR: {!contact.Name} </b></span><br/>
    <span style="font-family:'StoneSansStd-Semibold'; color:#6D6E71"> SALES AGENT {!coninvList[0].internal_sales_agent__r.firstName} {!coninvList[0].internal_sales_agent__r.LastName} </span><br/><br/>
    <table border="0" align="justify">
        <hr/>
            <tr>
                <th style="font-family:'StoneSansStd-Semibold'; color:#6D6E71"> LAST NAME</th>
                <th style="font-family:'StoneSansStd-Semibold';text-align: center; color:#6D6E71"> STATE </th>
                <th style="padding-left:81px !important;font-family:'StoneSansStd-Semibold'; color:#6D6E71">AMOUNT INVESTED</th>
            </tr>
            <hr/>
            <apex:repeat var="coninv" value="{!coninvList}">
                <tr>
                    <td style="font-family:'StoneSansStd-Semibold'; color:#6D6E71">{!coninv.Last_Name__c}</td>
                    <td style="font-family:'StoneSansStd-Semibold';text-align: center;color:#6D6E71">{!coninv.State__c}</td>    
                    <td style="padding-left:81px !important;font-family:'StoneSansStd-Semibold';color:#6D6E71">$ &nbsp;&nbsp;{!coninv.Amount__c}</td>
                </tr>
                     </apex:repeat> 
                  </table>
<div class="footer"> 
        <hr/>
        <table>
            <tr>
               <td style="padding-left: 5px"><apex:image url="{!$Resource.Logo}" width="39" height="35" style="margin: 0px "/></td>
               <td style="padding-left: 15px ;font-family:'StoneSansStd-Semibold'; color:#6D6E71; font-size:9px;"><strong><b>xxxxxxxxxxxxxxxxxxx </b> |
                <br/></strong> xxxxxxxxxxxxxxxx  |  xxxxxxxxxxxxxxxxxx |
               
                 </td>
            
            
           
            </tr>
        </table>
    </div>
</apex:page>
Hi All,

I'm creating a custom link on Task object which has content source as URL..and I'm including it in Task Page Layout..User should be taken to a VF page related to the custom object which is in WhatId

and I'm giving the following URL

https://cs3.salesforce.com/apex/CEEReconciliationPage_new?id={!Task.What_Id__c}

Where CEEReconciliationPage_new is my VF Page name... which should take the whatId from Task, which is my custom Object Id..

It is giving me "Id is not valid for custom_Object__c standard controller...

Can some one help me what is going wrong here ?
Here is mu code

<apex:page controller="testWrapper">
  <!-- Using wrapper class -->
 <apex:form>
   <apex:pageBlockSection>
     <apex:pageBlockTable value="{!books}" var="b">
         <apex:column width = "25px">
                <apex:inputCheckbox value="{!b.checked}" />
            </apex:column>
         <apex:column value="{!b.b1.Name}"/>
        
         <apex:column value="{!b.b1.Price__c}"/>
     </apex:pageBlockTable>
   </apex:pageBlockSection> 
 </apex:form>
 </apex:page>
---------------------------------------------------class--------------------------------------------------
public class testWrapper
{
  public List<Wrapper> books{get; set;}
  public testWrapper()
  {
 
     books = new List<Wrapper>();
     for(Book__c b1 : [select name,Price__c from Book__c])
     {

         books.add(new wrapper(b1));
        
      }
   }  
   public class Wrapper
   {
        public boolean checked {get; set;}
        public Book__c bl {get; set;}
        public Wrapper(Book__c bl)
        {
            this.bl = bl;
            this.checked = false;
        }
    }
 

}
Hi,
I amcalling vf page on button click through onclickjavascipt  for this i am using below scipt

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
    {!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} 
    var x;
    if (confirm("If Industry Analysis Records Already Exist Press Cancel If Not Press OK") == true) {
        x = "OK";
    } else {
        x = "Cancel";
    }
    if(x == 'OK'){ 
       window.location='/apex/Industry_Analysis?id={!Activities__c.Id}';
    }

My requirement is whether there is related list record is exist or not ,if not call the vf page . if related records exist there shoud show message like record already exist.

can any one help me out for this,
Regards,
Sarvesh.
 
Hi folks,
         Can anyone tell me how to call the java script function when the visualforce page is loaded ?
I need a sample code for that?

Thanks in advance
Karthick
Hi,
I'm new to trigger concepts.My requirement is if any CampaignMember is created for particular two Campaign records,task is created to that contacts.For me, task is not created in this trigger.Please point me out where I did mistake.

Trigger:

trigger add_task on CampaignMember (before Insert) 
{
    List<Campaign> c = [select Id,Name from Campaign where Id = :Trigger.new[0].CampaignId]; 
    List<Campaign> lstc = new List<Campaign>();
    
    for(Campaign cpn : c)
    {
    if(cpn.Name == 'First Mail' || cpn.Name == 'Second Mail' )
       
        lstc.add(cpn);
    }
  
    List<CampaignMember> lstcm = [Select id,CampaignId,ContactId,Status from CampaignMember where CampaignId =: lstc];
    List<Id> Contact_Lead_Ids= new List<Id>();
    for(CampaignMember cm : lstcm)  
    
        Contact_Lead_Ids.add(cm.ContactId);
        System.Debug('ContactId=='+Contact_Lead_Ids);     

    List<Contact> contacts=[Select Id from Contact where Id in :Contact_Lead_Ids];  
    List<Contact> cidcon = new List<Contact>();
    for(Contact ct : contacts)       
       cidcon.add(ct);
       
    List<CampaignMember> lstmember = [Select id,CampaignId,ContactId,Status from CampaignMember where ContactId =: cidcon];
    
    for(CampaignMember cm2 : lstmember) 
    {
        if(cm2.ContactId!=NULL & cm2.Status == 'Responded')
        {
           
            Task myTask=new Task(Whoid=cm2.ContactId,Subject='Testing Task Created');
            Insert myTask;
            System.Debug('Task inserted to=='+myTask);
        }
    
    }
    
   

}

Thank You
Hi There, 

I have a lead provider who wants to post data to me on leads via HTTP Post, however, I don't know the easiest way of doing this. I'm not a develper myself and don't know the easiest way of doing this.  I do have all the posting variables from the lead provider and have those fields created in my salesforce account, however, I don't know the easiest way of creating the posting url to provide him and test delivery. Any help will be much appreciated.