• xpat
  • NEWBIE
  • 25 Points
  • Member since 2005

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

Hello,

 

I have a custom field in Account and I have a custom object (account master relationship) with 2 fields - Signature_bonus__c and Cases_completion__c

 

these 2 fields are formula fields. I want to put the value of this 2 fields in 2 other fields when the values change. So i created 2 fields update and 2 rules.

It seems it does not work I assume it's because these fields are formula fields.

 

So I tried to do ischanged(my account field) as the formula of the 2 fields are based on the account field but I have an error message "

Error: The ISCHANGED function cannot reference the Account__r.Previous_CP_category__c field.
So is it a way to do it?
I don't know if I am clear :(
Thanks for your help
Patricia
  • January 12, 2010
  • Like
  • 0

Hello,

 

I have a custom objet with no more than 1 record per year per account. but I can have account with no record for the previous year.

 

For 1 specific field I want to get the value and set this value in the field for this year record.

 

If I have a 2009 record all work fine but if I don't have I get an error. I assume because I don't have result for req2.

I am not a expert and did not find how to set 0.0 as value to req2 if I have no result

Thanks for your help

Pat

Double req2 = [select Aesthetic_patients_treated__c from Yearly_Account_Plan__c where start_date__c = last_year and Account__c = :System.currentPageReference().getParameters().get('id')].Aesthetic_patients_treated__c; Yearly_account_plan__c Req; Public Yearly_account_plan__c getReq(){ for (Yearly_account_plan__c rqs : [select id ,year__c, account__c,contact__c,Express_Potential__c, Aesthetic_patients_treated__c, name, CFY_Volume_Plan__c, Open_days__c, Q4_Volume_plan__c, Q3_Volume_plan__c ,Q2_Volume_plan__c, Q1_Volume_plan__c,Actual_vs_Target_CFY__c, Actual_vs_Target_CQTR__c,Actual_vs_Target_PQTR__c, Maxi_Anterior_Cost__c,Maxi_Full_Cost__c,Maxi_Teen_Cost__c,Mini_Anterior_Cost__c, Mini_Full_Cost__c, Mini_Teen_Cost__c,Q1_Objective_Actions__c,Q2_Objective_Actions__c,Q3_Objective_Actions__c, Q4_Objective_Actions__c,Teen_Target_CFY__c, Express_Target_CFY__c, Anterior_Target_CFY__c, Full_Target_CFY__c from Yearly_Account_Plan__c where start_date__c = this_year and Account__c = :System.currentPageReference().getParameters().get('id')]){ req = rqs; return req; } if (req == null) Req = new yearly_account_plan__c(); req.Account__c = System.currentPageReference().getParameters().get('id'); req.contact__c = con.id; req.start_date__c = d; req.Aesthetic_patients_treated__c = req2; return req; }

 

  • January 08, 2010
  • Like
  • 0

Hello and Happy new year

 

I have an issue with rendered when the query in the controller return null, the record does not exist.

 

Below the code in the controller;

 

 

/*load data from Previous year account plan*/ Public Yearly_account_plan__c getR2009(){ for (Yearly_account_plan__c rqs1 : [select id ,year__c, account__c,contact__c, Aesthetic_patients_treated__c, name, Open_days__c, Q4_Volume_plan__c, Q3_Volume_plan__c ,Q2_Volume_plan__c, Q1_Volume_plan__c from Yearly_Account_Plan__c where start_date__c = last_year and Account__c = :System.currentPageReference().getParameters().get('id')]){ return rqs1; } return null; }

 

 

when I have a 2009 account plan all is fine but when I don't have a previous year account plan the first rendered in my page is not ok. I tried is null but same issue.

 

If you could help me with this, it will be fine

 

Thanks

 

Pat

 

Below the code of my page

 

<apex:pageBlockSectionItem > <apex:outputLabel value="Aesthetic patients treated" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c == 0}"/> <apex:outputfield value="{!req.Aesthetic_patients_treated__c}" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c == 0}"/> </apex:pageblocksectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Aesthetic patients treated" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c <> 0}"/> <apex:outputfield value="{!R2009.Aesthetic_patients_treated__c}" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c <> 0}"/> </apex:pageblocksectionItem>

 

  • January 02, 2010
  • Like
  • 0

