• Feng_W
  • NEWBIE
  • 75 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
I'm trying to get this to work...

<apex:page standardController="Account" showHeader="true" tabStyle="account" > {!$CurrentPage.parameters.tabFocus} <br/><br/> <apex:tabPanel switchType="client" escape="false" selectedTab="{!$CurrentPage.parameters.tabFocus}" id="tabPanel" > <apex:tab label="Details" name="AccDetails" id="tabdetails"> <apex:detail relatedList="false" title="true"/> </apex:tab> <apex:tab label="Contacts" name="Contacts" id="tabContact" > <apex:relatedList subject="{!account}" list="contacts" /> </apex:tab> </apex:tabPanel> </apex:page>

 ...by requesting this URL: https://c.cs1.visual.force.com/apex/TabbedAccount?id=15DigitAccountId&tabFocus=Contacts

I know {!$CurrentPage.parameters.tabFocus} works, because it displays "Contacts".
And the selectedTab attribute works great if I hard-code it to "Contacts".

But the combo does nothing. Is this disabled because of Cross site scripting attacks? Or am I missing something? Any help appreciated.

At the end of the day, I'm trying to set the focus of a tab in a tab panel in this VF page when returning from a different page in the app.

Thanks,

cb
Message Edited by Chris Barry on 03-18-2009 12:10 PM
we just enabled person account on the contact object, but there are lots of existing contacts do not have any 1 to 1 person account on account object,
 
Is there any way to create person accounts for these existing contact without deleting these contacts, as these contacts were referenced by different objects;
 
here is my code trying to do: the record type in account is updated successful, but is IsPersonAccount is field in Account is still set to false
 
Code:
//get the business account record type
RecordType NotPersonAccountRecordType = [select Id, Name, SobjectType,
         IsPersonType from RecordType where SobjectType='Account'
         and IsPersonType=False];

// get 1 existing account
Contact c = [select id, AccountId, FirstName, LastName, Cris_Id__c from Contact where IsPersonAccount = false Limit 1];


// create a new account and set the record type to business account
Account newAccount = new Account();
newAccount.Name='' + c.LastName;
newAccount.RecordTypeId = NotPersonAccountRecordType.Id;
insert newAccount;


//get the person account record type
recordType personaccountrecordtype = [select Id, Name, SobjectType,
         IsPersonType from RecordType where SobjectType='Account'
         and IsPersonType=True];

// update the existing contact's account to new account
c.AccountId = newAccount.Id;
update c;


// now get it again and update the firstname and lastname, change the record type to person account
newAccount = [select id,lastName, Firstname, RecordTypeId from Account where Id =: newAccount.Id];
newAccount.RecordTypeId = personaccountrecordtype.Id;
newAccount.LastName=c.LastName;
newAccount.FirstName=c.FirstName;   
update newAccount;

These code runs successfully, but the IsPersonAccount in Account object is false for some reason

Any one have idea how to get around the problem or other direction to do these?


thanks in advance


 


Message Edited by Feng on 12-10-2008 05:57 PM

Message Edited by Feng on 12-10-2008 05:59 PM
  • December 11, 2008
  • Like
  • 0

is it possible to get the server variables in apex code?

like page referer, user browser, those information?

 

like asp.net, has request.ServerVariables["HTTP_REFERER"], etc

 

thanks in advance

 

 

  • March 26, 2009
  • Like
  • 0

i had a very simple tab page within a tab panel like this

<apex:panelGrid id="pnlGrid" width="100%">

 

<apex:enhancedList type="Case" height="700" rowsPerPage="100"  oncomplete="alert('abc');" />

 

</apex:panelGrid>

however the javascript  oncomplete="alert('abc');" is not firing when the enhancedList completes rendering...

 

anyone  has an idea?

 

thanks in advance

  • March 26, 2009
  • Like
  • 0

is it possible to get the server variables in apex code?

like page referer, user browser, those information?

 

like asp.net, has request.ServerVariables["HTTP_REFERER"], etc

 

thanks in advance

 

 

  • March 26, 2009
  • Like
  • 0

i had a very simple tab page within a tab panel like this

<apex:panelGrid id="pnlGrid" width="100%">

 

<apex:enhancedList type="Case" height="700" rowsPerPage="100"  oncomplete="alert('abc');" />

 

</apex:panelGrid>

however the javascript  oncomplete="alert('abc');" is not firing when the enhancedList completes rendering...

 

anyone  has an idea?

 

thanks in advance

  • March 26, 2009
  • Like
  • 0
I'm trying to get this to work...

<apex:page standardController="Account" showHeader="true" tabStyle="account" > {!$CurrentPage.parameters.tabFocus} <br/><br/> <apex:tabPanel switchType="client" escape="false" selectedTab="{!$CurrentPage.parameters.tabFocus}" id="tabPanel" > <apex:tab label="Details" name="AccDetails" id="tabdetails"> <apex:detail relatedList="false" title="true"/> </apex:tab> <apex:tab label="Contacts" name="Contacts" id="tabContact" > <apex:relatedList subject="{!account}" list="contacts" /> </apex:tab> </apex:tabPanel> </apex:page>

 ...by requesting this URL: https://c.cs1.visual.force.com/apex/TabbedAccount?id=15DigitAccountId&tabFocus=Contacts

I know {!$CurrentPage.parameters.tabFocus} works, because it displays "Contacts".
And the selectedTab attribute works great if I hard-code it to "Contacts".

But the combo does nothing. Is this disabled because of Cross site scripting attacks? Or am I missing something? Any help appreciated.

At the end of the day, I'm trying to set the focus of a tab in a tab panel in this VF page when returning from a different page in the app.

Thanks,

cb
Message Edited by Chris Barry on 03-18-2009 12:10 PM
we just enabled person account on the contact object, but there are lots of existing contacts do not have any 1 to 1 person account on account object,
 
Is there any way to create person accounts for these existing contact without deleting these contacts, as these contacts were referenced by different objects;
 
here is my code trying to do: the record type in account is updated successful, but is IsPersonAccount is field in Account is still set to false
 
Code:
//get the business account record type
RecordType NotPersonAccountRecordType = [select Id, Name, SobjectType,
         IsPersonType from RecordType where SobjectType='Account'
         and IsPersonType=False];

// get 1 existing account
Contact c = [select id, AccountId, FirstName, LastName, Cris_Id__c from Contact where IsPersonAccount = false Limit 1];


// create a new account and set the record type to business account
Account newAccount = new Account();
newAccount.Name='' + c.LastName;
newAccount.RecordTypeId = NotPersonAccountRecordType.Id;
insert newAccount;


//get the person account record type
recordType personaccountrecordtype = [select Id, Name, SobjectType,
         IsPersonType from RecordType where SobjectType='Account'
         and IsPersonType=True];

// update the existing contact's account to new account
c.AccountId = newAccount.Id;
update c;


// now get it again and update the firstname and lastname, change the record type to person account
newAccount = [select id,lastName, Firstname, RecordTypeId from Account where Id =: newAccount.Id];
newAccount.RecordTypeId = personaccountrecordtype.Id;
newAccount.LastName=c.LastName;
newAccount.FirstName=c.FirstName;   
update newAccount;

These code runs successfully, but the IsPersonAccount in Account object is false for some reason

Any one have idea how to get around the problem or other direction to do these?


thanks in advance


 


Message Edited by Feng on 12-10-2008 05:57 PM

Message Edited by Feng on 12-10-2008 05:59 PM
  • December 11, 2008
  • Like
  • 0