• SFDC_Vikash
  • NEWBIE
  • 210 Points
  • Member since 2012

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 32
    Replies

Here is my VF Page and below is my code.

When i try to run this only alert1 & 2 & 3 r getting called but the method in the controller is not getting invoked.

Please help what i m missing.

 

<apex:page controller="RemoteController" id="thePage">
<apex:form id="theForm" >
<apex:pageBlock id="theBlock" >
<apex:pageblockSection columns="1" id="searchSection">
<apex:pageBlockSectionItem id="item" >
<apex:inputText id="searchBox" />
<input type="button" value="Search" onclick="getRemoteAccount()"/>
</apex:pageBlockSectionItem>
</apex:pageblockSection>
</apex:pageBlock>

</apex:form>
<script type="text/javascript">
function getRemoteAccount() {

var accountName = document.getElementById('thePage:theForm:theBlock:searchSection:item:searchBox').value;
alert('1')
Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.RemoteController.getAccount}', accountName,
function(result, event){

var account = result[0];
alert('2')
if(account==null)
alert('3')
alert(account.Name);
if (event.status) {
// document.getElementById('acctId').innerHTML = result.Id
// document.getElementById('acctName').innerHTML = result.Name;
}
else if (event.type === 'exception') {
//document.getElementById(“responseErrors").innerHTML = event.message;
alert(event.message);
}
else {
// document.getElementById(“responseErrors").innerHTML = event.message;
alert(event.message);
}
},
{escape: true}
);
}
</script>

</apex:page>

 

****

 

public class RemoteController {
public RemoteController(){
}

@RemoteAction
public static List<Account> getAccount(String accName) {
System.Debug('Hello');
List<Account> lstAcc = [select id,name from Account where name =:accName];
if(!lstAcc.isEmpty()){
return lstAcc;
}
return new List<Account>();
}
}

 

Thanks

Sai

 

 

 I have a visual force page,

 

I created a serach button in visual force page,the serach button return some records into pageblock table,i want to display CSV link to download the serch results any one can please suggest me on this 

 

it would be great helpfull.

 

Thanks In Adavace

Hi guys,

 

I had a validation rule which throughs error when the previous value in a field  is 2012 and the new value is 2013.

And Stage Name is withdrawn.it work fines with my validation rule. but i want to simplify it .

here is my validation rule:-

 

AND($Profile.Name = "Custom System Admin",
ISPICKVAL(StageName,"Prospecting"),
OR(AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Jan 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"Jan 2013")),
AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Jan 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"sep 2013")),
AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"sep 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"Jan 2013")),
AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Sep 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"sep 2013"))))

 

