• bensondaniel
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 15
    Replies

Hi there, 

 

I have a scenario in my org to Override the standard New Account creation page with a custom VF Page for certain record types. 

The VF Page should only appear for a set of record types and should not appear for the rest. For the rest of the record types the standard New Account page should appear. 

 

Please could you advise me on the design strategy I should go about in doing this? 

 

At the moment I am overriding the standard 'New' button in Account 

 

using the following VF Page

 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

VF Code

<apex:pagetitle="New Account"standardController="Account"tabStyle="Account"extensions="New_Account_Controller"action="{!pullToPage}">

 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Controller

 

public PageReference pullToPage(){

     PageReference pageRef;

     selectedRecordTypeId = ApexPages.currentPage().getParameters().get('RecordType');

     User currentUser = [SELECT Id, Name, UserRole.Name, Profile.Name FROM User WHERE Id =: UserInfo.getUserId() limit 1];

        

     if(selectedRecordTypeId == null){

          if(currentUser.Profile.Name.contains('GV')) {

                 accountRecTypeName='MY Account RT';

                 selectedRecordTypeId = [SELECT Id, Name FROM RecordType WHERE Name =: accountRecTypeName limit 1].Id;                

          }

     }else{

            accountRecTypeName = [SELECT Id,Name FROM RecordType WHERE Id =: selectedRecordTypeId limit 1].Name;

     }   

            

        if (accountRecTypeName == 'MY Account RT'){

            pageRef = null;

        }else if(selectedRecordTypeId != null){

            pageRef = new PageReference('/001/e?');

            pageRef.getParameters().put('RecordType', selectedRecordTypeId);

            pageRef.getParameters().put('nooverride', '1');

        }else{

            pageRef = new PageReference('/001/e?');

            pageRef.getParameters().put('nooverride', '1');

        }

        return pageRef;

    }

 

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

This seesms to work fine but given that I am working with a huge user base, this strategy seems to considerably reduce the preformance of other record type users.

Everytime a different recordtype other than MY Account RT is used, salesforce has to execute the above controller and then the user is redirected to the original standard page.

This is time consuming and seems to be an over kill given that we have to just override one record type among many.

 

Please could you suggest an alternative solution to this?

 

Many Thanks in Advance

 

Hi All,

 

Apologies, this is not exactly a Visualforce question, but I dont know where else to put this.

 

I would like to know if there is a way to use Salesforce toolkit from the Home page Component.

 

Description:

 

Setup->Customize->Home->Home Page Component

 

I know that salesforce allows to insert custom HTML into components.

I am trying to run a javascript code which does AJAX (Similar to Javascript in Buttons)

 

e.g. sforce.apex.execute

 

The idea is to access an apex method via javascript from here.

 

Please help!!!

 

Thanks in Advance

Hi guys,

 

I want to check if a given float number e.g (12.30) is a whole number

 

In this case 12.30 is not a whole number but 12.00 is.

 

If it is not a whole number like 12.10 or something like that I want to fire the validation.

 

Please help!

Thanks in advance

Hi there,

 

I have a scenario where I need to redirect the User to a new Opportunity page with certain fields based on other related objects.

I have wizard built on visualforce and a controller. During the user journey I collect information from him and finally I need to redirect him

to a page where he could create a new opportunity quickly. The pre population assures the speed of opportunity creation process. 

 

 

I want to use a simple html form from where I would like to login to salesforce and get the sesiion ID. after this I want to use meta data API to commit meta data to sales force.

 

I just have a plain basic html form with me. Could some one help me with javascript and stuff?

 

Your earliest help is much appreciated.

Cheers

Can anyone help me with Itereating through a multiselect picklist?

I need to make a list of all entries using a for loop.

Can anyone help me with itereating a Picklist (Multi-Select)?

I just want to use a for loop and make a list out of it.

PRIORVALUE(TEXT(Status__c))= 'Withdrawn'

 

 

In the above code Status__c is a picklist.

I want to throw ann error if it change from withdrown to anything else.

This is not working...

 

I use   TEXT(Status__c) to return the srting value for Status__c, but this is not an acceptable parameter for

PRIORVALUE

 

Can somebody pls help me..

I am creating a visualforce page which will display the profile photo of the user in it.

Can someone help me reference it ?

