• Jeeedeee
  • NEWBIE
  • 193 Points
  • Member since 2007

  • Chatter
    Feed
  • 7
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 41
    Replies

Hello Everyone,

 

When we refresh Sub tab by refreshSubtabById(), it also refreshes custom console component in sidebar which is not desired in my case. Even refreshSubtabById() documentation in "Service Cloud Console Integration Toolkit Developer's Guide" states as below given:

"Note that this method doesn't refresh sidebars or custom console components. For more information, see Custom Console
Components Overview in the Salesforce online help."

 

Any help to prevent custom console component reload on refreshing subtab will be much appreciated.

 

Thanks.

Hi,

 

i am currently trying to get some insight into developing for SalesForce with VisualForce and Apex.

 

I have built a VisualForce calendar which is still very static at the moment.

What i would like to do:

The calendar consists of 8 columns, one of those is a column for custom text, the others are the columns for the days.

Every day now has a static number of rows, which should represent special products.

I want to write a <apex:repeat> for that, so that there is a row for every product.

There is the first problem:  How do i invoke the result of a SOQL Query i wrote in a method of the controller? I created a variable in which the number products are stored.

 

I tried the following (with no success):

 

<apex:repeat value="{!count}" var="anzahl" id="foreachanz">

 

 

In this case, "count" is the name of the variable with the number of products.

The method which counts the entries is the following:

 

  	public Integer Anzahl() {
		Integer anz = [select count() from Leihanlage__c];
		return anz;
	}

 

How do i reference the variable in the apex:repeat?

hi I know this is a foolish question but i am blank with this, How to create a single select picklist in a VF page.WHat is the apex tag we use for that.

I used <apex:selectlist> but its diplaying the list view.I am not getting dropdown for that.

I have developed a VF page and I am using standard styles for the apex form. I customized the page using my css styles

but no matter what I do, I am unable to get rid of the pageblock border (thin black border) that is appearing on the right side

and at the bottom of the page..any help is greately appreciated!!

Hi,
I am developing a simple custom feed action using visual force. It contains a number of fields of the case. Using VF the style of the generated HTML is not inline with the standard feed item. See below a screenshot how it looks like with a configuration based feed item action. 

Standard action style
When using visual force it displays like:

User-added image

Any idea which tags I can apply to get inline with the standard style for case feed? See below visual force code

<apex:page standardController="Case" extensions="CasePushThroughExtension"  doctype="html-5.0">
 <apex:includeScript value="/support/api/26.0/interaction.js"/>
    <div>
        <apex:form >
            <!-- Just a simple pageblock with some fields to update -->
            <apex:actionFunction action="{!saveRecord}" name="updateCase" rerender="out" 
            oncomplete="sforce.interaction.entityFeed.refreshObject('{!case.id}',  false, true, true);"/>   
            <apex:pageBlock >
            <apex:pageBlockSection columns="1">
                <apex:inputField value="{!case.Type}" />
                <apex:inputField value="{!case.Sub_Type__c}"/>
                <apex:inputField value="{!case.Push_Through__c}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>
        </apex:form><br />
        <button type="button" onclick="updateCase()" style="position:fixed; bottom:0px;right:2px; padding: 5px 10px; font-size:13px;" id="cpbutton" >
             Update
        </button>
    </div>              
</apex:page>
Hi,

I am trying find search results based on a custom text field on account, which contains the '-' minus character. The custom field is called Copy_Birthdate__pc and contains value "1982-01-19"

Since there is a minus, I have to escape it with a \ to use it in the Database.search, but I am not getting any values. Anybody has any idea why there are no results? In normal global search I can find the records

[code]
String safeSearchString = '1982\-01\-19';         
String searchQuery = 'FIND {' +safeSearchString +'} IN ALL FIELDS RETURNING Account(id, Name, Copy_BirthDate__pc  ) ,Contact(Id)';
System.debug('The value of searchQuery' +searchQuery);
List<List<SObject>> searchList = Search.query(searchQuery);
List<SObject> accounts =   searchList.get(0);
List<SObject> contacts =   searchList.get(1);
System.debug('Size of accounts: ' +accounts.size());
System.debug('Size of contacts: ' +contacts.size());
[/code]