Hello,

 

I want to count the event with startdatetime in Q1 , Q2, Q3 and Q4 of the current year.

 

If I write

 

 Public Integer geteventQ1Count(){
                return [Select Count() from event
                where AccountId= :System.currentPageReference().getParameters().get('id')and RecordType.Name like '%visit%' and Month(StartDateTime) < 3 AND StartDateTime = this_year ];
        }
Error: Compile Error: unexpected token: '(' at line 246 column 133 

 

If I put the following it works but I will need to chage the year every year and I don't want it.

 

Public Integer geteventQ1Count(){

                return [Select Count() from event 

                where AccountId= :System.currentPageReference().getParameters().get('id')and RecordType.Name like '%visit%' and StartDateTime >= 2009-01-01T00:00:00Z AND StartDateTime <= 2009-03-31T00:00:00Z ];

        }

Do you have some ideas on how to write it?

 

Thanks

 

Pat

  • December 03, 2009
  • Like
  • 0
Hi,
 
Can we create this in apex page?
 

 

Tasks

 

Status

 

Current year

Task 1

planned

J

F

M

A

M

J

J

A

S

O

N

D

Task 2

Failed

J

F

M

A

M

J

J

A

S

O

N

D

I tried the code below but doesn't give me what I want.

Do you have any idea on how I can achieve this?

Thanks

Pat

Code:
<apex:pageBlock title="Practice Management">
<table class ="list" border ="0" cellspacing = "0"  cellpading="0">
<tr class="hearderRow"><th scope="col" class="">Tasks</th><th scope="col" class="">Status</th><th scope="col" class="">This year</th><th scope="col" class="">Next year</th></tr>
  <tr><td scope="col">{!pr.Task_1__c}</td><td scope="col" class="">{!pr.Status__c}</td><td scope="col" class="">{!pr.month__c}</td><td scope="col" class="">{!pr.Month__c}</td><td scope="col" class="">{!pr.Month__c}</td></tr>
 <tr><td scope="col">{!pr.Task_2__c}</td><td scope="col" class="">{!pr.Status__c}</td><td scope="col" class="">{!pr.Month__c}</td></tr>

 </table>
  
   </apex:pageblock>


 

  • December 27, 2008
  • Like
  • 0
Code:
public PageReference getRedir() { 
PageReference newPage;
Account account = [Select id, Parentid, Last_Name__c, first_name__c, address_country__c, ownership__c From account Where Id = :ApexPages.currentPage().getParameters().get('id')]; 
if (account.Parentid == null && account.ownership__c == 'JDE' && (account.address_country__c == 'de' ||account.address_country__c == 'fr' || account.address_country__c == 'at'|| account.address_country__c == 'ch' || account.address_country__c == 'li' || account.address_country__c == 'gb' || account.address_country__c == 'gb1' || account.address_country__c == 'ie' || account.address_country__c == 'it'|| account.address_country__c == 'es' || account.address_country__c == 'es1') ) { 
return null;
 } else { 
 newPage = new PageReference('/' + account.id);     
        return newPage.setRedirect(true);            
 }
 }

Hello,

I did test for my controller extension but can't test this part ans of course I don't have my 75 %.

I get an error for the red line

20081222094201.935:Class.yearlyaccountplanController.getRedir: line 9, column 19: SOQL query with 0 rows finished in 4 ms
System.QueryException: List has no rows for assignment to SObject

I thought : "testaccount = [Select id, Parentid, Last_Name__c, first_name__c, address_country__c, ownership__c From account Where name ='XYZ Organization'];   " will solve this issue but not.

Can You help me?

below my test

