• NANCY1
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 32
    Questions
  • 56
    Replies

Hi All,

 

 

On the Proposal__c object page i have two lookup fields.. one for Resource_Requirement__c object and another for  RR__c object. while creating the new proposal as i'll select the value for Resource_Requirement__c object.. using the lookup field..i should be able to view all the RR__c records related to selected value of Resource_Requirement__c on the visualforce page.... 

 

 

public class AllRRs
{
    private Resource_Requirement__c rrdetail;
    public List<RR__c> propdetail;
       
    public AllRRs(ApexPages.StandardController controller)
    {
        rrdetail=(Resource_Requirement__c)controller.getre​cord();
        propdetail = new List<RR__c>();
        RR__c rrlist = new RR__c();
        rrlist.RRF__c = rrdetail.id;
        propdetail.add(rrlist);                        
    }
   
    public RR__c[] getCaseRecords()
    {
        RR__c[] rrdetail = [select id,name,gPAC__c,RRF__c,Long_Term_Resource_Location​__c,Priority__c,Required_Skill__c,RR_Status__c,RM_​Phase__c from RR__c where RRF__c =:rrdetail.id];
        return rrdetail;
    }
}

Hi,

 

I need to create the visualforce page that should display all the records based on the lookup field value selected. Please guide me.

 

 

Thanks

Hi,

 

I need to create the visualforce page that should display all the records based on the lookup field value selected. Plese guide me.

 

 

Thanks

Hi,

 

I have a lookup field on RR__c and Proposal__c for another object Employee__c. Based on the field value in Proposal object i need to update the RR__c record. I am using the following code..which is throwing an error

Too many SOQL queries: 101

 

trigger updateEmpinRR on Proposal__c (after insert,after update)
{

        List < Id > rrIds = new List < Id >();
        List < Id > proposalIds = new List < Id >();
        for ( Proposal__c  c: Trigger.New )
        {
            proposalIds.add( c.Id );
            rrIds.add(c.Proposal_RR__c);
        }
        List<RR__c> opps = [select id, Selected_Employee__c from RR__c where id in :rrIds];
        Map < Id ,RR__c > empmap = new Map < Id , RR__c >();
        for ( RR__c  a : opps   )
        {
            empmap.put( a.Id, a);
        }
        List < RR__c > EmpToUpdate = new List < RR__c >();
        for(Proposal__c c: Trigger.New)
        {
            RR__c ac = empmap.get( c.Proposal_RR__c);        
            if ( ac == null )
            {   
                  continue;
            }
            If (c.Status__c == 'Selected-New')
            {
               ac.Selected_Employee__c = c.RMG_Employee_Code__c;   
               EmpToUpdate.add( ac );
            }
            else
            {
              ac.Selected_Employee__c = null;   
              EmpToUpdate.add( ac );
            }
     
                     
            
                        
        }
        upsert EmpToUpdate;     
}

Hi All,

 

Sorry to mark it urgent, as i need to implement this soon...

 

I have a custom object with Master detail Relationship, now i want to make this field as lookp field (reason: i may not have the master record each time for the detail record). Please let me know the way of converting the master field to Lookup, or any other Data Type.

 

or else, is there any way to to mark the Master Detail field as non-mandatory on the detail objects page layout

 

Please let me know..

 

Thanks

 

 

 

 

 

Hi,

 

I have a master detail relationship between Opportunity( as master) and Custom object (as detail).

 

I want to update all the detail records, if i change / update any detail record. I mean all the detail records should contain same value. If i am changing any record, that should get changed other detail records as well..

 

trigger updateallRequisitions on Opportunity (after update) {
    List < Id > OppsIds = new List < Id >();
    List < Id > RRIds = new List < Id >();
    for(Opportunity rem: Trigger.New) {    
        if(rem.test__c != 'Closed'){    
           List<RR__c> proObj = [select p.Id,p.Bill_Rate__c from RR__c p where p.Opportunity__c =:rem.Id];
           if(proObj.size() > 0){
               for(RR__c pc: proObj ){
                   pc.Bill_Rate__c = rem.test__c ;
                   update pc;
               }
           }          
        }      
    }
}

 

 

 