Hi all,

From the docs in Salesforce I see we can use the OR logic in the SOSL query. I am trying to search for both postal code and a phone number. I would like to get back Accounts, and maybe in the future also accounts... 

I keep getting save/compile errors, tried many ways of querying, but no luck yet... Does anyone have tried this before in apex (custom controller)

[code]
String phoneNr = ApexPages.currentPage().getParameters().get(PARAMETER_KEY_PHONE_NR);
String postalCode = ApexPages.currentPage().getParameters().get(PARAMETER_KEY_POSTAL_CODE);
List<List<SObject>> searchList = [FIND {:phoneNr OR :postalCode} IN ALL FIELDS RETURNING Account (Id, Name)];  // this does not save

List<List<SObject>> searchList = [FIND '0612341234 'OR '1000AA' IN ALL FIELDS RETURNING Account (Id, Name)];  // hardcoding also did not save
[/code]

Thanks! JD

Hello everybody,

 

I have a problem with my code. I have created a new page for the account. I only want to show this page, for certain record types. So I created a redirect page, which redirects the user to either the original page, or the new account page. Below is my code.

 

 

	public PageReference redirectToPage() { 
		System.debug('In redirectToPage from AccountRedirectController');
		PageReference newPage = null; 
 		System.debug('Getting record type parameter:' +ApexPages.currentPage().getParameters().get('RecordType'));
		if(ApexPages.currentPage().getParameters().get('RecordType') == RECORDTYPE_OTHER_ACCOUNT.Id) {
			System.debug('Creating newPage from step with selected record types');
			newPage = Page.NewAccountPage1;
			newPage.getParameters().put('RecordType', RECORDTYPE_OTHER_ACCOUNT..Id);
		} else {
			if(ApexPages.currentPage().getParameters().get('RecordType') != null && ApexPages.currentPage().getParameters().get('RecordType') != RECORDTYPE_TP_ACCOUNT.Id) {
				System.debug('*** information **'+ApexPages.currentPage().getParameters().get('RecordType'));
				newPage = new Pagereference('/001/e?retURL=/001/o&RecordType='+ApexPages.currentPage().getParameters().get('RecordType')+'&ent=Account'); 
				newPage.getParameters().put('nooverride', '1');
			}
		}
		return newPage;
	}

 

 

The problem is with the line

 

ApexPages.currentPage().getParameters().get('RecordType')

 This returns null, when the user only has rights to one specific recordtype. While if the user has rights to multiple recordtypes, and he selects one this line always has a valid ID.

 

Why is the record type not set if the user has only access to one specific record type? And how do I get this specific recordtype in my code, so that I can build a correct redirect?

 

 

Any help would be appreciated, thanks, Jan-Dirk

 

 

Hi all,

I am working on a VF page with a lot of different modussus. Depending on the modus certain information should be shown. So I was thinking, and I thought I found a cool way how I could accomplish this. I created a function with a string as argument, and returns back if the element should be rendered or not.Using this function, the VF code should stay clean.

 

But when I try to use this function in my rendered attribute, it's not working :smileysad:. When I try to save (in eclipse) it says "Unknown function renderMe. Check spelling.".

 