Code:
static testMethod void Testyearlyex() {           
        date d = date.today();        
        Account testAccount = new Account (name='XYZ Organization',address_country__c='FR',Ownership__c ='JDE',parentid=null);
        insert testAccount;
           ACCOUNT[] getAccountid = [SELECT Id FROM Account WHERE name = 'XYZ Organization'];
    ApexPages.StandardController ac1 = new ApexPages.StandardController(testAccount);
       yearlyaccountplanController yp = new yearlyaccountplanController(ac1);
        testaccount = [Select id, Parentid, Last_Name__c, first_name__c, address_country__c, ownership__c From account Where name ='XYZ Organization'];      
     
       Contact testContact = new Contact (FirstName='Joe',
        LastName='Schmoe',
        AccountId=getAccountId[0].Id);
        insert testContact;
   
        CONTACT[] getContactId = [SELECT Id FROM Contact WHERE AccountId=:getAccountId[0].Id];
       
        Yearly_account_plan__c testplan = new yearly_account_plan__c (name='2008', account__c= getAccountId[0].Id, contact__c = getContactId[0].Id, start_date__c=d);
        insert testplan;
        Yearly_account_plan__c[] getyerId = [SELECT Id FROM yearly_account_plan__c WHERE Account__c=:getAccountId[0].Id];
        
        Practice_management__c testpr = new Practice_management__c (name ='2008',account__c= getAccountId[0].Id);
        insert testpr;
    
        Coupon_requested__c testcp = new Coupon_requested__c (name = 'Case Pack - 80 - FY08',account__c = getAccountId[0].Id,start_date__c=d);
        insert testcp;
  
          yp.getpromo();
          yp.getcon();
          yp.getreq();
          yp.getpr();
       yp.getredir();
      yp.saveall();
       
    }

Thanks

Pat
 


 
  • December 22, 2008
  • Like
  • 0
Hi,
 
I built a formula July 8 2008, when I want to modify it always gives me an error "Compiled formula is too big"
 
so I decide to modify it with:
 
formula__c = 1 
No syntax errors in merge fields or functions. (Compiled size: 1 characters)
 
and when I try to save I get this error message
 
Referring Formula: Compiled formula is too big to execute (6.506 characters). Maximum size is 5.000 characters
 
Is someone has a solution cause I become crazy?
 
Thanks
 
Pat
 
 
  • December 06, 2008
  • Like
  • 0
Hello,
 
I am new in visualforce
 
I have a visualforce page with standardaccount controller, i saw in the documentation that you can access to child data
but i get an error
 
I want to display on one page account fields and custom object fields
 
<apex:page standardController="Account" id="pageaccountdetails">
<apex:sectionHeader title="Yearly Account Plan"/>
<apex:inputField value="{!account.yearlyplans__r.year__c}"/>
 
yearlyplans is the name I gave for the child relationship between account and my custon object

I try with outputfield and outputext but doesn't work

How can I display on one page custom object fields with the standardcontroller?

Thanks for your help

Pat

 


  • November 21, 2008
  • Like
  • 0
Hello,
 
I have a formula
 
case(Case_pack_status2__c ,"Expired", (End_Date__c - Start_Date__c)/30.41 , (today() - Start_Date__c)/30.41)
 
Compiled size: 1.755 characters
 
I modify it replacing  Case_pack_status2__c by Case_pack_status__c both formula fields same size 1633
 
case(Case_pack_status__c ,"Expired", (End_Date__c - Start_Date__c)/30.41 , (today() - Start_Date__c)/30.41)
 
Compiled size: 1.787
 
So normally I should have the same size for both and not 1755 and 1787
 
but the issue is when I want to save it I get an error message
Compiled formula is too big to execute (8.918 characters).
 
So I create a new field with the same formula (copy and paste) and I can save it.
 
My issue is this field is used in Workflow time based and in other formula fields and I just want to modify it.
 
At the end of october I had the same issue with another formula field and some days ago I could modify and save it, quite strange.
 
did you have the same issue? Is it a bug?
 
Thanks for you answer and feedback
 
Pat
 
 


Message Edited by xpat on 12-06-2008 12:08 AM
  • November 21, 2008
  • Like
  • 0

Hello,

 

I have a custom field in Account and I have a custom object (account master relationship) with 2 fields - Signature_bonus__c and Cases_completion__c

 

these 2 fields are formula fields. I want to put the value of this 2 fields in 2 other fields when the values change. So i created 2 fields update and 2 rules.

It seems it does not work I assume it's because these fields are formula fields.

 

