• SFDC9999
  • NEWBIE
  • 5 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 12
    Questions
  • 15
    Replies
We have 7 Communities in our Org. 4 Communities with  Visual Force+Tabs template and 3 Communities on Custome Service Template(Lighting).

Our Company Custom domain is www.abc.com 

Currently, our Community URL's are set up under the Custom domain. We did all the CName , DNS etc.. all the stuff that is required to have our own branded URL's.

https://Community1.AxxBxxCxx.com
https://Community2.AxxBxxCxx.com
https://Community3.AxxBxxCxx.com
https://Community4.AxxBxxCxx.com
https://Community5.AxxBxxCxx.com
​​​​​​https://Community6.com
https://ABC.force.com/Community7

Question:
As we keep adding more communities to our Org we would like to have one URL for all the communities something like www.ourcompany.communities.com
The idea is when a user enters through this URL we take them to a login page and then based on the credentials they provide we take them to the appropriate community.
Is this possible? And if it is possible would it be a problem with having different community templates.

Thanks,
Goutham. 
Hi,

I have 7 Record Types on Cases and 2 of those record types have to take the user to a Visual force page along with the recordtype selected and the rest of the 5 record types should take the user to a standard case page .
 
public with sharing class CaseOverrideController {

    private ApexPages.StandardController stdCntrl {get; set;}
    
    private Boolean isNew;
    private Boolean isEdit;
    private Boolean isView;

    public CaseOverrideController( ApexPages.StandardController sc ) {
        
        stdCntrl = sc;
        String pageURL = ApexPages.currentpage().geturl();

        if( stdCntrl.getId() == null ){
            this.isNew = true;
        }else{

            if( pageURL.containsIgnoreCase('/e') || pageURL.containsIgnoreCase('retURL') ){
                this.isEdit = true;
            }else{
                this.isView = true;
            }
        }
    }

    public PageReference redirectPage(){
        Schema.DescribeSObjectResult result = Case.sObjectType.getDescribe();
        String caseKeyPrefix = result.getKeyPrefix();

        Map<String , String> currentPageParam = ApexPages.Currentpage().getParameters();

        PageReference pr;
       

            if( this.isNew != null && this.isNew ){
                pr = new PageReference('/' + caseKeyPrefix + '/e'); 
   
            }else{
                
                if( [select RecordType.Name from Case where Id = :stdCntrl.getId()].RecordType.Name == 'Core Collection' ){
                    pr = Page.CC_CaseEdit;
                }else{
                    if( this.isEdit != null && this.isEdit ){
                        pr = Page.CC_CaseEdit;       
                    }else{
                        pr = new PageReference('/' + stdCntrl.getId() );
                    }
                }
            }
            
            if( stdCntrl.getId() != null ){
                pr.getParameters().put('id', stdCntrl.getId());
            }
        

        // Copy over parameters for redirect page
        if( !currentPageParam.isEmpty() ){
            pr.getParameters().putAll( currentPageParam );
            pr.getParameters().remove('save_new');
        }
        return pr;
    }
}
<apex:page showHeader="true" sidebar="true" StandardController="Case" extensions="CaseOverrideController" action="{!redirectPage}" />
I have got it to working a little bit but the If conditions are not right and does not satisy what i am trying to do. And for some reason my standard page keeps loading and never finish loading.

Tried so manby solutions and the pb with all other solutions is record type not setting on the Visual force page which this code does. Any help please

 
I have a Override page for Case , Which redirects to a Visual force page if a certain record type is selected and if not it redirects to a standard page. This is working perfectly for redireting to the necessary page . Howewer when  it is directed to the visual force page the record type which was selected is not passed to the visual force page and it is causing issues with the Picklist values based on the record type. Visual force page always shows the default record type instead of the selected record type.

Here is my override page 
 
<apex:page standardController="Case" extensions="caseRedirect" tabStyle="Case" showheader="true" action="{!redirect}" />
public with sharing class caseRedirect {

private ApexPages.StandardController controller;
public String retURL {get; set;}
public String Type {get; set;}
public String saveNewURL {get; set;}
public String rType {get; set;}
public String cancelURL {get; set;}
public String ent {get; set;}
public String confirmationToken {get; set;}
public String accountID {get; set;}
public String contactID {get; set;}

public caseRedirect(ApexPages.StandardController controller) {

    this.controller = controller;

    retURL = ApexPages.currentPage().getParameters().get('retURL');
    rType = ApexPages.currentPage().getParameters().get('RecordType');
    cancelURL = ApexPages.currentPage().getParameters().get('cancelURL');
    ent = ApexPages.currentPage().getParameters().get('ent');
    confirmationToken = ApexPages.currentPage().getParameters().get('_CONFIRMATIONTOKEN');
    saveNewURL = ApexPages.currentPage().getParameters().get('save_new_url');
    accountID = ApexPages.currentPage().getParameters().get('def_account_id');
    contactID = ApexPages.currentPage().getParameters().get('def_contact_id');

}

public PageReference redirect() {

    PageReference returnURL;

    // Redirect if Record Type corresponds to custom VisualForce page

    IF(rType == '012180000000DjD') {

        returnURL = new PageReference('/apex/CC_CaseEdit?Recordtype=012180000000DjD');

    }
  
    ELSE {

       returnURL = new PageReference('/500/e');

    }

    returnURL.getParameters().put('retURL', retURL);
    returnURL.getParameters().put('RecordType', rType);
    returnURL.getParameters().put('cancelURL', cancelURL);
    returnURL.getParameters().put('ent', ent);
    returnURL.getParameters().put('_CONFIRMATIONTOKEN', confirmationToken);
    returnURL.getParameters().put('save_new_url', saveNewURL);
    returnURL.getParameters().put('nooverride', '1');

    IF (accountID != null){

        returnURL.getParameters().put('def_account_id', accountID);

    }

    IF (contactID != null){

        returnURL.getParameters().put('def_contact_id', contactID);

    }

    returnURL.setRedirect(true);
    return returnURL;

}

}
When VF opens up the record type is always default record type instead of the record type i selected .What am i missing

Thanks 

 
HI ,

I have a VF where i am trying to build functionality for Entering Orders and Mutiple Order Products . However while doing this User needs to select the price book and then all the products belonong to that Proce book should show up . Using a Input field is showing all the Pricebooks. 
So while entering Order details user selects an Account and based on this account selection all the Pricebooks available in the Lookup should be limited . 