I am creating a visualforce page which will display the profile photo of the user in it.

Can someone help me reference it ?

Please help me with this error.

When I try to load my Visualforce page this comes up...

 

Attempt to de-reference a null object 

 

An unexpected error has occurred. Your development organization has been notified.

 


Apex repeat function here would repeat the days of the week, iterating from Monday to Sunday also displaying the day alongside.

My problem is in the prevWeek.

prevWeek is a button. (supposed to be)

When it is clicked I want the changes in goprev to take place.

I need wcTopBar to display the previous weeks days.

 

Pl take a look at

 <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />  

and let me know what is deficient to do the job.

 

 

<apex:outputPanel id="wcTopBar" layout="block" styleClass="containerAD noscroll" style="height: 37px;">
                                    <div class="overflowContainer">    
                                        <div class="weekLabels">
                                            <apex:repeat value="{!daysOfWeek}" var="d">
                                                <div class="{!d.divClass}">
                                                  ​  <div><span style="{!d.spanStyle}"><apex:outputText value="{!d.dayName}" escape="false" /></span></div>
                                                  ​      </div>
                                            </apex:repeat>

__________________________________________________​_

<div class="prevWeek" id="prevweek">
                                            <a class="small left _background1 _border1 _background1Hover t_btn">
                                                <img src="{!URLFOR($Resource.Library, 'images/prev.png')}" width="13" height="28" />
                                                <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />   
                                              </a>
                                        </div>
__________________________________________________​____________________

 

public class calendarController{

  public List<dayInfo> daysOfWeek {get;set;}

   Date pw;

 public calendarController(){
        daysOfWeek = new List<dayInfo>();
        pw = system.Today().toStartOfWeek();
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
}

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

 

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

Apex repeat function here would repeat the days of the week, iterating from Monday to Sunday also displaying the day alongside.

My problem is in the prevWeek.

prevWeek is a button. (supposed to be)

When it is clicked I want the changes in goprev to take place.

I need wcTopBar to display the previous weeks days.

 

Pl take a look at

 <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />  

and let me know what is deficient to do the job.

 

 

<apex:outputPanel id="wcTopBar" layout="block" styleClass="containerAD noscroll" style="height: 37px;">
                                    <div class="overflowContainer">    
                                        <div class="weekLabels">
                                            <apex:repeat value="{!daysOfWeek}" var="d">
                                                <div class="{!d.divClass}">
                                                    <div><span style="{!d.spanStyle}"><apex:outputText value="{!d.dayName}" escape="false" /></span></div>
                                                        </div>
                                            </apex:repeat>

___________________________________________________

<div class="prevWeek" id="prevweek">
                                            <a class="t_btn _background1Hover _border1 _background1 left small">
                                                <img src="{!URLFOR($Resource.Library, 'images/prev.png')}" width="13" height="28" />
                                                <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />   
                                              </a>
                                        </div>
______________________________________________________________________

 

public class calendarController{

  public List<dayInfo> daysOfWeek {get;set;}

   Date pw;

 public calendarController(){
        daysOfWeek = new List<dayInfo>();
        pw = system.Today().toStartOfWeek();
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
}

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

 

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }
__________________________________________________________

If todays date could be retreived by

System.today();

How to calculate a date of the previous week

with the same day?

or

If today is tuesday and the date is 19th April

How to calculate the date of last Tuesday?

The answer which we are expecting is 12th of April.

 

Can anyone suggest an efficient formula?

 

How do I assign specific events to a custom button in VisualForce.

I have event driven programming expereince, does it work this way?

Like On mouse over, on roll out, etc? Can you please give me a sample code and a link to the

Visual force guide for this?

I am trying to create a new event using the following trigger. My logic seems right. I am pulling data from a custom object into a new calendar event. Can anyone tell me how to create a new calendar event passing the mandatory parameters from a custom object?

Hi All,

 

Apologies, this is not exactly a Visualforce question, but I dont know where else to put this.

 

I would like to know if there is a way to use Salesforce toolkit from the Home page Component.

 

Description:

 

Setup->Customize->Home->Home Page Component

 

I know that salesforce allows to insert custom HTML into components.

I am trying to run a javascript code which does AJAX (Similar to Javascript in Buttons)

 

e.g. sforce.apex.execute

 

The idea is to access an apex method via javascript from here.

 

Please help!!!

 

Thanks in Advance

Hi guys,

 

I want to check if a given float number e.g (12.30) is a whole number

 

In this case 12.30 is not a whole number but 12.00 is.

 

If it is not a whole number like 12.10 or something like that I want to fire the validation.

 

Please help!

Thanks in advance

PRIORVALUE(TEXT(Status__c))= 'Withdrawn'

 

 

In the above code Status__c is a picklist.

I want to throw ann error if it change from withdrown to anything else.

This is not working...

 

I use   TEXT(Status__c) to return the srting value for Status__c, but this is not an acceptable parameter for

PRIORVALUE

 

Can somebody pls help me..

I am creating a visualforce page which will display the profile photo of the user in it.

Can someone help me reference it ?

I am creating a visualforce page which will display the profile photo of the user in it.

Can someone help me reference it ?

Apex repeat function here would repeat the days of the week, iterating from Monday to Sunday also displaying the day alongside.

My problem is in the prevWeek.

prevWeek is a button. (supposed to be)

When it is clicked I want the changes in goprev to take place.

I need wcTopBar to display the previous weeks days.

 

Pl take a look at