So I tried to do ischanged(my account field) as the formula of the 2 fields are based on the account field but I have an error message "

Error: The ISCHANGED function cannot reference the Account__r.Previous_CP_category__c field.
So is it a way to do it?
I don't know if I am clear :(
Thanks for your help
Patricia
  • January 12, 2010
  • Like
  • 0

Hello,

 

I have a custom objet with no more than 1 record per year per account. but I can have account with no record for the previous year.

 

For 1 specific field I want to get the value and set this value in the field for this year record.

 

If I have a 2009 record all work fine but if I don't have I get an error. I assume because I don't have result for req2.

I am not a expert and did not find how to set 0.0 as value to req2 if I have no result

Thanks for your help

Pat

Double req2 = [select Aesthetic_patients_treated__c from Yearly_Account_Plan__c where start_date__c = last_year and Account__c = :System.currentPageReference().getParameters().get('id')].Aesthetic_patients_treated__c; Yearly_account_plan__c Req; Public Yearly_account_plan__c getReq(){ for (Yearly_account_plan__c rqs : [select id ,year__c, account__c,contact__c,Express_Potential__c, Aesthetic_patients_treated__c, name, CFY_Volume_Plan__c, Open_days__c, Q4_Volume_plan__c, Q3_Volume_plan__c ,Q2_Volume_plan__c, Q1_Volume_plan__c,Actual_vs_Target_CFY__c, Actual_vs_Target_CQTR__c,Actual_vs_Target_PQTR__c, Maxi_Anterior_Cost__c,Maxi_Full_Cost__c,Maxi_Teen_Cost__c,Mini_Anterior_Cost__c, Mini_Full_Cost__c, Mini_Teen_Cost__c,Q1_Objective_Actions__c,Q2_Objective_Actions__c,Q3_Objective_Actions__c, Q4_Objective_Actions__c,Teen_Target_CFY__c, Express_Target_CFY__c, Anterior_Target_CFY__c, Full_Target_CFY__c from Yearly_Account_Plan__c where start_date__c = this_year and Account__c = :System.currentPageReference().getParameters().get('id')]){ req = rqs; return req; } if (req == null) Req = new yearly_account_plan__c(); req.Account__c = System.currentPageReference().getParameters().get('id'); req.contact__c = con.id; req.start_date__c = d; req.Aesthetic_patients_treated__c = req2; return req; }

 

  • January 08, 2010
  • Like
  • 0

Hello and Happy new year

 

I have an issue with rendered when the query in the controller return null, the record does not exist.

 

Below the code in the controller;

 

 

/*load data from Previous year account plan*/ Public Yearly_account_plan__c getR2009(){ for (Yearly_account_plan__c rqs1 : [select id ,year__c, account__c,contact__c, Aesthetic_patients_treated__c, name, Open_days__c, Q4_Volume_plan__c, Q3_Volume_plan__c ,Q2_Volume_plan__c, Q1_Volume_plan__c from Yearly_Account_Plan__c where start_date__c = last_year and Account__c = :System.currentPageReference().getParameters().get('id')]){ return rqs1; } return null; }

 

 

when I have a 2009 account plan all is fine but when I don't have a previous year account plan the first rendered in my page is not ok. I tried is null but same issue.

 

If you could help me with this, it will be fine

 

Thanks

 

Pat

 

Below the code of my page

 

<apex:pageBlockSectionItem > <apex:outputLabel value="Aesthetic patients treated" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c == 0}"/> <apex:outputfield value="{!req.Aesthetic_patients_treated__c}" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c == 0}"/> </apex:pageblocksectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Aesthetic patients treated" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c <> 0}"/> <apex:outputfield value="{!R2009.Aesthetic_patients_treated__c}" rendered="{!CONTAINS('GP',account.type)&& R2009.Aesthetic_patients_treated__c <> 0}"/> </apex:pageblocksectionItem>

 

  • January 02, 2010
  • Like
  • 0

Hello,

 

I want to count the event with startdatetime in Q1 , Q2, Q3 and Q4 of the current year.

 