Account ( Parent Object )
Price book Access ( Child to Account - Which contains Pricebooks this account can access )( Price book access object has a lookup relation to Price book)
<apex:page standardController="Order" tabStyle="Order" sidebar="true" standardStylesheets="true" >
   <apex:sectionHeader title="Order Entry Page" subtitle="{!Order.Ordernumber}"/>
      <apex:form > 

            <apex:pageMessages id="pgmsg"></apex:pageMessages>
            <apex:pageBlock id="kt">
                    <apex:pageBlockButtons >
                          <apex:commandButton value="Save" action="{!save}"/>
                          <apex:commandButton value="Cancel" action="{!cancel}"/>
                    </apex:pageBlockButtons>
            
                    <apex:pageBlockSection columns="2" collapsible="True" title="Order Information">
                             <apex:inputField value="{!order.AccountId}"/>
                             <apex:inputField value="{!order.CurrencyISOCode}"/>
                             <apex:inputField value="{!order.Order_ShipTo_Address__c}"/>
                             <apex:inputField value="{!order.status}"/>
                             <apex:inputField value="{!order.Order_Requested_Delivery_Date__c}"/>
                             <apex:inputField value="{!order.EffectiveDate}"/>      
                   </apex:pageBlockSection>
                   <apex:pageBlockSection columns="1" title="Order Additional Information">
                             <apex:inputField value="{!order.Order_Comments__c}"/>                   
                   </apex:pageBlockSection>
                   <apex:pageBlockSection columns="1" title="Price Book Information">
                             <apex:inputField value="{!order.Pricebook2ID}"/>                   
                   </apex:pageBlockSection>
                   <apex:pageBlockSection columns="1" title="Order Product Information">
                                           
                   </apex:pageBlockSection>
                   <apex:pageBlockSection columns="1" title="Order Discounts">
                           // Need to get fields from Account
                                           
                   </apex:pageBlockSection>
             </apex:pageBlock>
      </apex:form>       
</apex:page>

User-added image
 
Hi ,

I am currently trying to redirect users to various pages based on record types and Internal user vs community users. I have the intial part working where i have redirecting based on Internal user and external user .

To do : For Internal user redirect to a VF called CC_CaseEdit for Record types A, B , C and for Record Types D,E,F take them to stanard New Page
 
public with sharing class CaseOverrideController {

    private ApexPages.StandardController stdCntrl {get; set;}
    
    private Boolean isNew;
    private Boolean isEdit;
    private Boolean isView;

    public CaseOverrideController( ApexPages.StandardController sc ) {
        
        stdCntrl = sc;
        String pageURL = ApexPages.currentpage().geturl();

        if( stdCntrl.getId() == null ){
            this.isNew = true;
        }else{

            if( pageURL.containsIgnoreCase('/e') || pageURL.containsIgnoreCase('retURL') ){
                this.isEdit = true;
            }else{
                this.isView = true;
            }
        }
    }

    public PageReference redirectPage(){
        Schema.DescribeSObjectResult result = Case.sObjectType.getDescribe();
        String caseKeyPrefix = result.getKeyPrefix();

        Map<String , String> currentPageParam = ApexPages.Currentpage().getParameters();

        PageReference pr;
        User u = [SELECT id, Contact.Account.Id FROM User WHERE Id = :UserInfo.getUserId()];
        
    if(u.Contact.Account == null){  //If Internal user

                     
                   if( this.isNew != null && this.isNew ){      // Need to add Record type conditions here 
                   pr = new PageReference('/' + caseKeyPrefix + '/e'); 
       
                   }else{  
                                 if( this.isEdit != null && this.isEdit  ){
                                 pr = new PageReference('/' + stdCntrl.getId() + '/e');      
                                 }else{
                                 pr = new PageReference('/' + stdCntrl.getId() );
                                 }
            
                    pr.getParameters().put('nooverride', '1');
                   }
        // If Customer Community User    
     }else{

                    if( this.isNew != null && this.isNew ){
                    pr = Page.CCMTY_CaseEdit;   
                    }else{
                
                                 if( [select RecordType.Name from Case where Id = :stdCntrl.getId()].RecordType.Name == 'Warranty' ){
                                 pr = Page.CCMTY_WarrantyEdit;
                                 }else{
                                           if( this.isEdit != null && this.isEdit ){
                                           pr = Page.CCMTY_CaseEdit;       
                                           }else{
                                           pr = Page.CCMTY_CaseView;
                                           }
                    
                                 }
                   }
            
            if( stdCntrl.getId() != null ){
                pr.getParameters().put('id', stdCntrl.getId());
            }
        }

        // Copy over parameters for redirect page
        if( !currentPageParam.isEmpty() ){
            pr.getParameters().putAll( currentPageParam );
            pr.getParameters().remove('save_new');
        }
        return pr;
    }
}

 
I am trying to get the latest attachment id on to the case object fields based on the Name of the document . I have 2 fields on cases ( A,X)and If an attachement is added to case with the name ABC then its Id should be filled in Filed A on case and if Attachment is added with Name XYZ then Field X on the case should be filled with the ID of XYZ. If there are mutiple attachments with the same name then we should take the latest attachment.
 
trigger CaseAttachment on Attachment (before insert) {  
   Boolean isCaseAttachment = FALSE;    
      List<Case> Cases = new List<Case>();  
        Set<Id> accIds = new Set<Id>();  
        for(Attachment att : trigger.New){  
             /*Check if uploaded attachment is related to Case Attachment and same Case is already added*/  
             if(att.ParentId.getSobjectType() == Case.SobjectType && (!accIds.contains(att.ParentId)) && att.Name.contains('XYZ')){  
                  //prepare a Case object for update  
                  Cases.add(  
                                      new Case(  
                                                          Id=att.ParentId,  
                                                         A__c= att.ID
                                              )  
                           );  
                     //add the Caseid in set to eliminate dupe updates                                     
                  accIds.add(att.ParentId);  
             }  
             
             if(att.ParentId.getSobjectType() == Case.SobjectType && (!accIds.contains(att.ParentId)) && att.Name.contains('ABC')){  
                  //prepare a Case object for update  
                  Cases.add(  
                                      new Case(  
                                                          Id=att.ParentId,  
                                                        X__c = att.ID )
                           );  
                     //add the Caseid in set to eliminate dupe updates                                     
                  accIds.add(att.ParentId);  
             }  
             
        }  
        //finally update Cases  
        update Cases;  
 }

 