What i need instead of using  (ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Jan 2012")

like this can i using like this (ISPICKVAL(Contains(PRIORVALUE(DeliveryInstallationStatus__c),"2012"), ISPICKVAL(DeliveryInstallationStatus__c,"2013")) .

 

The Above code has 4 conditions if i use include or contains then it can be of 2 condition.

 

Thanks

Anil.B

 

I need to implement one functionality in opportunity object. Please find below mentioned functionality.

 

Scenario-

 

If "Stage" for opportunity is "propecting" i need to display  "1 Green Flag" ,

If  "Stage" for opportunity is "Closed-Won" I need to display  "2 Red Flags",

if "Stage"  for opportunity is "Closed-Lost"  I need to display "3 yellow Flags"

 

And

 

if  "Stage for ooportunity is " Closed-Won" the Opportunity must be "non-editable".

 

Could anyone please help me how to implement it.

 

Thanks for your all valuable help.

 

Thanks,

JaanVivek

In the VF page, I am trying to display $ and , symbols only if there is a value. If there is no value, I do not want the symbols to show. I have the line as

<td><apex:outputText value="{!ROUND((acc.Box_Charge__c*acc.X12_Mth_Containers__c)/12,2)}"></apex:outputText></td>

 

acc is the account. Only if the value is not null, I need to add the $ and comma symbols. Please help

I have looked at most examples that fall into the Insufficient Privileges category and I have found none that is identical to my situation.

 

What I did is overide the standard contact page (View) with my custom visualforce page.  I can allow who see's this page and this is not my problem.

 

Is their a way that I can load the normal Contact View  to uses who do not have permission ?  Instead I always get the error.

 

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.
  • September 10, 2012
  • Like
  • 0

I have a Pageblock table, which gets values from an apex Class , and Displays in a VisualForce page.
It has a CheckBox, and a Text Box in each row. When the Check Box is checked, the Text Box should be enabled. When the Check Box is unchecked, then the Text Box should be disabled. I cannot add actionSupport in a PageBlockTable.
This is the VisualForce Code :
<apex:pageBlock title="Practices">
<apex:pageBlockTable title="Practices" value="{!pPracticeList}" var="p" headerClass="headerStyle" columnsWidth="3,10,6">
<apex:column headerClass="headerStyle" width="3"><apex:inputCheckbox value="{!p.selected}"/></apex:column>
<apex:column headerValue="Practice Name" headerClass="headerStyle" width="10">
<apex:outputText value="{!p.Practice}" /> </apex:column>
<apex:column headerValue="Percentage" headerClass="headerStyle"><apex:inputText size="6" value="{!p.percentage}" maxlength="6"/> </apex:column>
</apex:pageBlockTable>
<center>
<apex:commandButton value="Save" action="{!save}"/>

And This is the Apex Code of the Class :
public class PracticeDetails {

 


public Decimal practicesum = 0;
public List<Decimal> SelectedPercentageValues { get; set; }
public List<String> SelectedValues { get; set; }
public List<pPractice> pPracticeList{set;get;}
public List<pPractice> pPracticeselectedList {set;get;}
public List<PracticeBreakUp__c> PracticenotselectedList {set;get;}
public List<PracticeBreakUp__c> practicebreakuplist {set;get;}
public List<PracticeBreakUp__c> practicebreakupdatabaselist {set;get;}
public List<String> pageblockvalues {set; get;}
public List<String> commprefvalue {set; get;}
public Id revenueId{set;get;}
public PracticeBreakUp__c practicebreakup = new PracticeBreakUp__c(Name = 'Test');
public String pageURL {get;set;}
public String PracticeName {get;set;}
public String id {get;set;}

public PageReference cancel() {
return null;
}

public void getPracticeValues()
{

revenueId = ApexPages.currentPage().getParameters().get('revenueId');

practicebreakupdatabaselist = [SELECT Bizcon_Percentage__c,BPM_Percentage__c,Clodu_Percentage__c,
Core_Percentage__c,CreatedById,CreatedDate,DW_BI_Percentage__c,
ECM_Percentage__c,FSC_Percentage__c,FY13Q1__c,FY13Q2__c,FY13Q3__c,
FY13Q4__c,FY14Q1__c,FY14Q2__c,FY14Q3__c,FY14Q4__c,FY__c,Id,
IsDeleted,ISQ_Percentage__c,LastModifiedById,LastModifiedDate,
Mobility_Percentage__c,Name,Other_Percentage__c,Practice_Name__c,
RevenueBreakUp__c,SAP_Percentage__c,SystemModstamp FROM PracticeBreakUp__c
where RevenueBreakUp__c = :revenueId];

practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);
if(practicebreakupdatabaselist == null) {}
/* practicebreakupdatabaselist = [SELECT Practice_Name__c FROM PracticeBreakUp__c
where RevenueBreakUp__c = :revenueId];*/
System.debug('***practicebreakupdatabaselist inside getPracticeValues() method' + practicebreakupdatabaselist );
// getPractices();
System.debug('***pPracticeList***' + pPracticeList);
for (PracticeBreakUp__c practicebreakupdatabase :practicebreakupdatabaselist)
{
System.debug('*****practicebreakupdatabase******' + practicebreakupdatabase );

for(pPractice pPracticeentity : pPracticeList)
{
System.debug('*****pPracticeentity****' + pPracticeentity );


if(pPracticeentity.Practice == practicebreakupdatabase.Practice_Name__c)
{
System.debug('*****practicebreakupdatabase.Practice_Name__c*****' + practicebreakupdatabase.Practice_Name__c);

pPracticeentity.selected = true;
if(practicebreakupdatabase.Practice_Name__c == 'BPM') {pPracticeentity.percentage = practicebreakupdatabase.BPM_Percentage__c;BREAK;}
else if(practicebreakupdatabase.Practice_Name__c == 'Core (JAVA/.NET/C++)') {pPracticeentity.percentage = practicebreakupdatabase.Core_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'ECM') {pPracticeentity.percentage = practicebreakupdatabase.ECM_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'DW / BI') {pPracticeentity.percentage = practicebreakupdatabase.DW_BI_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'MOBILITY') {pPracticeentity.percentage = practicebreakupdatabase.Mobility_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'CLOUD') {pPracticeentity.percentage = practicebreakupdatabase.Clodu_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'SAP') {pPracticeentity.percentage = practicebreakupdatabase.SAP_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'FSC') {pPracticeentity.percentage = practicebreakupdatabase.FSC_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'ISQ') {pPracticeentity.percentage = practicebreakupdatabase.ISQ_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'BIZCON') {pPracticeentity.percentage = practicebreakupdatabase.Bizcon_Percentage__c;break;}
else if(practicebreakupdatabase.Practice_Name__c == 'OTHER') {pPracticeentity.percentage = practicebreakupdatabase.Other_Percentage__c;break;}
}
}

}





}



public PracticeDetails(){
revenueId = ApexPages.currentPage().getParameters().get('revenueId');

pPracticeList = new List<pPractice>();

PracticenotselectedList = new List<PracticeBreakUp__c>();
SelectedPercentageValues = new List<Decimal>();
SelectedValues = new List<String>();
pageblockvalues = new List<String>();
Commprefvalue = new List<String>();
Schema.DescribeFieldResult CommprefField = Schema.sObjectType.Opportunity.fields.Practise__c;
Schema.PicklistEntry [] Commpref = CommprefField.getPickListValues();

for(Schema.PicklistEntry val : Commpref)
{
Commprefvalue.add(val.getLabel());

}

// for(){



// }
pPracticeList = new List<pPractice>();
Commprefvalue = new List<String>();

for(Schema.PicklistEntry val : Commpref)
{
//Commprefvalue.add(val.getLabel());

pp = new pPractice();

pp.selected = false;
pp.Practice = val.getLabel();
pPracticeList.add(pp);

}
getPracticeValues();
}




public class pPractice {
public String Practice {set;get;}
public Boolean selected {set;get;}
public Decimal percentage {set;get;}

public pPractice ()
{
}
public pPractice (String P, Decimal per)
{
selected = false;
Practice = p;
percentage = per;
}
}
public void save() {
insertvalues();
}
public pPractice pp = null;
public void deletevalues ()
{
List<practicebreakUp__c> dblist = [Select Id from practiceBreakUp__c where ReveNueBreakUp__c = :revenueId];
delete dblist;
}

public void insertvalues () {
pPracticeselectedList = new List<pPractice>();
for (pPractice prac : pPracticeList)
{
if(prac.selected == true)
{

practicesum = practicesum + prac.percentage;
pPracticeselectedList.add(prac);
}
}
practicebreakuplist = new List<PracticeBreakUp__c>();
System.debug('practicesum***' + practicesum );
if(practicesum > 99.9 && practicesum < 100.01)
{
for (pPractice prac : pPracticeselectedList)
{
if(prac.Practice.equals('BPM')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.BPM_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'BPM';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('Core (JAVA/.NET/C++)')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.Core_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'Core (JAVA/.NET/C++)';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('ECM')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.ECM_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'ECM';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('DW / BI')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.DW_BI_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'DW / BI';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('MOBILITY')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.Mobility_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'MOBILITY';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('CLOUD')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.Clodu_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'CLOUD';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('SAP')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.SAP_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'SAP';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('FSC')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.FSC_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'FSC';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('ISQ')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.ISQ_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'ISQ';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('BIZCON')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.Bizcon_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'BIZCON';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
else if(prac.Practice.equals('OTHER')){practicebreakup = new PracticeBreakUp__c(Name = 'Test',RevenueBreakUp__c = revenueId);practicebreakup.Other_Percentage__c = prac.percentage;practicebreakup.Practice_Name__c = 'OTHER';practicebreakup.RevenueBreakup__c = revenueId;practicebreakuplist.add(practicebreakup);}
}

deletevalues();
upsert practicebreakuplist;
}
else
{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'The Total Percentage should be 100%');
ApexPages.addMessage(myMsg);
}
}
}

 

I have been trying to do this since 1 Week , but Could not Progress on This.
I need any Solution , using JavaScript or the ActionSupport.

Hi,

 

My requirement is that I want a field(column) in pageBlockTable to be calculated dynamically based on 2 other fields.

I have 3 columns - Order quantity, Unit Price & Total Extended Price.

 

 

What I want to do is :

Whenever the value under Order quantity is changed in a row, the corresponding Total Extended Price should be calculated and refreshed (Total Extended Price = Order quantity * Unit Price ).

 

How can I achieve the same in Visualforce ?

 

Thanks in advance.

 

 

 

Regards,

Lakshmi.

  • September 03, 2012
  • Like
  • 0

Hi,

     I Wrote a Test Class for a trigger.Thus Trigger related to some conditions.

This is Trigger:

trigger match_territory on Lead (before insert) {

   
    for(lead l:trigger.new)
    {
    if(l.Site__c=='PressKart')
    {
        if(l.country!=null){
              if(l.country=='AntiguaandBarbuda'){
                    l.country='Antigua and Barbuda';
                    l.Territory__c = 'Americas';                
                }

               if(l.country=='Croatia'){
                    l.Territory__c = 'ROW';
               }

       }

    }

  }

}

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

Test Class:

@isTest
public class test_presskart {
    static testMethod void testpresskart()
     {
        Map<String,String> cuntr1 = new Map<String,String>();                    
             cuntr1.put('ROW','Croatia');
             cuntr1.put('Americas','Antigua and Barbuda' );

List<Lead> leadlist = new List<Lead>();
    for(string s:cuntr1.Keyset())
         {
         for(string s1:cuntr1.Values())
            {
            
                Lead l = new Lead();
                l.site__c = 'presskart';
                l.country = s1 ;
                l.Company = 'Pressmart';
                l.Status = 'Open';
                l.Org_Type__c = 'ePortal';
                l.LastName = 'TestingLead';
                l.Frequency__c = 'Daily';
                l.Phone = '9998877554';
                l.Email = 'test@test.com';
                l.CurrencyIsoCode = 'INR' ;
                l.Territory__c = s;                
                l.Monthly_Rev__c = 50000.0;               
                
              leadlist.add(l);
           }
         }
         if(leadlist.size()>0)
         {
             insert leadlist ;
         }
    }

}

Once Check it Dudes,Am getting only 45%.I Want to improve it.Can anyone suggest me.

 

Hi,

 

I have VF page which has 4 check boxes, i want to pass the selected  checkbox to controller.

How can i do that?

 

Can any body help me on this.

 

Thanks.

 

hi all,

 

 

 

how to set the background color as white in pageblock

i' working on Ron Hess Framework Calendar to adapt it for my needs :

http://boards.developerforce.com/t5/Visualforce-Development/Nested-Lists-of-custom-objects/m-p/69908

 

if you check the class Day, he defined 3 colors for cells : cssclass = active || inactive || today.

i want to add other colors, but i didn't found any css source to update it ?

 

Thanks for your help !

 

Here is my VF Page and below is my code.

When i try to run this only alert1 & 2 & 3 r getting called but the method in the controller is not getting invoked.

Please help what i m missing.

 

<apex:page controller="RemoteController" id="thePage">
<apex:form id="theForm" >
<apex:pageBlock id="theBlock" >
<apex:pageblockSection columns="1" id="searchSection">
<apex:pageBlockSectionItem id="item" >
<apex:inputText id="searchBox" />
<input type="button" value="Search" onclick="getRemoteAccount()"/>
</apex:pageBlockSectionItem>
</apex:pageblockSection>
</apex:pageBlock>

</apex:form>
<script type="text/javascript">
function getRemoteAccount() {

var accountName = document.getElementById('thePage:theForm:theBlock:searchSection:item:searchBox').value;
alert('1')
Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.RemoteController.getAccount}', accountName,
function(result, event){

var account = result[0];
alert('2')
if(account==null)
alert('3')
alert(account.Name);
if (event.status) {
// document.getElementById('acctId').innerHTML = result.Id
// document.getElementById('acctName').innerHTML = result.Name;
}
else if (event.type === 'exception') {
//document.getElementById(“responseErrors").innerHTML = event.message;
alert(event.message);
}
else {
// document.getElementById(“responseErrors").innerHTML = event.message;
alert(event.message);
}
},
{escape: true}
);
}
</script>