Thanks

Hi,

 

I am able to create single record for the custom detail object using the VF page, how to define the number of records should get created on VF page itself, so that when i hit save button the defined number of records should get created??

 

my Apex Class:

public class OrderEntry 
{
    public List<RR__c> ords {get; set;}
    private final Opportunity parOrd;
    public OrderEntry(ApexPages.StandardController​ myController) {
        parOrd=(Opportunity)myController.getrecord​();
        ords = new List<RR__c>();
        RR__c LitOrd = new RR__c();
        LitOrd.Opportunity__c = parOrd.id;
        ords.add(LitOrd);}

    public void addrow() {
        RR__c LitOrd = new RR__c();
        LitOrd.Opportunity__c = parOrd.id;
        ords.add(LitOrd);}
            
    public void removerow(){
        Integer i = ords.size();
        ords.remove(i-1);}
            
    public PageReference save() {
         insert ords;
        PageReference parrec = new PageReference('​/'+ parOrd.id);
        parrec.setRedirect(true);
        return parrec; }
}

 

 

VF Page:

<apex:page standardController="Opportunity" extensions="OrderEntry">
    <apex:form >
    <apex:pageBlock title="Create Requisitions against Opportunities" >
                <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" rerender="error" />
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!ords}" var="a" id="table">
                <apex:column headerValue="Opportunity Name">
                    <apex:inputField value="{!a.Opportunity__c}"/>
                </apex:column>               
               
            </apex:pageBlockTable>
    <apex:pageblockButtons location="bottom">
        <div style="text-align:right;margin-right:30px;font-wei​ght:bold;">
            <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error" immediate="true" />
&nbsp; | &nbsp;
<apex:commandLink value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" />               

        </div>
    </apex:pageblockButtons> 
    </apex:pageBlock>
    </apex:form>
</apex:page>

 

Hi,

 

I am able to create single record for the custom detail object using the VF page, how to define the number of records should get created on VF page itself, so that when i hit save button the defined number of records should get created??

 

my Apex Class:

public class OrderEntry 
{
    public List<RR__c> ords {get; set;}
    private final Opportunity parOrd;
    public OrderEntry(ApexPages.StandardController myController) {
        parOrd=(Opportunity)myController.getrecord();
        ords = new List<RR__c>();
        RR__c LitOrd = new RR__c();
        LitOrd.Opportunity__c = parOrd.id;
        ords.add(LitOrd);}

    public void addrow() {
        RR__c LitOrd = new RR__c();
        LitOrd.Opportunity__c = parOrd.id;
        ords.add(LitOrd);}
            
    public void removerow(){
        Integer i = ords.size();
        ords.remove(i-1);}
            
    public PageReference save() {
         insert ords;
        PageReference parrec = new PageReference('/'+ parOrd.id);
        parrec.setRedirect(true);
        return parrec; }
}

 

 

VF Page:

<apex:page standardController="Opportunity" extensions="OrderEntry">
    <apex:form >
    <apex:pageBlock title="Create Requisitions against Opportunities" >
                <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" rerender="error" />
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!ords}" var="a" id="table">
                <apex:column headerValue="Opportunity Name">
                    <apex:inputField value="{!a.Opportunity__c}"/>
                </apex:column>               
               
            </apex:pageBlockTable>
    <apex:pageblockButtons location="bottom">
        <div style="text-align:right;margin-right:30px;font-weight:bold;">
            <apex:commandLink value="Add Row" action="{!addRow}" rerender="table,error" immediate="true" />
&nbsp; | &nbsp;
<apex:commandLink value="Remove Row" action="{!removeRow}" rerender="table,error" immediate="true" />               

        </div>
    </apex:pageblockButtons> 
    </apex:pageBlock>
    </apex:form>
</apex:page>