 <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />  

and let me know what is deficient to do the job.

 

 

<apex:outputPanel id="wcTopBar" layout="block" styleClass="containerAD noscroll" style="height: 37px;">
                                    <div class="overflowContainer">    
                                        <div class="weekLabels">
                                            <apex:repeat value="{!daysOfWeek}" var="d">
                                                <div class="{!d.divClass}">
                                                  ​  <div><span style="{!d.spanStyle}"><apex:outputText value="{!d.dayName}" escape="false" /></span></div>
                                                  ​      </div>
                                            </apex:repeat>

__________________________________________________​_

<div class="prevWeek" id="prevweek">
                                            <a class="small left _background1 _border1 _background1Hover t_btn">
                                                <img src="{!URLFOR($Resource.Library, 'images/prev.png')}" width="13" height="28" />
                                                <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />   
                                              </a>
                                        </div>
__________________________________________________​____________________

 

public class calendarController{

  public List<dayInfo> daysOfWeek {get;set;}

   Date pw;

 public calendarController(){
        daysOfWeek = new List<dayInfo>();
        pw = system.Today().toStartOfWeek();
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
}

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

 

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

Apex repeat function here would repeat the days of the week, iterating from Monday to Sunday also displaying the day alongside.

My problem is in the prevWeek.

prevWeek is a button. (supposed to be)

When it is clicked I want the changes in goprev to take place.

I need wcTopBar to display the previous weeks days.

 

Pl take a look at

 <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />  

and let me know what is deficient to do the job.

 

 

<apex:outputPanel id="wcTopBar" layout="block" styleClass="containerAD noscroll" style="height: 37px;">
                                    <div class="overflowContainer">    
                                        <div class="weekLabels">
                                            <apex:repeat value="{!daysOfWeek}" var="d">
                                                <div class="{!d.divClass}">
                                                    <div><span style="{!d.spanStyle}"><apex:outputText value="{!d.dayName}" escape="false" /></span></div>
                                                        </div>
                                            </apex:repeat>

___________________________________________________

<div class="prevWeek" id="prevweek">
                                            <a class="t_btn _background1Hover _border1 _background1 left small">
                                                <img src="{!URLFOR($Resource.Library, 'images/prev.png')}" width="13" height="28" />
                                                <apex:actionSupport event="onclick" action="{!goprev}" rerender="wcTopBar" />   
                                              </a>
                                        </div>
______________________________________________________________________

 

public class calendarController{

  public List<dayInfo> daysOfWeek {get;set;}

   Date pw;

 public calendarController(){
        daysOfWeek = new List<dayInfo>();
        pw = system.Today().toStartOfWeek();
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
}

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }

 

public PageReference goprev(){
        pw = system.Today().toStartOfWeek().addDays(-7);
        daysOfWeek = calUtil.buildDaysOfWeek(pw);
        return null;
    }
__________________________________________________________

I am trying to create a new event using the following trigger. My logic seems right. I am pulling data from a custom object into a new calendar event. Can anyone tell me how to create a new calendar event passing the mandatory parameters from a custom object?