Hi ,
i am tryinng to create multiple child records when a parent record is created . The records in child object should be coming from an another relaetd object . Here is my data model

Data model 1: Account (Parent)<<<<<< (Invoices)Financials__c (Child to Account)
Date Model 2 : Account (Master Parent)<<<<<<[Payment Batch] FInancial_Batch__c(Parent)<<<<<<Financial_Batch_Items__c [payment LIne items] (Child) <<<<<< Financilals__C (LookUp on Batch Items)

Use case: Customer paying for the invoices he has open [ excluding already in the process of payment ]

Example: Apple is my account and it has 20 Financials(Invoices) , now i am creating a Financial Batch ( nothing related to invoice at this time ) record and when i save this Fianancial Batch record 20 Financial Batch items should be created. One record for each Financial(Invoice) record Apple account has and the financial(Invoice) record should not be part of another Financial Batch Items .

This is what done already : Trigger finds the related number(20) invoices and creates 20 line items but missing Lookup to the orginal Invoice and not checking if it is referred in another Financial Batch/ Financial Batch Item
 
trigger CreatePaymentLineItems on Financial_Batch__c (after insert) {
          
        List<Financial_Batch_Item__c> PItem = new List<Financial_Batch_Item__c>();
        
        Set<Id> setAccountId = new Set<Id>(); // Set of Id to hold Account id's in Payment
        
        Map<Id,Financials__c> accountInvMap = new Map<Id,Financials__c>();

        
        Map<Id,Integer> mapAccountIdInvoiceCount = new Map<Id,Integer>(); // Map of Id to Integer to hold Account Id and corresponding number of Invoices
        
        for (Financial_Batch__c Pay : trigger.new) 
        {
            setAccountId.add(pay.Account__c); //Here Account__c is the relationship field in Financial_Batch__c which relates to Account
        }
      
       for(Account a : [Select Id,(Select Id ,Type__c from Financials__r where Status__c NOT IN ('Closed', 'Paid')and Financial_External_Key__c like 'Mexico%' Order by Type__c) from account where id IN: setAccountId])
        {
            mapAccountIdInvoiceCount.put(a.Id,a.Financials__r.size()); // Populate map with Account Id and corresponding list of invoice size
        }
        for (Financial_Batch__c Pay : trigger.new) 
        {
            for(Integer i=0; i<mapAccountIdInvoiceCount.get(pay.Account__c);i++)
            {
                Financial_Batch_Item__c PBI = new Financial_Batch_Item__c();
                PBI.Financial_Batch__c = Pay.Id;
                //PBI.Financials__c = accountinvMap.get(inv).id;
                PItem.add(PBI);
            }
        }
        insert PItem;
        }

Thanks
 
Hi ,

I have a VF which is populating Month from the Apex code using the system's month. And i am using this in communites( chinnese lanaguage ). My complete coomminities is in chineese except this .Any help?

Thanks,
A
Hi,

I am trying to display a date field and it always displays in US format and it is causing an issue . Any insight please on this 
 
<apex:column styleClass="product_info_col">
                                   
                                        <span><a href="javascript:void(0)" 
                                            onclick="openProductDetailModal('{!$Site.Prefix}/apex/CCMTY_OrderProductDetailModal?id={!orderItem.PricebookEntry.Product2Id}&pricebookEntryId={!orderItem.PricebookEntryId}');">
                                            {!orderItem.PricebookEntry.Product2.Name}
                                            </a>
                                        </span>

                                     <span>{!$Label.CCMTY_OrderEntry_HeaderLabel_UnitPrice}: {!orderItem.unitPrice}</span>       

                                   <span>{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedShipDate}:&nbsp;
                                   <apex:outputText value="{0,date,Long}">
                                   <apex:param value="{!orderItem.Estimated_Ship_Date__c}" /> 
                                   </apex:outputText></span>
                                   
                                   <span>{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedDeliveryDate}:&nbsp;
                                   <apex:outputText value="{0,date,Long}">
                                   <apex:param value="{!orderItem.Order_Line_Estimated_Delivery_Date__c}" /> 
                                   </apex:outputText></span>
                                                            
                        <!--     <Apex:outputlabel value="{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedDeliveryDate}" style="white-space:pre;"  escape="true"/> 
                                    <apex:outputField label="{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedDeliveryDate}" value="{!orderItem.Order_Line_Estimated_Delivery_Date__c}"  /> -->
                                 </apex:column>

Thanks 
G
HI ,

I am having a small issue with Coverage on a class , little help please . I am using this code to auto add users to public group

Here is the code
 
trigger Add2Publicgroup on User (after insert) {
   AddUser2CommunityPublicGroup.AddToGroups(trigger.newMap.keySet());

}
public class AddUser2CommunityPublicGroup{

@future
public static void AddToGroups(Set<Id> userIds)
{
 //Get the groups that the user should be added to
Group g=[select Id,Name from Group Where Name='Community Users '];

 List<User> users=[Select Id,Name from user Where Id IN :userIds and (Profileid = '00eM0000000Dyrp')];
 
 List<GroupMember>listGroupMember =new List<GroupMember>();  
 // loop the users that have been created
 for (User user : users){
      GroupMember gm= new GroupMember();   // These are the lines that need coverage 
      gm.GroupId=g.id;
      gm.UserOrGroupId = user.id;
      listGroupMember.add(gm);   
 } 
 insert listGroupMember;
}
}
 