</apex:page>

 

****

 

public class RemoteController {
public RemoteController(){
}

@RemoteAction
public static List<Account> getAccount(String accName) {
System.Debug('Hello');
List<Account> lstAcc = [select id,name from Account where name =:accName];
if(!lstAcc.isEmpty()){
return lstAcc;
}
return new List<Account>();
}
}

 

Thanks

Sai

 

 

Hello:

 

I have developed the following Visualforce page but nothing is showing up. I assume its a style issues. Any help is greatly appreciated.

<apex:page standardController="CBW_Rev_Share__c" tabStyle="CBW_Rev_Share__c">
    <apex:form >
        <style>
        .tableStyle {border-collapse: collapse; border-spacing: 0px 0px; }
        .colStyle1 { width: 33.3%;text-align:right; padding-top:3px; padding-bottom:5px}
        .colStyle2 { width: 33.3%; padding-left:20px; padding-top:5px; padding-bottom:5px}
        .colStyle3 { width: 33.4%;text-align:right; padding-top:5px; padding-bottom:5px}
        .rowstyle { border-bottom-style:solid; border-bottom-width:1px;border-bottom-color:#E8E8E8 } 
            <apex:pageBlock >
                <apex:pageBlockSection showHeader="true" title="Details" columns="3" id="details">
                    <apex:panelGrid columns="3" border="0" styleClass="tableStyle" width="100%" columnClasses="colStyle1,colStyle2,colStyle3" rowClasses="rowstyle">
                        <apex:outputLabel value="Tier One" styleClass="labStyle"/>
                        <apex:outputField value="{!CBW_Rev_Share__c.Tier_One__c}" id="TierOne"/>
                        <apex:outputLabel value="Low End Tier One" styleClass="labStyle"/>
                        <apex:outputField value="{!CBW_Rev_Share__c.Low_End_Tier_One__c}" id="LowEndTierOne"/>
                        <apex:outputLabel value="High End Tier One" styleClass="labStyle"/>
                        <apex:outputField value="{!CBW_Rev_Share__c.High_End_Tier_One__c}" id="HighEndTierOne"/>
                    </apex:panelGrid>       
                </apex:pageBlockSection>
            </apex:pageBlock>
        </style>            
    </apex:form>
</apex:page>

 Thanks in advance,

 

Hampton

 I have a visual force page,

 

I created a serach button in visual force page,the serach button return some records into pageblock table,i want to display CSV link to download the serch results any one can please suggest me on this 

 

it would be great helpfull.

 

Thanks In Adavace

Hi Everyone,

 

I have a custom object I created called "Inquery__c" And I have a few users on record,

I'm trying to allow only the users that exist in the "Inquery__c" to upload a file to Documents,

 

Here is the code 

 

 <apex:page controller="newCheck_and_upload"   tabStyle="Opportunity">   

<apex:sectionHeader title="Please Enter user information and upload LogFile"/>  

<apex:messages /> 

<apex:form enctype="multipart/form-data">  

 <apex:pageBlock >   

<apex:facet name="footer">        

<apex:outputPanel >          

<apex:commandButton action="{!save}" value="Check and Uplod"    styleClass="btn"/>  

 </apex:outputPanel>     

  </apex:facet>     

  <apex:pageBlockSection title="User Information">   

<apex:panelGrid columns="2">      

 <apex:outputLabel value="First Name" for="inqueryFirstName"/>     

  <apex:inputField id="inqueryFirstName" value="{!inquery.First_Name__c}"/>    

  <apex:outputLabel value="Last Name" for="inqueryLastName"/>     

  <apex:inputField id="inqueryLastName" value="{!inquery.Last_Name__c}"/>     

  <apex:outputLabel value="Email" for="inqueryEmail"/>   

   <apex:inputField id="inqueryEmail" value="{!inquery.Email__c}"/>  

        <apex:outputLabel value="Institution" for="inqueryInstitution"/>
        <apex:inputField id="inqueryInstitution" value="{!inquery.Institution__c}"/>
        <apex:outputLabel value="Position" for="inqueryPosition"/>
        <apex:inputField id="inqueryPosition" value="{!inquery.Position__c}"/>
        <apex:outputLabel value="Country" for="inqueryCountry"/>
        <apex:inputField id="inqueryCountry" value="{!inquery.Country__c}"/>

  </apex:panelGrid>

   </apex:pageBlockSection>  

  <apex:pageBlockSection title="Upload File">  

  <apex:panelGrid columns="2">   

      <apex:outputLabel for="file"/>   

      <apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>

   </apex:panelGrid>   

</apex:pageBlockSection>   

</apex:pageBlock>

  </apex:form>

</apex:page>

 

And the Class

 

public  with sharing class newCheck_and_upload {

    Inquery__c inquery;    

  public Boolean sFlag=true;        

 

public Inquery__c getInquery() {   

 if(inquery == null) inquery = new Inquery__c();    

 return inquery;    

}        

 

public Document document {    

get {      

if (document == null)        

document = new Document();      

return document;    

}    

set;   

}           

public PageReference save() {        

if(inquery == null) {          

sFlag = false;         

}else {         

sFlag = true;         

}            

if(sFlag){           

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'User Exists'));                 

} else {         

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'User Does not exist'));         

