function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jim MontgomeryJim Montgomery 

add selected items to case related list

I have this controller<

public class AIRList {   
    public ApexPages.StandardSetController setAIR {
            get {
            if(setAIR == null) {
String accountID = System.currentPageReference().getParameters().get('accountID');
String caseID = System.currentPagereference().getParameters().get('caseID');
                setAIR = new ApexPages.StandardSetController(Database.getQueryLocator(
                    [SELECT id,Name, product_name__c,quantity__c,pfx_account_number__c FROM ams_inventory_rollup__c where accountID__c = :accountId]));

            }
            return setAIR;
        }
        set;
    }
        public List<AMS_Inventory_Rollup__c> getAMSInventories() {
        return (List<AMS_Inventory_Rollup__c>) setAIR.getRecords();
    }
}
That populates this VF page, 

<apex:page controller="AIRList"> <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!AMSInventories}" var="a"> <apex:column > <apex:inputCheckbox /> </apex:column> <apex:column value="{!a.Name}"/> <apex:column value="{!a.Product_Name__c}"/> <apex:column value="{!a.Quantity__c}"/> <apex:column value="{!a.PFX_Account_Number__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

I need to take the selected items form the page, and add them to a case related object/List. Case_cancelled_Inventories that is the child in a masetr/detail relationship to case.
PrabhaPrabha
You can get the selected records by calling "setAIR.getSelected()"

http://www.infallibletechie.com/2014/03/how-to-get-selected-records-from-list.html

Let me know if that works.

PrabhaN