@isTest
private class TestAddUser2CommunityPublicGroup {
static testMethod void TestAddUser2CommunityPublicGroup (){
        Profile profile = [select Id from Profile where name = 'Standard User'];
        
        
        List<User> userList = new List<User>{};
        
            for(Integer i = 0; i < 200; i++){
                User u = new User (FirstName = 'Joe' + i);
                          u.LastName = 'Smith' + i;
                          u.Email = 'joe.smith@xxi.com' + i;
                          u.EmailEncodingKey = 'UTF-8';
                          u.LanguageLocaleKey = 'en_US';
                          u.LocaleSidKey = 'en_US';
                          u.CommunityNickname = 'Jjsmith' + i;
                          u.TimeZoneSidKey = 'America/Los_Angeles';
                          u.ProfileId= profile.Id;
                          u.Alias = 'Jsmith';
                          u.Username = 'jjsmith@constantcontact.com' + i;
                          u.CompanyName = 'xxxI';           
                         
                userList.add(u);
            }                       

        test.startTest();        
        insert userList;        
        test.stopTest();

        List<CollaborationGroupMember> cgm = [SELECT id FROM CollaborationGroupMember 
                                                WHERE CollaborationGroup.Name='Community Users'  AND MemberId IN : userList];
            for (CollaborationGroupMember m: cgm ){
                System.assertequals(200,cgm.size());

            }

    }
    }


GroupMember gm= new GroupMember(); 
      gm.GroupId=g.id;
      gm.UserOrGroupId = user.id;
      listGroupMember.add(gm);   

 These are the lines that need coverage .


Thanks 
G
HI ,

I am deploying some code from sandbox which was developed by another developer. I deopled everything and one visual force page is not working and it gives me an error saying Page error occured while loading page . And this same page works in my sandbox and both the codes are exact same . Am wondering if i missed anything while deployment .

Here is peice of code which needs to work for Opening up the Visual force page.
 
<span><a href="javascript:void(0)" 
                                            onclick="openProductDetailModal('{!$Site.Prefix}/apex/CCMTY_OrderProductDetailModal?id={!orderItem.PricebookEntry.Product2Id}&pricebookEntryId={!orderItem.PricebookEntryId}');">
                                            {!orderItem.PricebookEntry.Product2.Name}
                                            </a>
                                        </span>


function openProductDetailModal(url){
        $("#productDetailModal .modal-body").html('<iframe width="100%" height="750" id="upload_file" frameborder="0" scrolling="no" allowtransparency="true" src="'+url+'"></iframe>');
        $('#productDetailModal').modal('show');
    }

Exact same code in both sandboxes and checked profile permissions and object permissions . everything exactly same . Any insight please 


Thanks 
G

Hi I need little bit help for Test My TaskListview Controller

 

public class TaskListViewController { 
     
    public String objectId {get; set;}
    public Integer numLeft {get; set;}
    public Integer total {get; set;}    
    private Integer startNdx = 0;
    private static Integer PAGESIZE = 8;
    private List<Task> fullTaskList = new List<Task>();
    private List<Task> displayedTaskList = new List<Task>();
    
    
    public TaskListViewController() {

    }
    
    public PageReference refreshPage() {
        return null;
    }
   
    public List<Task> getTasks() {
        String ownerId = UserInfo.getUserId();
        if (fullTaskList.isEmpty())
        {
            fullTaskList = [SELECT Id, WhatId, WhoId, ActivityDate, subject,Activity_Type__c ,status, priority, Description,  ReminderDateTime, IsReminderSet,isClosed 
                            FROM Task 
                            WHERE isClosed = false 
                            AND OwnerId = :ownerId];
            numLeft = fullTaskList.size();
            total = numLeft;
            if(numLeft <> 0)
                this.objectId = ((Task) fullTaskList[0]).id;
         }
        
        displayedTaskList.clear();
        if(numLeft <> 0)
        {
        Integer endNdx = startNdx + PAGESIZE;
        if (endNdx > total)
            endNdx = total;
            
        for (Integer i=startNdx; i<endNdx; i++)
            displayedTaskList.add(fullTaskList.get(i));
         }           
        return displayedTaskList;
    }
 
    private void updateTaskStatus() {
        System.debug('before : ' + fullTaskList);
        Integer i = 0;
        for (i=0; i<fullTaskList.size(); i++) {
            Task t = fullTaskList.get(i);
            if (this.objectId.equals(t.id)) {
                System.debug('updating status of ' + t);                                
                Task tmp = [SELECT Id, WhatId, WhoId, ActivityDate, subject, status, priority, Description, ReminderDateTime, IsReminderSet, isClosed 
                            FROM Task 
                            WHERE id = :t.id];
                fullTaskList.set(i, tmp);
                System.debug('updated to ' + tmp);
                //this.updatedItemStatus = tmp.status;
                break;
            }
        }
        
        System.debug('after : ' + fullTaskList);               
    }
    
    private void nextTask() {
        for (Task t : fullTaskList) {
            if (!t.isClosed) {
                System.debug('found non-closed object with id ' + t.id);
                this.objectId = t.id;
                break;
            }
        }
    }
  

    public void previous() {
        startNdx -= PAGESIZE;
    }
    
    public void next() {
        startNdx += PAGESIZE;
    }    
    
    public void refreshNumbers() {
        updateTaskStatus();
        nextTask();
        this.numLeft = 0;
        for (Task t : fullTaskList) {
            if (!t.isClosed) {
                this.numLeft++;
            }
        }        
      }
    
    public Boolean getHasNext() {
        return total > (startNdx + PAGESIZE);
    }
    
    public Boolean getHasPrevious() {
        return startNdx > 0;
    }    

    public Integer getNum() {
        return total;
    } 
    public PageReference Cancel() {
    PageReference Activitiespage = Page.Activities;
           Activitiespage.setRedirect(true);
           return Activitiespage;
        return null;
    }
    public PageReference save(){       
        for (Task t : fullTaskList) {
           update t;
           PageReference Activitiespage = Page.Activities;
           Activitiespage.setRedirect(true);
           return Activitiespage;
        }
        return null;    
    }
    }

 

@isTest
 Private Class TestTaskListViewController{
 
 static testMethod void testTaskListViewController() {
                
        TaskListViewController t = new TaskListViewController();        
        t.getTasks();    
        t.refreshPage();
        t.previous();
        t.next();
        t.refreshNumbers();
        t.getHasNext();
        t.getHasPrevious();
        t.save();
        t.getNum();
        t.Cancel();
        
                             
    }   
 }

 Getting Around 68% Coverage.

 

I am thinking that if i create a other task and update the status i think my update thing will cover, how would i cover previuos and next page and the page refrence.

 

Thanks

 

We have 7 Communities in our Org. 4 Communities with  Visual Force+Tabs template and 3 Communities on Custome Service Template(Lighting).

Our Company Custom domain is www.abc.com 