//return null;        

}    

insert inquery;

 

 

document.AuthorId = UserInfo.getUserId();        

document.FolderId = UserInfo.getUserId(); // put it in running user's folder                

try {          

insert document;        

} catch (DMLException e) {          

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));          

return null;        

} finally {          

document.body = null; // clears the viewstate          

document = new Document();        

}        

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));                

return null;     

} }

 

When I enter a user that exists or a user that does not exist (both ways) the file is never uploaded. This means that sFlag is never True.

When i try saving an existing file i get the following error:

 System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: Email__c duplicates value on record with id: a08K0000001XxV5: []

Error is in expression '{!save}' in component <apex:page> in page exist_upload
 
This means that the "inquery == null" stament is not working,
And it return null,
But when it tries to save the account,
it tells me that the account is a duplicate!!
 

Does anyone know why?

 

 

Thanks

Hi guys,

 

I had a validation rule which throughs error when the previous value in a field  is 2012 and the new value is 2013.

And Stage Name is withdrawn.it work fines with my validation rule. but i want to simplify it .

here is my validation rule:-

 

AND($Profile.Name = "Custom System Admin",
ISPICKVAL(StageName,"Prospecting"),
OR(AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Jan 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"Jan 2013")),
AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Jan 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"sep 2013")),
AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"sep 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"Jan 2013")),
AND(ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Sep 2012"), ISPICKVAL(DeliveryInstallationStatus__c,"sep 2013"))))

 

What i need instead of using  (ISPICKVAL(PRIORVALUE(DeliveryInstallationStatus__c),"Jan 2012")

like this can i using like this (ISPICKVAL(Contains(PRIORVALUE(DeliveryInstallationStatus__c),"2012"), ISPICKVAL(DeliveryInstallationStatus__c,"2013")) .

 

The Above code has 4 conditions if i use include or contains then it can be of 2 condition.

 

Thanks

Anil.B

 

Hi

 

I am using a formula-

if( checkbox__c =true, DateTime__c- CreatedDate , now()-CreatedDate )

 

When I click ''Check Syntax' button then there is no error andCompiled sise is 207 characters, but when I tried to save it, this is showing error "Formula(s) that reference this field are no longer valid: Compiled formula is too big to execute (16.122 characters). Maximum size is 5.000 characters".

This is very basic and small formula, I wonder why this is showing error.

 

 

Hello,


I am creating a multiple file upload, one of the thing that is failing for me is "Calling controller method from javascript, Golbal Remote call for is not working"

So I created a simple example to test and that not working either, Here is my Controller class and page, Its not showing me a alert on page load.  What am I doing wront here ?

Class
===========

global with sharing class myControllerTest {
    
    @RemoteAction
    global static String getID(String parentId){
        return parentId;
    }
}




Page
============

<apex:page >
<head>
   <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"/>
   <script type="text/javascript">
     j$=jQuery.noConflict();
     
     myControllerTest.getID('Hello Salesforce', function(result,event){
        if(event.status == true){
            alert(result);
        }else{
            alert(event.message);
        }
    }, {escape: false});
   </script>
</head>   
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  <!-- End Default Content REMOVE THIS -->
</apex:page>

Hai All,

 

I have one requirement, can we the get the Task list in Visualforce page?????

 

I have tried a lot but i couldnt find out the solution.

Here is the code. Im getting error as List Controllers are supported for Task

public with sharing class TaskPagination {
private final Task t;

public TaskPagination(ApexPages.StandardSetController controller) {
this.c = (Task)controller.getRecord();
}
public ApexPages.StandardSetController TaskRecords{
get {
if(TaskRecords == null) {
return new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT t.ActivityDate, t.Status FROM Task t]));
}
return TaskRecords;
}
private set;
}
public List<Task> getTaskPagination() {
return (List<Task>) TaskRecords.getRecords();
}
}

 Thanks in Advance..........

 

  • September 17, 2012
  • Like
  • 0