If I write

 

 Public Integer geteventQ1Count(){
                return [Select Count() from event
                where AccountId= :System.currentPageReference().getParameters().get('id')and RecordType.Name like '%visit%' and Month(StartDateTime) < 3 AND StartDateTime = this_year ];
        }
Error: Compile Error: unexpected token: '(' at line 246 column 133 

 

If I put the following it works but I will need to chage the year every year and I don't want it.

 

Public Integer geteventQ1Count(){

                return [Select Count() from event 

                where AccountId= :System.currentPageReference().getParameters().get('id')and RecordType.Name like '%visit%' and StartDateTime >= 2009-01-01T00:00:00Z AND StartDateTime <= 2009-03-31T00:00:00Z ];

        }

Do you have some ideas on how to write it?

 

Thanks

 

Pat

  • December 03, 2009
  • Like
  • 0

Hi, I need to limit the opportunites view so that users can only see their own opportunities and cannot see the details of other users opps,

 

Can anyone provide me with the best/simplest way of doing this?

 

Regards

Derek

  • November 30, 2009
  • Like
  • 0
Will VF pages work with the offline edition?  Or will it default back to the standard page layouts?
Hi,
 
Can we create this in apex page?
 

 

Tasks

 

Status

 

Current year

Task 1

planned

J

F

M

A

M

J

J

A

S

O

N

D

Task 2

Failed

J

F

M

A

M

J

J

A

S

O

N

D

I tried the code below but doesn't give me what I want.

Do you have any idea on how I can achieve this?

Thanks

Pat

Code:
<apex:pageBlock title="Practice Management">
<table class ="list" border ="0" cellspacing = "0"  cellpading="0">
<tr class="hearderRow"><th scope="col" class="">Tasks</th><th scope="col" class="">Status</th><th scope="col" class="">This year</th><th scope="col" class="">Next year</th></tr>
  <tr><td scope="col">{!pr.Task_1__c}</td><td scope="col" class="">{!pr.Status__c}</td><td scope="col" class="">{!pr.month__c}</td><td scope="col" class="">{!pr.Month__c}</td><td scope="col" class="">{!pr.Month__c}</td></tr>
 <tr><td scope="col">{!pr.Task_2__c}</td><td scope="col" class="">{!pr.Status__c}</td><td scope="col" class="">{!pr.Month__c}</td></tr>

 </table>
  
   </apex:pageblock>


 

  • December 27, 2008
  • Like
  • 0
Code:
public PageReference getRedir() { 
PageReference newPage;
Account account = [Select id, Parentid, Last_Name__c, first_name__c, address_country__c, ownership__c From account Where Id = :ApexPages.currentPage().getParameters().get('id')]; 
if (account.Parentid == null && account.ownership__c == 'JDE' && (account.address_country__c == 'de' ||account.address_country__c == 'fr' || account.address_country__c == 'at'|| account.address_country__c == 'ch' || account.address_country__c == 'li' || account.address_country__c == 'gb' || account.address_country__c == 'gb1' || account.address_country__c == 'ie' || account.address_country__c == 'it'|| account.address_country__c == 'es' || account.address_country__c == 'es1') ) { 
return null;
 } else { 
 newPage = new PageReference('/' + account.id);     
        return newPage.setRedirect(true);            
 }
 }

Hello,

I did test for my controller extension but can't test this part ans of course I don't have my 75 %.

I get an error for the red line

20081222094201.935:Class.yearlyaccountplanController.getRedir: line 9, column 19: SOQL query with 0 rows finished in 4 ms
System.QueryException: List has no rows for assignment to SObject

I thought : "testaccount = [Select id, Parentid, Last_Name__c, first_name__c, address_country__c, ownership__c From account Where name ='XYZ Organization'];   " will solve this issue but not.

Can You help me?

below my test