Currently, our Community URL's are set up under the Custom domain. We did all the CName , DNS etc.. all the stuff that is required to have our own branded URL's.

https://Community1.AxxBxxCxx.com
https://Community2.AxxBxxCxx.com
https://Community3.AxxBxxCxx.com
https://Community4.AxxBxxCxx.com
https://Community5.AxxBxxCxx.com
​​​​​​https://Community6.com
https://ABC.force.com/Community7

Question:
As we keep adding more communities to our Org we would like to have one URL for all the communities something like www.ourcompany.communities.com
The idea is when a user enters through this URL we take them to a login page and then based on the credentials they provide we take them to the appropriate community.
Is this possible? And if it is possible would it be a problem with having different community templates.

Thanks,
Goutham. 
Hi,

I have 7 Record Types on Cases and 2 of those record types have to take the user to a Visual force page along with the recordtype selected and the rest of the 5 record types should take the user to a standard case page .
 
public with sharing class CaseOverrideController {

    private ApexPages.StandardController stdCntrl {get; set;}
    
    private Boolean isNew;
    private Boolean isEdit;
    private Boolean isView;

    public CaseOverrideController( ApexPages.StandardController sc ) {
        
        stdCntrl = sc;
        String pageURL = ApexPages.currentpage().geturl();

        if( stdCntrl.getId() == null ){
            this.isNew = true;
        }else{

            if( pageURL.containsIgnoreCase('/e') || pageURL.containsIgnoreCase('retURL') ){
                this.isEdit = true;
            }else{
                this.isView = true;
            }
        }
    }

    public PageReference redirectPage(){
        Schema.DescribeSObjectResult result = Case.sObjectType.getDescribe();
        String caseKeyPrefix = result.getKeyPrefix();

        Map<String , String> currentPageParam = ApexPages.Currentpage().getParameters();

        PageReference pr;
       

            if( this.isNew != null && this.isNew ){
                pr = new PageReference('/' + caseKeyPrefix + '/e'); 
   
            }else{
                
                if( [select RecordType.Name from Case where Id = :stdCntrl.getId()].RecordType.Name == 'Core Collection' ){
                    pr = Page.CC_CaseEdit;
                }else{
                    if( this.isEdit != null && this.isEdit ){
                        pr = Page.CC_CaseEdit;       
                    }else{
                        pr = new PageReference('/' + stdCntrl.getId() );
                    }
                }
            }
            
            if( stdCntrl.getId() != null ){
                pr.getParameters().put('id', stdCntrl.getId());
            }
        

        // Copy over parameters for redirect page
        if( !currentPageParam.isEmpty() ){
            pr.getParameters().putAll( currentPageParam );
            pr.getParameters().remove('save_new');
        }
        return pr;
    }
}
<apex:page showHeader="true" sidebar="true" StandardController="Case" extensions="CaseOverrideController" action="{!redirectPage}" />
I have got it to working a little bit but the If conditions are not right and does not satisy what i am trying to do. And for some reason my standard page keeps loading and never finish loading.

Tried so manby solutions and the pb with all other solutions is record type not setting on the Visual force page which this code does. Any help please

 
I have a Override page for Case , Which redirects to a Visual force page if a certain record type is selected and if not it redirects to a standard page. This is working perfectly for redireting to the necessary page . Howewer when  it is directed to the visual force page the record type which was selected is not passed to the visual force page and it is causing issues with the Picklist values based on the record type. Visual force page always shows the default record type instead of the selected record type.

Here is my override page 
 
<apex:page standardController="Case" extensions="caseRedirect" tabStyle="Case" showheader="true" action="{!redirect}" />
public with sharing class caseRedirect {

private ApexPages.StandardController controller;
public String retURL {get; set;}
public String Type {get; set;}
public String saveNewURL {get; set;}
public String rType {get; set;}
public String cancelURL {get; set;}
public String ent {get; set;}
public String confirmationToken {get; set;}
public String accountID {get; set;}
public String contactID {get; set;}

public caseRedirect(ApexPages.StandardController controller) {

    this.controller = controller;

    retURL = ApexPages.currentPage().getParameters().get('retURL');
    rType = ApexPages.currentPage().getParameters().get('RecordType');
    cancelURL = ApexPages.currentPage().getParameters().get('cancelURL');
    ent = ApexPages.currentPage().getParameters().get('ent');
    confirmationToken = ApexPages.currentPage().getParameters().get('_CONFIRMATIONTOKEN');
    saveNewURL = ApexPages.currentPage().getParameters().get('save_new_url');
    accountID = ApexPages.currentPage().getParameters().get('def_account_id');
    contactID = ApexPages.currentPage().getParameters().get('def_contact_id');

}

public PageReference redirect() {

    PageReference returnURL;

    // Redirect if Record Type corresponds to custom VisualForce page

    IF(rType == '012180000000DjD') {

        returnURL = new PageReference('/apex/CC_CaseEdit?Recordtype=012180000000DjD');

    }
  
    ELSE {

       returnURL = new PageReference('/500/e');

    }

    returnURL.getParameters().put('retURL', retURL);
    returnURL.getParameters().put('RecordType', rType);
    returnURL.getParameters().put('cancelURL', cancelURL);
    returnURL.getParameters().put('ent', ent);
    returnURL.getParameters().put('_CONFIRMATIONTOKEN', confirmationToken);
    returnURL.getParameters().put('save_new_url', saveNewURL);
    returnURL.getParameters().put('nooverride', '1');

    IF (accountID != null){

        returnURL.getParameters().put('def_account_id', accountID);

    }

    IF (contactID != null){

        returnURL.getParameters().put('def_contact_id', contactID);

    }

    returnURL.setRedirect(true);
    return returnURL;

}

}
When VF opens up the record type is always default record type instead of the record type i selected .What am i missing

Thanks 

 
Hi All,

I have a situation where i need to insert 2 fields from account and the few fields from contact(related to account) to a custom object . Is it possible using triggers?
 
Hi ,

I have a VF which is populating Month from the Apex code using the system's month. And i am using this in communites( chinnese lanaguage ). My complete coomminities is in chineese except this .Any help?

Thanks,
A
Hi,

I am trying to display a date field and it always displays in US format and it is causing an issue . Any insight please on this 
 