I need to implement one functionality in opportunity object. Please find below mentioned functionality.

 

Scenario-

 

If "Stage" for opportunity is "propecting" i need to display  "1 Green Flag" ,

If  "Stage" for opportunity is "Closed-Won" I need to display  "2 Red Flags",

if "Stage"  for opportunity is "Closed-Lost"  I need to display "3 yellow Flags"

 

And

 

if  "Stage for ooportunity is " Closed-Won" the Opportunity must be "non-editable".

 

Could anyone please help me how to implement it.

 

Thanks for your all valuable help.

 

Thanks,

JaanVivek

A  VF page using jquery tabs and a left horizontal navigation menu. when click on a  item description of a record should show on tab1 , tab2 displays associated accounts  uisng page block table, tab3 contacts. tabs should rerender up on naviagtion tab1 is getting refresh while tab2 and tab3 are not getting rerendered.

  • September 13, 2012
  • Like
  • 0

Hi There,

 

I have a visual force page which display multiple records with check box's.

I  need to allow the user to select only one check box at a time.If they are trying to select a another check box should display a alert saying that u r allowed to check only one record at a time.

 

I know it is possible with only javascript, can any  one post sample code for this .

 

or if any other suggestions please let me know .

 

Thank you,

Hi Guys,

 

I have requirement like out client has a website, where on one of the page we have links with country names when we click on those links we have to display some information related to that country.