Code:
static testMethod void Testyearlyex() {           
        date d = date.today();        
        Account testAccount = new Account (name='XYZ Organization',address_country__c='FR',Ownership__c ='JDE',parentid=null);
        insert testAccount;
           ACCOUNT[] getAccountid = [SELECT Id FROM Account WHERE name = 'XYZ Organization'];
    ApexPages.StandardController ac1 = new ApexPages.StandardController(testAccount);
       yearlyaccountplanController yp = new yearlyaccountplanController(ac1);
        testaccount = [Select id, Parentid, Last_Name__c, first_name__c, address_country__c, ownership__c From account Where name ='XYZ Organization'];      
     
       Contact testContact = new Contact (FirstName='Joe',
        LastName='Schmoe',
        AccountId=getAccountId[0].Id);
        insert testContact;
   
        CONTACT[] getContactId = [SELECT Id FROM Contact WHERE AccountId=:getAccountId[0].Id];
       
        Yearly_account_plan__c testplan = new yearly_account_plan__c (name='2008', account__c= getAccountId[0].Id, contact__c = getContactId[0].Id, start_date__c=d);
        insert testplan;
        Yearly_account_plan__c[] getyerId = [SELECT Id FROM yearly_account_plan__c WHERE Account__c=:getAccountId[0].Id];
        
        Practice_management__c testpr = new Practice_management__c (name ='2008',account__c= getAccountId[0].Id);
        insert testpr;
    
        Coupon_requested__c testcp = new Coupon_requested__c (name = 'Case Pack - 80 - FY08',account__c = getAccountId[0].Id,start_date__c=d);
        insert testcp;
  
          yp.getpromo();
          yp.getcon();
          yp.getreq();
          yp.getpr();
       yp.getredir();
      yp.saveall();
       
    }

Thanks

Pat
 


 
  • December 22, 2008
  • Like
  • 0
We created a custom Execute JavaScript button for a custom object in salesforce.  The button was developed using our admin license and everything tested fine.  When we login as a standard user, some of the field updates on the custom object do not occur - no error messages are displayed.  It seems like a sharing problem with the custom object, but the objects involved are set to Public Read/Write.  Any suggestions?
 
Thanks!
  • December 10, 2008
  • Like
  • 0
Hi,
 
I built a formula July 8 2008, when I want to modify it always gives me an error "Compiled formula is too big"
 
so I decide to modify it with:
 
formula__c = 1 
No syntax errors in merge fields or functions. (Compiled size: 1 characters)
 
and when I try to save I get this error message
 
Referring Formula: Compiled formula is too big to execute (6.506 characters). Maximum size is 5.000 characters
 
Is someone has a solution cause I become crazy?
 
Thanks
 
Pat
 
 
  • December 06, 2008
  • Like
  • 0
Hello,
 
I am new in visualforce
 
I have a visualforce page with standardaccount controller, i saw in the documentation that you can access to child data
but i get an error
 
I want to display on one page account fields and custom object fields
 
<apex:page standardController="Account" id="pageaccountdetails">
<apex:sectionHeader title="Yearly Account Plan"/>
<apex:inputField value="{!account.yearlyplans__r.year__c}"/>
 
yearlyplans is the name I gave for the child relationship between account and my custon object

I try with outputfield and outputext but doesn't work

How can I display on one page custom object fields with the standardcontroller?

Thanks for your help

Pat

 


  • November 21, 2008
  • Like
  • 0
Hello,
 
I have a formula
 
case(Case_pack_status2__c ,"Expired", (End_Date__c - Start_Date__c)/30.41 , (today() - Start_Date__c)/30.41)
 
Compiled size: 1.755 characters
 
I modify it replacing  Case_pack_status2__c by Case_pack_status__c both formula fields same size 1633
 
case(Case_pack_status__c ,"Expired", (End_Date__c - Start_Date__c)/30.41 , (today() - Start_Date__c)/30.41)
 
Compiled size: 1.787
 
So normally I should have the same size for both and not 1755 and 1787
 
but the issue is when I want to save it I get an error message
Compiled formula is too big to execute (8.918 characters).
 
So I create a new field with the same formula (copy and paste) and I can save it.
 
My issue is this field is used in Workflow time based and in other formula fields and I just want to modify it.
 
At the end of october I had the same issue with another formula field and some days ago I could modify and save it, quite strange.
 
did you have the same issue? Is it a bug?
 
Thanks for you answer and feedback
 
Pat
 
 


Message Edited by xpat on 12-06-2008 12:08 AM
  • November 21, 2008
  • Like
  • 0