• Shriram
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hi,

I have 2 Objects say P and another Object C. Object  C has a field of type look up  for Object P.Object C also has two record types. Now when a user goes to the detail page of object P he can see Object C records in the related list of Object P. When a user clicks on the New button in the relatedlist of Object C, record type selection page is displayed. When the user selects a recordtype and clicks Continue button i have some validation to be done. After the validation the user is either taken to Object C page layout or redirected back to the Object P's detail view. For validation I have thought of using VF page or S-control that will override the New button of Object C.

If i use s-control the main issue  is  reconstructing the  record type  URL in  s-control with all those  CN<field Id > and lkid found in standard recordtype page layout.
If i want to useF page how is that call any action onload of the VF page so that i do my validation in the action method any redirect from their.

If possible i wish to create Url for the record type using URLfor or some other function of salesforce.
I dont want to hardcode parts of  URL  like the field Id, lkid

Any inputs on how i can fulfill my requirement would help me a lot..

Thanks
Hi,

Can somebody give a sample code of how to use describesObjects API call in a apex class ?
Hi

I have created two Record type say A, B for a custom object and assigned the record type to repective page layout say A, B.
When a user clicks on the continue button after choosing the record type I want to check if a record already exists for the selected record type. If a record type exists then one more record cannot be added to the same record type.
In this case i need to show a error message and redirect the user back to original screen.

I am wondering how this funtctionality can be achieved ?
Anyinputs and sample code would do wonders for me..

Thanking in advance..

Regards



Is it possible to create a dataTable that contains fields that are not in the sObject of the dataTable. Perhaps a check box or a picklist or both. This question sort of stems from this thread, http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=691 ,  which to be honest I haven't totally understood.

Here is a real use case that we are looking at addressing with Visual Force. We would like to pull a list of contacts and do mass emailing using Apex Email services. Essentially we would pull a list of contacts and put this in a dataTable but on the left side of the dataTable there would check boxes that indicate if we would like to send this user an email. There would also be another column that is a picklist which determines what type email they should receive.  A user would then make their selections and hit the send email button.

Neither of these fields are on the contact as they would only be relevant for this VF page. So is it possible to build something like this where the checkbox and and picklist value are passed to a collection of contacts?

Here is what I have so far. I know its not right as all of the checkboxes and picklist are pointing to the same variable but I think it gives you an idea of what we are trying to do.
Page:
Code:
<apex:page controller="contacts">
        <apex:panelGrid columns="1" id="theGrid" width="50%" >
        <apex:pageBlock>
        <apex:form>
        <apex:dataTable value="{!Contacts}" var="con" styleClass="list">
                <apex:column>
                        <apex:facet name="header"><apex:inputCheckbox/></apex:facet>
                        <apex:inputCheckbox/>
                </apex:column>
                <apex:column>
                        <apex:facet name="header">Name</apex:facet>
                        <apex:outputText value="{!con.Name}"/>
                </apex:column>
                <apex:column>
                        <apex:facet name="header">Phone</apex:facet>
                        <apex:outputText value="{!con.Phone}"/>
                </apex:column>
                <apex:column>
                        <apex:facet name="header">Mailing City</apex:facet>
                        <apex:outputText value="{!con.MailingCity}"/>
                </apex:column>
                <apex:column>
                        <apex:facet name="header">Email</apex:facet>
                        <apex:outputText value="{!con.Email}"/>
                </apex:column>
                <apex:column>
                        <apex:facet name="header">Email Type</apex:facet>
                        <apex:selectList value="{!emailType}" size='1'>
                                <apex:selectOptions value="{!emails}"/>
                        </apex:selectList>
                </apex:column>
        </apex:dataTable>
        </apex:form>
        </apex:pageBlock> 
        </apex:panelGrid>
</apex:page>

Controller:
Code:
public class contacts {
    
        Contact [] Contacts;
        String emailType;
        
        public List<Contact> getContacts(){
                if(contacts == null){
                        contacts = [select Id, Name, Phone, MailingCity, Email from Contact limit 10];
                } 
                return Contacts;
        }

        public void setemailType(String emailType){
                this.emailType= emailType;
        }

        public List<SelectOption> getEmails(){
                List<SelectOption> options = new List<SelectOption>();
                
                options.add(new SelectOption('','-None-'));
                options.add(new SelectOption('Renewal Notice','Renewal Notice'));
                options.add(new SelectOption('White Paper','White Paper'));
                options.add(new SelectOption('Phone Call Follow Up','Phone Call Follow Up'));
                              
                return options;
           
        }

 public String getEmailType() {
        return emailType;
     }
}

 


  • March 20, 2008
  • Like
  • 0