How can we catch that ID from the external website..

 

Any body have idea..... It is very urgent Please....

 

 

Thanks,

Bujji

  • September 10, 2012
  • Like
  • 0

Hi,

 

I created a test class for a custom controller for a VF page off a custom object called Client_Status_Dashboard__c.  As part of my object, I have a trigger called TotalUpdate which updates a number field in the custom object by summing a few other formula fields.  When I run my test class with the trigger de-activated, I get 100% coverage.  However, when I re-activate the trigger, as it is needed for the final product, I get the error below:

 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, TotalUpdate: execution of BeforeInsert caused by: System.NullPointerException: Argument 1 cannot be null External entry point: []

 

 

My Test Class is as follows:

 

@Istest(SeeAllData=true)
public class TestScorecardController {

public static testMethod void testMyController() {    
        
  Account acct= new Account();
  acct.name='test';
  acct.Type='Employer';
  insert acct;
 
  Client_Status_Scorecard__c cssc = new Client_Status_Scorecard__c();
      cssc.Client_Name__c = acct.id;
      cssc.Client_Licenses__c = 'Portal';
      cssc.Satisfaction_Survery_Score__c = 'A Score of 4-5';
      cssc.Projected_Current_Year_Revenue__c = 'Projected Increase';
      cssc.Engagement_Index_Score__c = 'A Score of 60+';
      cssc.Senior_Level_Relationship__c = 'Positive, Influential';
      cssc.Health_Index_Score__c = 'A Score of 60+';
      cssc.Impact_Index_Score__c = 'A Score of 60+';
     
 
  ApexPages.StandardController sc = new ApexPages.standardController(acct);
  ScorecardController scoreCardCont = new ScorecardController(sc);
  scoreCardCont.score.add(cssc);
   scoreCardCont.save();
 
 }
}

 