<apex:column styleClass="product_info_col">
                                   
                                        <span><a href="javascript:void(0)" 
                                            onclick="openProductDetailModal('{!$Site.Prefix}/apex/CCMTY_OrderProductDetailModal?id={!orderItem.PricebookEntry.Product2Id}&pricebookEntryId={!orderItem.PricebookEntryId}');">
                                            {!orderItem.PricebookEntry.Product2.Name}
                                            </a>
                                        </span>

                                     <span>{!$Label.CCMTY_OrderEntry_HeaderLabel_UnitPrice}: {!orderItem.unitPrice}</span>       

                                   <span>{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedShipDate}:&nbsp;
                                   <apex:outputText value="{0,date,Long}">
                                   <apex:param value="{!orderItem.Estimated_Ship_Date__c}" /> 
                                   </apex:outputText></span>
                                   
                                   <span>{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedDeliveryDate}:&nbsp;
                                   <apex:outputText value="{0,date,Long}">
                                   <apex:param value="{!orderItem.Order_Line_Estimated_Delivery_Date__c}" /> 
                                   </apex:outputText></span>
                                                            
                        <!--     <Apex:outputlabel value="{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedDeliveryDate}" style="white-space:pre;"  escape="true"/> 
                                    <apex:outputField label="{!$Label.CCMTY_OrderEntry_HeaderLabel_EstimatedDeliveryDate}" value="{!orderItem.Order_Line_Estimated_Delivery_Date__c}"  /> -->
                                 </apex:column>

Thanks 
G
HI ,

I am deploying some code from sandbox which was developed by another developer. I deopled everything and one visual force page is not working and it gives me an error saying Page error occured while loading page . And this same page works in my sandbox and both the codes are exact same . Am wondering if i missed anything while deployment .

Here is peice of code which needs to work for Opening up the Visual force page.
 
<span><a href="javascript:void(0)" 
                                            onclick="openProductDetailModal('{!$Site.Prefix}/apex/CCMTY_OrderProductDetailModal?id={!orderItem.PricebookEntry.Product2Id}&pricebookEntryId={!orderItem.PricebookEntryId}');">
                                            {!orderItem.PricebookEntry.Product2.Name}
                                            </a>
                                        </span>


function openProductDetailModal(url){
        $("#productDetailModal .modal-body").html('<iframe width="100%" height="750" id="upload_file" frameborder="0" scrolling="no" allowtransparency="true" src="'+url+'"></iframe>');
        $('#productDetailModal').modal('show');
    }

Exact same code in both sandboxes and checked profile permissions and object permissions . everything exactly same . Any insight please 


Thanks 
G
Need to route the user to a visualforce page for creating multiple child records on save of parent record.

Summary
  • Three objects involved: Opportunity, Demographic, and Quota. 
  • One Opportunity has Many Demographics
  • One Demographic has Many Quotas
  • I've created a visualforce page where I add many Quotas to the Demographic at once. Currently this is launched from a custom button on the Demographic Detail Page.
    • Page Name = addQuotas
    • Page has a standard "add row"/"delete row" function to create a Quota record each row from custom controller
    • I pass multipe details from the parent Demographic onto each Quota row through an extension
  • I've created a visualforce page to override the standard new/edit Demographic layout so I can build a custom save button to route to the addQuotas page.
    • Page Name = addDemographic, uses a standard controller, no extensions at the moment
Question
What I want to have happen is when saving the Demographic, the user is immediately taken to the addQuotas page as if they had clicked the button on the detail page. I'm having difficulty making any of this work, trying custom buttons from the Opportunity and hacking the SaveURL, and I'm just not having luck saving the Demographic, grabbing the Id of that Demographic, and then going to the addQuotas page with that Demographic Id in tow. 

What do I add to the Save action on the addDemographic visualforce page to then route to the addQuotas page for THAT Demographic?

Basically, I want on Save of Demographic to automatically go here: /apex/addQuotas?id={!Demographic__c.Id}&retURL={!Demographic__c.Id}

Code and Pictures:
addDemographic page
<apex:page standardController="Demographic__c" tabStyle="Demographic__c">
     <apex:sectionHeader title="Edit Demographic" subtitle="New Demographic"/>
        <apex:form >
                <apex:pageBlock title="Edit Demograhic" mode="edit">
                    <apex:pageblockButtons >
                        <apex:commandButton action="{!save}" value="Add Quotas"/>
                    </apex:pageblockButtons>
                    <apex:pageblockSection title="Demographic Information" columns="1">
                        <apex:inputfield value="{!Demographic__c.Opportunity__c}"/>
                        <apex:inputfield value="{!Demographic__c.Qualification__c}"/>
                    </apex:pageblockSection> 
                </apex:pageBlock>
        </apex:form>

</apex:page>

addQuotas page:
<apex:page standardController="Demographic__c"
            extensions="EditableQuotaListExtension"
            showHeader="true" 
            sidebar="false"
            title="Edit Quota">
    <apex:form >
    <apex:pageMessages id="messages"/>
    <apex:pageBlock title="Edit Quotas">
      <apex:pageBlockButtons >
        <apex:commandButton value="Cancel" action="{!cancel}" />
        <apex:commandButton value="Save" action="{!save}"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection title="Demographic Information" collapsible="false">
      <apex:outputLink value="/{!Demographic__c.Id}" target="_blank">{!Demographic__c.Name}</apex:outputLink>
        <apex:pageBlockSectionItem >
          <apex:outputText value="{!Demographic__c.QualificationName__c}" />
          <apex:outputText value="{!Demographic__c.Qualification_Text__c}" />
        </apex:pageBlockSectionItem>
      </apex:pageBlockSection>
      <apex:pageBlockSection id="childList" columns="1" title="Quotas" collapsible="false">
        <apex:variable var="rowNum" value="{!ZERO}" />
        <apex:outputLabel value="No Quotas currently exist. Click below to Add." rendered="{!NOT(hasChildren)}"/>
        <apex:pageBlockTable value="{!children}" var="quota" rendered="{!hasChildren}">
        <apex:column headerValue="Condition">
          <apex:inputField value="{!quota.Condition__c}"/>
        </apex:column>
        <apex:column headerValue="Option">
          <apex:inputField value="{!quota.Condition_Option__c}"/>
        </apex:column>
        <apex:column headerValue="Description">
          <apex:inputField value="{!quota.Description__c}"/>
        </apex:column>
        <apex:column headerValue="Quota Amount">
          <apex:inputField value="{!quota.Quota_Amount__c}" />
        </apex:column>        
        <apex:column headerValue="%/#">
          <apex:inputField value="{!quota.Quota_Calculation_Type__c}"/>
        </apex:column>
        <apex:column headerValue="Demographic">
          <apex:inputField value="{!quota.Demographic__c}"/>
        </apex:column>
        <apex:column headerValue="Qualification">
          <apex:inputField value="{!quota.Qualification__c}"/>
        </apex:column>
          <apex:column headerValue=" ">
            <!-- This is the second half of the trick to keep track
                  of your row index for deletion. -->
            <apex:variable var="rowNum" value="{!rowNum + 1}" />
            <apex:commandLink value="Delete" action="{!removeFromList}" rerender="childList, messages" immediate="true">
              <apex:param name="removeIndex" assignTo="{!removeIndex}" value="{!rowNum}" />
            </apex:commandLink>
          </apex:column>
        </apex:pageBlockTable>
        <apex:commandButton value="Add Quota" action="{!addToList}" rerender="childList, messages" immediate="true" />
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