Does anybody has any ideas, before I have to go and put everything in the rendered attribute itself over and over... Bleh that's gonna look dirty, I don't like to go that way :(

 

VF code:

 

<apex:page standardController="Account" extensions="AccountExtension" >
	<apex:commandButton value="Gegevens bewerken" action="{!enterEditMode}" rendered="{!renderMe('1')}"/>
	<apex:outputLabel value="" rendered="{!renderMe('1234')}"/>
</apex:page>

 

 

Controller code

 

 

public class AccountExtension {
	private static final String MODUS_1 = '1';
	private static final String MODUS_2 = '2';
	public String currentModus {get;set;}

	/** This method is used by the visual force components to determine if these can be rendered or not. 	*/
	public boolean renderMe(String modusses) {
		if (modusses.contains(currentModus)) {
			return true;
		}
		return false;
	}
}

 

 

 

 

 

 

 

I am having trouble finding a way to populate error messages to my visual force page. I would like to add a (custom) error message to a inputText on my visual force page like standard behaviour(red lines, and red error message). What I can accomplish is adding it to the top of the page, but how should I add it to one specific field(inputText or inputField)?

 

VF:code:

<apex:page>
<apex:form>
<apex:messages /> <!-- This is showing the errormessage at top -->
<apex:pageBlock mode="detail">
<apex:pageblockSection id="search" columns="1" rendered="{!editModus}">
<apex:outputLabel value="Value"></apex:outputLabel>
<apex:inputText value="{!aValue}"></apex:inputText> <-- HERE I WOULD LIKE TO have the error messages
<apex:commandButton value="Validate" action="{!validate}"/>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 And (a part) of my controller, now it adds the errormessage, but it is shown on top of the page

 

    public void validate() {
// other logic. I add a message to the page, but how can I add it to the input text
ApexPages.Message message = new ApexPages.message(ApexPages.severity.ERROR,'An error message.');
ApexPages.addMessage(message);
}

 

 

 

In apps like Postcode Anywhere they change the standard account page, and adding links like "Clear Billing, Clear Shipping and find" behind de postal code, and changing country list into picklist. See this picture

 

 

How do they do that? It's without a visual force page. I try to make something like this, with a custom home page component and javascript. But I keep having troubles with the cross domain security issue. Even hosting the javascript code in an static resource is not working.

 

It is getting to drive me completely crazy now... Any tips would be really welcome, since I am out of options now.

Hi,

 

I tried googling around, but I couldn't really find what I am looking for. What are currently the options of changing the behaviour and content of standard (new/edit) pages? See below for the scenario I would like to create.

 

I would like to create address lookup based on postcode details. For this I would like to modify existing pages for accounts.So I created a sidebar component and added some javasript to modify the components. Unfortunately, when deploying to sandbox I found out that it will not work, because different server addresses for the visual force servers

 

[code]

window.parent.document.getElementById('acc17country')

[/code]

 

Since the account has a lot of fields I don't really like to go into the way of full recreate the new/edit pages with a new visual force page.

 

So I am looking for ways to modify the content, I know there are some things possible like adding a (floatable) picklist for the countries in this app CountryCompleteFree. But I cannot really understand how they are doing this. Any help will be appreciated.

 

Hello everybody,

 

I have a problem with my code. I have created a new page for the account. I only want to show this page, for certain record types. So I created a redirect page, which redirects the user to either the original page, or the new account page. Below is my code.

 

 

	public PageReference redirectToPage() { 
		System.debug('In redirectToPage from AccountRedirectController');
		PageReference newPage = null; 
 		System.debug('Getting record type parameter:' +ApexPages.currentPage().getParameters().get('RecordType'));
		if(ApexPages.currentPage().getParameters().get('RecordType') == RECORDTYPE_OTHER_ACCOUNT.Id) {
			System.debug('Creating newPage from step with selected record types');
			newPage = Page.NewAccountPage1;
			newPage.getParameters().put('RecordType', RECORDTYPE_OTHER_ACCOUNT..Id);
		} else {
			if(ApexPages.currentPage().getParameters().get('RecordType') != null && ApexPages.currentPage().getParameters().get('RecordType') != RECORDTYPE_TP_ACCOUNT.Id) {
				System.debug('*** information **'+ApexPages.currentPage().getParameters().get('RecordType'));
				newPage = new Pagereference('/001/e?retURL=/001/o&RecordType='+ApexPages.currentPage().getParameters().get('RecordType')+'&ent=Account'); 
				newPage.getParameters().put('nooverride', '1');
			}
		}
		return newPage;
	}

 

 

The problem is with the line

 

ApexPages.currentPage().getParameters().get('RecordType')

 This returns null, when the user only has rights to one specific recordtype. While if the user has rights to multiple recordtypes, and he selects one this line always has a valid ID.

 

Why is the record type not set if the user has only access to one specific record type? And how do I get this specific recordtype in my code, so that I can build a correct redirect?

 

 

Any help would be appreciated, thanks, Jan-Dirk

 

 

I am having trouble finding a way to populate error messages to my visual force page. I would like to add a (custom) error message to a inputText on my visual force page like standard behaviour(red lines, and red error message). What I can accomplish is adding it to the top of the page, but how should I add it to one specific field(inputText or inputField)?

 

VF:code:

<apex:page>
<apex:form>
<apex:messages /> <!-- This is showing the errormessage at top -->
<apex:pageBlock mode="detail">
<apex:pageblockSection id="search" columns="1" rendered="{!editModus}">
<apex:outputLabel value="Value"></apex:outputLabel>
<apex:inputText value="{!aValue}"></apex:inputText> <-- HERE I WOULD LIKE TO have the error messages
<apex:commandButton value="Validate" action="{!validate}"/>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 And (a part) of my controller, now it adds the errormessage, but it is shown on top of the page

 

    public void validate() {
// other logic. I add a message to the page, but how can I add it to the input text
ApexPages.Message message = new ApexPages.message(ApexPages.severity.ERROR,'An error message.');
ApexPages.addMessage(message);
}

 

 

 

I can't get the Developer Console to work. All the other sys admins in my org have no problems but mine won't run a query. The menu items don't drop down and I get the following error.

Use the Query Editor tab to write and execute SOQL queries. Results are displayed in the Query Results Grid. Use the grid to create, update, and delete data. Take a quick tour...

I am using Chrome and it's up to date. I cleared all History but that hasn't helped either. frozen inoperable dev console
Hi,

I am trying find search results based on a custom text field on account, which contains the '-' minus character. The custom field is called Copy_Birthdate__pc and contains value "1982-01-19"

Since there is a minus, I have to escape it with a \ to use it in the Database.search, but I am not getting any values. Anybody has any idea why there are no results? In normal global search I can find the records

[code]
String safeSearchString = '1982\-01\-19';         
String searchQuery = 'FIND {' +safeSearchString +'} IN ALL FIELDS RETURNING Account(id, Name, Copy_BirthDate__pc  ) ,Contact(Id)';
System.debug('The value of searchQuery' +searchQuery);
List<List<SObject>> searchList = Search.query(searchQuery);
List<SObject> accounts =   searchList.get(0);
List<SObject> contacts =   searchList.get(1);
System.debug('Size of accounts: ' +accounts.size());
System.debug('Size of contacts: ' +contacts.size());
[/code]




All,

 

I'm trying to create a simple Custom Action using the Case Feed developer guide documentation. I simply want a new action which is, effectively, a tab to fill out the important fields on a new case. I'm having a couple issues:

 

  1. The documentation says it's as simple as adding a new visualforce page, but it seems that the standard styling and field bindings don't work in quite the same way. When using <apex:inputfield>, labels aren't auto populated and styled and fields aren't laid out based upon the attributes set within the parent "pageblocksection" tag. Is there a way around this, or do they simply have to be styled?
  2. The label for the custom action seems to be the developer name for the page. Is there any way around this? I can't use spaces in my page name and like to categorise my visualforce page names in a way that wouldn't be very clear to other users.
  3. Using the <apex:outputlabel> value attribute with "{!$ObjectType.case.fields.<<FieldName>>.label}" sometimes outputs"common.api.soap.wsdl.Field@14f7af8d.label}" on the page instead of the field label

Is the documentation simply not completely accurate when it comes to how compatible visualforce pages are with the csae feed? If so, what resources should I look at to code these requirements? I'm not very expert in javascript, but can learn as need be, as long as I know where to look!

 

With thanks,

Andy

Hi All,

 

   

I created a VF page with required input fields and a validation rule along with a command buttons ( "Update" buttons). While submitting the information if I does not input on one of the required fields, It displays the validation rule error message and at the same time all fields are get cleared.

 

But, I like to keep all data on the fields, but display error message.


How to resolve this "Fields get cleared" problem... Please suggest me

 

Thanks,

 

 

 

<apex:page Controller="MyAccount">
    <apex:form >    
    <apex:outputPanel id="AuthorizedContacts">    
    <apex:message/>
    <h2>{!primaryContact.Name}</h2><br/>
    <apex:commandbutton action="{!addAuthContact}" value="Add Contact" rerender="AuthorizedContacts" rendered="{!addAuthContact == false}"/>
    
        <apex:repeat value="{!newAuth}" var="a">
        <apex:outputpanel rendered="{!addAuthContact}">
            {!a.Contact_Type__c}<br/>
            <h4>Name &amp; Contact</h4><br/>
              
                FIRST NAME* <apex:inputField value="{!a.FirstName}" id="contact-first-name" required="true"/>
                LAST NAME* <apex:inputField value="{!a.LastName}"  id="contact-last-name" required="true"/>
                PHONE* <apex:inputField value="{!a.Phone}"  id="contact-phone" required="true"/>
                EMAIL ADDRESS* <apex:inputField value="{!a.Email}"  id="contact-email" required="true"/> 
                
            <h4>Contact Address</h4><br/>
            
                ADDRESS 1 <br/><apex:inputText value="{!a.Contact_Address_Line_1__c}"  id="contact-addr-1"/><br/>
                ADDRESS 2 <br/><apex:inputText value="{!a.Contact_Address_Line_2__c}"  id="contact-addr-2"/><br/>
                CITY <br/><apex:inputText value="{!a.Contact_Town_City__c}"  id="contact-city"/><br/>
                POST CODE <br/><apex:inputText value="{!a.Contact_Postal_Code__c}"  id="contact-postal"/><br/>
                COUNTY <br/><apex:inputText value="{!a.Contact_County__c}"  id="County"/><br/>
                
                COUNTRY<br/>
                <apex:SelectList value="{!CountryName}" size="1">
                    <apex:selectOptions value="{!lstCountry}"></apex:selectOptions>
                </apex:SelectList><br/>
            
            <h4>Is This Authorized Contact Part of Your:</h4><br/>
                <apex:Inputcheckbox value="{!a.IsHousehold__c}"/>
                <label>Household</label>
                <apex:Inputcheckbox value="{!a.IsBusiness__c}"/>
                <label >Business</label><br/>
                <apex:messages rendered="{!IsValidate}" styleClass="errorMsg"/><br/>
            <apex:commandbutton styleClass="cancel" action="{!cancelAuth}" value="Cancel" immediate="true" rerender="AuthorizedContacts"/>
            <apex:commandButton styleClass="button-medium" action="{!saveAuth}" value="Save Updates" rerender="AuthorizedContacts"/>
        
          </apex:outputPanel>      
        </apex:repeat>
        </apex:outputPanel>
    </apex:form>
</apex:page>

 

 

public class MyAccount {
    
    private Id uid;
    public Id aid{get;set;}
    public Id cid{get;set;}
	
	public string CountryName {get;set;}
	
    public Boolean IsValidate{get;set;}
    public Boolean addAuthContact{get;set;}
    
    public User objUser{get;set;} 
    public Contact primaryContact;
	
    public list<Contact> newAuth;
	
    public MyAccount(){
	
        uid = UserInfo.getUserId();
        getObjUser();    
    }
    
    public List<SelectOption> getlstCountry()
    {  list<SelectOption> options = new list<SelectOption>(); 
        try{
            list<Country__c> ls = [select Name,LZ_Country_Id__c,Id from Country__c];
            
			 	Country__c uk = [select Name,LZ_Country_Id__c,Id from Country__c Where Name = 'United Kingdom'];
            
			 	options.add(new SelectOption(uk.Id,uk.Name));
				
            for(Country__c o:ls){
                if(o.Name != 'United Kingdom')
                options.add(new SelectOption(o.Id,o.Name));
            }
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        }  
        return options;
    }
	
    public void getObjUser(){
        try {
            uid = Apexpages.currentPage().getParameters().get('id');
            if(uid != null){
            objUser = [Select   User.ContactId,
                                User.AccountId,
                                User.UserType
                        From    User
                        Where   User.Id = :uid ];
            cid = objUser.ContactId;
            aid = objUser.AccountId;    
            }
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        } 
    }
    
    public Contact getprimaryContact(){
        try
        {
            if(cid != null){
                primaryContact = [Select    Contact.Id,
                                            Contact.Name,
                                    From    Contact
                                    Where   Contact.Id =:cid];
            }
        }catch(Exception ex){
            System.debug('Error From ' + ex.getMessage());
        } 
        return primaryContact;
    }    
  
    public list<Contact> getnewAuth(){
        try
            {   
                newAuth = new list<Contact>();
                Contact ac = new Contact();
                if(aid != null) {
                    ac.AccountId = aid;
                    ac.Contact_Type__c = 'Authorized Contact';
                } 
                newAuth.add(ac);    
        }
        catch(Exception ex)
        {
                System.debug('Error From' + ex.getMessage());
        }   
         return newAuth;
    }
    
    public PageReference addAuthContact(){
        try{
            getnewAuth();
            addAuthContact = true;
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        }
        return null;
    }   
     
    public PageReference cancelAuth(){
        try{
            newAuth = null;
            addAuthContact = false;
        }
        catch(Exception ex)
        {
            System.debug('Error From ' + ex.getMessage());
        }
        return null;
    }
    
    public PageReference saveAuth() {  
        
         try{
        List<Contact> tempCon = new List<Contact>();
        if(newAuth != null)  {      
            for(Contact t : newAuth)
            {
                t.Contact_Country__c = CountryName ;                
                tempCon.add(t);
            }
        }
        insert tempCon;
        addAuthContact = false;
        }catch(DmlException ex){
        	if(newAuth[0].IsBusiness__c == false && newAuth[0].IsHousehold__c == false){
        		IsValidate = true;
        	}        	
            ApexPages.addMessages(ex);
        }
        return null;
    }
}

 

 

 

 

 

 

  • August 14, 2013
  • Like
  • 0

Hello Everyone,

 

When we refresh Sub tab by refreshSubtabById(), it also refreshes custom console component in sidebar which is not desired in my case. Even refreshSubtabById() documentation in "Service Cloud Console Integration Toolkit Developer's Guide" states as below given:

"Note that this method doesn't refresh sidebars or custom console components. For more information, see Custom Console
Components Overview in the Salesforce online help."

 

Any help to prevent custom console component reload on refreshing subtab will be much appreciated.

 

Thanks.

Hi,

I am generating visualforce page as Excel by adding "contenttype="application/vnd.ms-excel"" in the <apex:page> tag. The excel is getting generated but formatting is bad... how do i format ? Can anyone give me example.

I've brought this up with Premier support and keep getting told that I need to modify my code and the following issue I am having is working as intended.

 

I have this query in a User Trigger: Profile p1 = [SELECT ID from Profile WHERE Name = 'System Administrator'];

 

When the trigger fires with a user that has "English" as their language on their user record, the query returns one row, the Standard System Administrator profile.

 

When the trigger fires with a user that has "Spanish" as their language on their user record, a "System.QueryException: List has no rows for assignment to SObject" exception is thrown. That's because the API has translated "System Administrator" into "'administrador del sistema"

 

Up until this point, Salesforce is suggesting I add a "or Name =''administrador del sistema' " to my where clause or that I specifically check what locale the running user is in and execute a different query specifically for them, but neither of these seem like a reasonable solution. What if I have users that use 10 different languages? Do I really need to handle all these additional or clauses in my SOQL statements? What happens when even more additional languages are available natively?

 

I bring this up because it's not really a big deal to change the one line of code, but it is a big deal to go through all of our custom code, duplicate/modify it for each and every language, and then update all the test classes to check it. 

 

Is there a way or a function I can use to say that regardless of the user's selected langauge, always run this Trigger or Class in English?

 

Thanks in advance.

Hi Board,

I'm facing a issue in trigger where in i'm trying to perform a dml statement using List<sObject>.

It throws exception for me when i have more then 900 records in my list.

Error message is stated below:

System.TypeException: Cannot have more than 10 chunks in a single operation. Please rearrange the data to reduce chunking.

 

I recently upgraded my Force.com IDE (and all projects) to the Winter '12 release. Since upgrading, I've been observing that when I attempt to run unit tests against an Apex class, it often takes a very long time to execute. Even relatively simple tests sometimes take a minute or two to complete. The time doesn't seem to be spent during test execution, but rather during the "preparing results..." phase (based on the progress indicator in the IDE). Reducing the log level doesn't seem to have any impact one way or the other. I've also seen it simply get stuck in the "preparing results..." phase to the point where I had to kill the Eclipse process. Anyone else seeing this?

  • January 04, 2012
  • Like
  • 0

Hello.  I have a Parent__c object and a Child__c object.  I have a custom list button on Child__c object and I am using URLFOR to select a record type (the "p3" parameter) and fill in a field for the Child object.

The cancelURL parameter is not working - when I click Cancel on the Child data entry screen, there is a refresh but I am returned to the Child screen instead of the Parent record screen.

Do I have the cancelURL parameter formatted correctly?  If I enclose it with curly braces and a !, then I get a syntax error when trying to save the button code.

 

Is this occurring because of save="1"?  I need this because I am selecting a record type and need to skip the record type selection screen.

{!URLFOR($Action.Child__c.New, null, [
CF00N40000001euw3=Parent__c.Name,
p3="012400000009RQP",
retUrl=URLFOR($Action.Parent__c.View, Parent__c.Id, null, true),
cancelUrl=URLFOR($Action.Parent__c.View, Parent__c.Id, null, true),
save="1"
], true)}

 

 

Hello everybody,

 

I have a problem with my code. I have created a new page for the account. I only want to show this page, for certain record types. So I created a redirect page, which redirects the user to either the original page, or the new account page. Below is my code.

 

 

	public PageReference redirectToPage() { 
		System.debug('In redirectToPage from AccountRedirectController');
		PageReference newPage = null; 
 		System.debug('Getting record type parameter:' +ApexPages.currentPage().getParameters().get('RecordType'));
		if(ApexPages.currentPage().getParameters().get('RecordType') == RECORDTYPE_OTHER_ACCOUNT.Id) {
			System.debug('Creating newPage from step with selected record types');
			newPage = Page.NewAccountPage1;
			newPage.getParameters().put('RecordType', RECORDTYPE_OTHER_ACCOUNT..Id);
		} else {
			if(ApexPages.currentPage().getParameters().get('RecordType') != null && ApexPages.currentPage().getParameters().get('RecordType') != RECORDTYPE_TP_ACCOUNT.Id) {
				System.debug('*** information **'+ApexPages.currentPage().getParameters().get('RecordType'));
				newPage = new Pagereference('/001/e?retURL=/001/o&RecordType='+ApexPages.currentPage().getParameters().get('RecordType')+'&ent=Account'); 
				newPage.getParameters().put('nooverride', '1');
			}
		}
		return newPage;
	}

 

 

The problem is with the line

 

ApexPages.currentPage().getParameters().get('RecordType')

 This returns null, when the user only has rights to one specific recordtype. While if the user has rights to multiple recordtypes, and he selects one this line always has a valid ID.

 

Why is the record type not set if the user has only access to one specific record type? And how do I get this specific recordtype in my code, so that I can build a correct redirect?

 

 

Any help would be appreciated, thanks, Jan-Dirk

 

 

I'm sorry for such a stupid question but I'm at a complete loss.

 

Any idea why this doesn't work:

 

 

<apex:messages style="font-color:red;"/>

 


<apex:messages style="font-color:red;"/>

 

I get the messages, but no color :(

Hello,

 

I am a newbie Apex Developer trying to solve an issue with calling the StandardController.edit() method.

 

I created a custom Organization__c object for a user to enter info about their company.   I want logic in the class to limit t 1 instance of Organization__c, so I over-rode the "New" button on the object to point to a Visualforce page that calls my determinePageRedirect method.  If the list of Organization__c is > 0, it returns a PageReference to the edit page using the current ID.  If the list is null, I want to call StandardController.edit() to show the regular new page for Organization__c.  

 

Code works as expected when this.existingOrganization.size () > 0. however, I get an error message "cannot call edit() on null object when that list is empty. Seems like I need some mojo on my StandardController instantiation to make this work. Any ideas? Any help is greatly appreciated - this is driving me nuts!

 

Thanks

 

Apex Class

 

public class OrganizationValidation {

	//declare a private controller variable
	private ApexPages.StandardController controller;
	
	private Organization__c org {get;set;}
	
	//populate list of existingOrganizations
	public List<Organization__c> existingOrganizations;
		public List<Organization__c> getExistingOrganizations(){
			return existingOrganizations;	
	}

	//instatiate class
	public OrganizationValidation(){	
	}
	
	//standard controller constructor
	public OrganizationValidation(ApexPages.StandardController pController) {
        this.controller = pController;
        System.debug('***this.controller: ' +this.controller);
		
		//need StandardController to be aware of current context
		
		
		this.org = (Organization__c)pController.getRecord();
		System.debug('***org: '+ org);

    	OrganizationRedirect();
    }
    
	//Run these methods when we hit the Visualforce page
	public PageReference OrganizationRedirect(){
		
			
		//invoke method to query if there is an Organization__c result
		queryOrganizations();
		
		//invoke method to redirect based on if/then
		determinePageRedirect();
		
		return null;
	
	}
	
	//PageReference method – button on Visualforce page calls
	public PageReference editButtonRedirect() {

		PageReference editRedirect;
		for(Organization__c org: this.existingOrganizations){
				Organization__c myOrg = org;
				editRedirect = new PageReference ('/' + myOrg.id + '/e');
		
		}
	
		return editRedirect;
	
	}
		
	public void queryOrganizations(){
		//query the orgID
		this.existingOrganizations = [Select id, Name From Organization__c];
		//System debug
		System.debug('***existingOrganizations: '+existingOrganizations);
		
	}
	
	//Method to run if/else statement to redirect page
	public PageReference determinePageRedirect(){
	
		PageReference redirectPage;
		if (this.existingOrganizations.size() > 0){
			
			redirectPage = new PageReference ('apex/OrganizationRedirect');
			
		}else{
			
			//Show new page
			redirectPage = this.controller.edit();
			
		}
	
return redirectPage;
	
	}
}

 

Visualforce Page

 

<apex:page standardController="Organization__c" extensions="OrganizationValidation" action="{!determinePageRedirect}">
	<apex:outputPanel >
		<apex:form >
			<h1>Warning</h1>
			<p>You already entered your Organization's information.  Please edit the existing record.</p>
			<apex:commandButton action="{!editButtonRedirect}" value="Edit Organization" />
		</apex:form>
	</apex:outputPanel>
</apex:page>

 

 

 

 

 

I have developed a VF page and I am using standard styles for the apex form. I customized the page using my css styles

but no matter what I do, I am unable to get rid of the pageblock border (thin black border) that is appearing on the right side

and at the bottom of the page..any help is greately appreciated!!

I need to write some code to concurrently create, via queueable async apex, up to 5-6 Opportunity on the same Account.  In addition to the insert to Opportunity will be inserts of up to a few hundred records to OpportunityLineItem and also several records to custom tables related to Opportunity.  I have code that inserts all the records already but haven't tried using it concurrently yet.  There is no expicit commit in Apex so all those updates are in one transaction and that transaction can run for 20-30 seconds.

When I start doing the create Opportunities concurrently, I'm worried about locking errors.  The main resource shared by all Opps is Account.  If the first transaction write-locks Account then the others will likely fail with locking errors.  There's also the issue of PricebookEntry and Product as many of the Opps will be using similiar lists of Products.

Anyone know what locks will be held when the inserts are happening to Opp and Opp Line Item and what the likelihood of interference is?