And my Trigger is as follows:

 

Trigger TotalUpdate on Client_Status_Scorecard__c (before insert,before update) {

    for (Client_Status_Scorecard__c css1 : Trigger.new) {

    IF((css1.Health_Index_Score__c == null ||

          css1.Health_Index_Score__c == 'Value Index Not Yet Complete or Standalone Client') &&
        (css1.Impact_Index_Score__c == null ||

          css1.Impact_Index_Score__c == 'Value Index Not Yet Complete or Standalone Client'))
     {
        css1.Total_Score_Numerator__c = css1.Satisfaction_Revenue__c + css1.Utilization_Engagement_Score__c + 

                  css1.Relationship_Profile_Score__c;
        css1.Total_Score_Denominator__c = 9.0;
      }

 

    ELSE {
   
        css1.Total_Score_Numerator__c = css1.Satisfaction_Revenue__c + css1.Utilization_Engagement_Score__c +

                  css1.Relationship_Profile_Score__c + css1.Behavior_Change_ROI_Score__c;
        css1.Total_Score_Denominator__c = 12.0;
         
        }
    }
}

 

From what I can gather, the eror is being thrown because the fields that are being summed in the trigger are formula fields that do not have values until after the record is saved so they are null.  However, I'm not sure how to fix that.  Can anyone help?  Thanks,

  • September 06, 2012
  • Like
  • 0