addQuotas Extenstion (grabbing details from Demographic parent):
public with sharing class EditableQuotaListExtension extends EditableQuotaList
{


 public Demographic__c mydemo {get; private set;}

  public EditableQuotaListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,
                              Name,
                                Qualification__r.Name
                            FROM Demographic__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Condition__c,
                          Description__c,
                          Quota_Amount__c,
                          Quota_Calculation_Type__c,
                          Condition_Option__c,
                          Qualification__c,
                          Demographic__c
                      FROM Quota__c
                      WHERE Demographic__c =: mysObject.Id];
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  public List<Quota__c> getChildren()
  {
    return (List<Quota__c>)childList;
  }


  public override sObject initChildRecord()
  {
    Quota__c child = new Quota__c();
    child.Demographic__c = mydemo.Id;
    child.Qualification__c = mydemo.Qualification__c;
    child.Quota_Amount__c = 100;
    child.Quota_Calculation_Type__c = '%';
    
    return child;
  }
}

View of the addQuotas page so you get the idea of the page:
User-added image


Thank you in advance!!

 

Hi I need little bit help for Test My TaskListview Controller

 

public class TaskListViewController { 
     
    public String objectId {get; set;}
    public Integer numLeft {get; set;}
    public Integer total {get; set;}    
    private Integer startNdx = 0;
    private static Integer PAGESIZE = 8;
    private List<Task> fullTaskList = new List<Task>();
    private List<Task> displayedTaskList = new List<Task>();
    
    
    public TaskListViewController() {

    }
    
    public PageReference refreshPage() {
        return null;
    }
   
    public List<Task> getTasks() {
        String ownerId = UserInfo.getUserId();
        if (fullTaskList.isEmpty())
        {
            fullTaskList = [SELECT Id, WhatId, WhoId, ActivityDate, subject,Activity_Type__c ,status, priority, Description,  ReminderDateTime, IsReminderSet,isClosed 
                            FROM Task 
                            WHERE isClosed = false 
                            AND OwnerId = :ownerId];
            numLeft = fullTaskList.size();
            total = numLeft;
            if(numLeft <> 0)
                this.objectId = ((Task) fullTaskList[0]).id;
         }
        
        displayedTaskList.clear();
        if(numLeft <> 0)
        {
        Integer endNdx = startNdx + PAGESIZE;
        if (endNdx > total)
            endNdx = total;
            
        for (Integer i=startNdx; i<endNdx; i++)
            displayedTaskList.add(fullTaskList.get(i));
         }           
        return displayedTaskList;
    }
 
    private void updateTaskStatus() {
        System.debug('before : ' + fullTaskList);
        Integer i = 0;
        for (i=0; i<fullTaskList.size(); i++) {
            Task t = fullTaskList.get(i);
            if (this.objectId.equals(t.id)) {
                System.debug('updating status of ' + t);                                
                Task tmp = [SELECT Id, WhatId, WhoId, ActivityDate, subject, status, priority, Description, ReminderDateTime, IsReminderSet, isClosed 
                            FROM Task 
                            WHERE id = :t.id];
                fullTaskList.set(i, tmp);
                System.debug('updated to ' + tmp);
                //this.updatedItemStatus = tmp.status;
                break;
            }
        }
        
        System.debug('after : ' + fullTaskList);               
    }
    
    private void nextTask() {
        for (Task t : fullTaskList) {
            if (!t.isClosed) {
                System.debug('found non-closed object with id ' + t.id);
                this.objectId = t.id;
                break;
            }
        }
    }
  

    public void previous() {
        startNdx -= PAGESIZE;
    }
    
    public void next() {
        startNdx += PAGESIZE;
    }    
    
    public void refreshNumbers() {
        updateTaskStatus();
        nextTask();
        this.numLeft = 0;
        for (Task t : fullTaskList) {
            if (!t.isClosed) {
                this.numLeft++;
            }
        }        
      }
    
    public Boolean getHasNext() {
        return total > (startNdx + PAGESIZE);
    }
    
    public Boolean getHasPrevious() {
        return startNdx > 0;
    }    

    public Integer getNum() {
        return total;
    } 
    public PageReference Cancel() {
    PageReference Activitiespage = Page.Activities;
           Activitiespage.setRedirect(true);
           return Activitiespage;
        return null;
    }
    public PageReference save(){       
        for (Task t : fullTaskList) {
           update t;
           PageReference Activitiespage = Page.Activities;
           Activitiespage.setRedirect(true);
           return Activitiespage;
        }
        return null;    
    }
    }

 

@isTest
 Private Class TestTaskListViewController{
 
 static testMethod void testTaskListViewController() {
                
        TaskListViewController t = new TaskListViewController();        
        t.getTasks();    
        t.refreshPage();
        t.previous();
        t.next();
        t.refreshNumbers();
        t.getHasNext();
        t.getHasPrevious();
        t.save();
        t.getNum();
        t.Cancel();
        
                             
    }   
 }

 Getting Around 68% Coverage.

 

I am thinking that if i create a other task and update the status i think my update thing will cover, how would i cover previuos and next page and the page refrence.

 

Thanks

 

Need to route the user to a visualforce page for creating multiple child records on save of parent record.

Summary
  • Three objects involved: Opportunity, Demographic, and Quota. 
  • One Opportunity has Many Demographics
  • One Demographic has Many Quotas
  • I've created a visualforce page where I add many Quotas to the Demographic at once. Currently this is launched from a custom button on the Demographic Detail Page.
    • Page Name = addQuotas
    • Page has a standard "add row"/"delete row" function to create a Quota record each row from custom controller
    • I pass multipe details from the parent Demographic onto each Quota row through an extension
  • I've created a visualforce page to override the standard new/edit Demographic layout so I can build a custom save button to route to the addQuotas page.
    • Page Name = addDemographic, uses a standard controller, no extensions at the moment
Question
What I want to have happen is when saving the Demographic, the user is immediately taken to the addQuotas page as if they had clicked the button on the detail page. I'm having difficulty making any of this work, trying custom buttons from the Opportunity and hacking the SaveURL, and I'm just not having luck saving the Demographic, grabbing the Id of that Demographic, and then going to the addQuotas page with that Demographic Id in tow. 

What do I add to the Save action on the addDemographic visualforce page to then route to the addQuotas page for THAT Demographic?

Basically, I want on Save of Demographic to automatically go here: /apex/addQuotas?id={!Demographic__c.Id}&retURL={!Demographic__c.Id}

Code and Pictures:
addDemographic page
<apex:page standardController="Demographic__c" tabStyle="Demographic__c">
     <apex:sectionHeader title="Edit Demographic" subtitle="New Demographic"/>
        <apex:form >
                <apex:pageBlock title="Edit Demograhic" mode="edit">
                    <apex:pageblockButtons >
                        <apex:commandButton action="{!save}" value="Add Quotas"/>
                    </apex:pageblockButtons>
                    <apex:pageblockSection title="Demographic Information" columns="1">
                        <apex:inputfield value="{!Demographic__c.Opportunity__c}"/>
                        <apex:inputfield value="{!Demographic__c.Qualification__c}"/>
                    </apex:pageblockSection> 
                </apex:pageBlock>
        </apex:form>

</apex:page>

addQuotas page:
<apex:page standardController="Demographic__c"
            extensions="EditableQuotaListExtension"
            showHeader="true" 
            sidebar="false"
            title="Edit Quota">
    <apex:form >
    <apex:pageMessages id="messages"/>
    <apex:pageBlock title="Edit Quotas">
      <apex:pageBlockButtons >
        <apex:commandButton value="Cancel" action="{!cancel}" />
        <apex:commandButton value="Save" action="{!save}"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection title="Demographic Information" collapsible="false">
      <apex:outputLink value="/{!Demographic__c.Id}" target="_blank">{!Demographic__c.Name}</apex:outputLink>
        <apex:pageBlockSectionItem >
          <apex:outputText value="{!Demographic__c.QualificationName__c}" />
          <apex:outputText value="{!Demographic__c.Qualification_Text__c}" />
        </apex:pageBlockSectionItem>
      </apex:pageBlockSection>
      <apex:pageBlockSection id="childList" columns="1" title="Quotas" collapsible="false">
        <apex:variable var="rowNum" value="{!ZERO}" />
        <apex:outputLabel value="No Quotas currently exist. Click below to Add." rendered="{!NOT(hasChildren)}"/>
        <apex:pageBlockTable value="{!children}" var="quota" rendered="{!hasChildren}">
        <apex:column headerValue="Condition">
          <apex:inputField value="{!quota.Condition__c}"/>
        </apex:column>
        <apex:column headerValue="Option">
          <apex:inputField value="{!quota.Condition_Option__c}"/>
        </apex:column>
        <apex:column headerValue="Description">
          <apex:inputField value="{!quota.Description__c}"/>
        </apex:column>
        <apex:column headerValue="Quota Amount">
          <apex:inputField value="{!quota.Quota_Amount__c}" />
        </apex:column>        
        <apex:column headerValue="%/#">
          <apex:inputField value="{!quota.Quota_Calculation_Type__c}"/>
        </apex:column>
        <apex:column headerValue="Demographic">
          <apex:inputField value="{!quota.Demographic__c}"/>
        </apex:column>
        <apex:column headerValue="Qualification">
          <apex:inputField value="{!quota.Qualification__c}"/>
        </apex:column>
          <apex:column headerValue=" ">
            <!-- This is the second half of the trick to keep track
                  of your row index for deletion. -->
            <apex:variable var="rowNum" value="{!rowNum + 1}" />
            <apex:commandLink value="Delete" action="{!removeFromList}" rerender="childList, messages" immediate="true">
              <apex:param name="removeIndex" assignTo="{!removeIndex}" value="{!rowNum}" />
            </apex:commandLink>
          </apex:column>
        </apex:pageBlockTable>
        <apex:commandButton value="Add Quota" action="{!addToList}" rerender="childList, messages" immediate="true" />
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
</apex:page>

addQuotas Extenstion (grabbing details from Demographic parent):
public with sharing class EditableQuotaListExtension extends EditableQuotaList
{


 public Demographic__c mydemo {get; private set;}

  public EditableQuotaListExtension(ApexPages.StandardController stdController) 
  {
    super(stdController);

    this.mydemo = [SELECT Id,
                              Name,
                                Qualification__r.Name
                            FROM Demographic__c
                            WHERE Id =: stdController.getRecord().Id];
    
    this.childList = [SELECT Id,
                          Condition__c,
                          Description__c,
                          Quota_Amount__c,
                          Quota_Calculation_Type__c,
                          Condition_Option__c,
                          Qualification__c,
                          Demographic__c
                      FROM Quota__c
                      WHERE Demographic__c =: mysObject.Id];
  }

  /*
   * This method is necessary for reference on the Visualforce page, 
   * in order to reference non-standard fields.
   */
  public List<Quota__c> getChildren()
  {
    return (List<Quota__c>)childList;
  }


  public override sObject initChildRecord()
  {
    Quota__c child = new Quota__c();
    child.Demographic__c = mydemo.Id;
    child.Qualification__c = mydemo.Qualification__c;
    child.Quota_Amount__c = 100;
    child.Quota_Calculation_Type__c = '%';
    
    return child;
  }
}

View of the addQuotas page so you get the idea of the page:
User-added image


Thank you in advance!!