• Praveen Kumar 94
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 0
    Replies
Because my Multi-Select field hits the 5K or 3,900 Limit of SFDC. I have arrived at this thing. I split the big formula(Multi-Select List) (Hard-Coded) into two fields (Field_B & Field_C).
I have this Scenario :
Two Objects : "Application" & "Contact"
I want to Update a Formula field "(Field_A = Field_B + Field_C)" in "Application" object when there is a change in fields "(Field_D)" of "Contact" Object. A look-up relationship exists between both the objects.

So i want to achieve this Using Workflow rule written on "Application".
Something like this should happen Field_A = Field_B + Field_C.

I know there is an alternative for Trigger for Cross-object field Updation. But i would like to achieve this using WFR.
<apex:page controller="polling" >
 <apex:form >
  <apex:pageBlock id="myBlock" >
    <apex:actionPoller rerender="myTable,myBlock" action="{!displaymeth}" interval="5" status="St"/>
     <apex:pageBlockTable value="{!apps}" var="a" id="myTable">
        <apex:column value="{!a.name}"/>
            <apex:column value="{!a.City__c}"/>
         </apex:pageBlockTable>
      <apex:actionStatus startText="Getting.." stopText="Done" id="St"/>
   </apex:pageBlock>
 </apex:form>
</apex:page>

Controller
 
public with sharing class polling {

    private integer listid = 0;

    public List<Applicant__C> applist = new List<Applicant__C>();    

    public PageReference displaymeth() {
    
    if(listid <= applist.size())
    {
        if(listid == applist.size())
        {
          listid = 0;
         }
         apps.clear();
         
        Applicant__c obj = new Applicant__C() ;
        
        obj = applist.get(listid);
        
        system.debug('object is here' + obj);
        
        apps.add(obj);
        
        system.debug('apps is here' + apps);
        
        
     }
     listid++;
        return null;
    }


    public List<Applicant__C> apps { get; set; }

    public polling()
    {
    
    applist = [select name, city__c from Applicant__c];
    
    system.debug('List is here' + applist);
    }
  
}

 
<apex:page controller="Pagnt" tabStyle="Applicant__c">
   <apex:form >
     <apex:panelGrid id="details" >
       <apex:pageBlock >
          <apex:actionStatus id="pageStatus">
            <apex:facet name="start">
              <apex:outputPanel >
                <img src="{!$Resource.Loader}" width="80" height="20" />
              <apex:outputLabel value="Loading..."/>
              </apex:outputPanel>            
            </apex:facet>
          </apex:actionStatus>
         
       <apex:pageblockTable value="{!applist}" var="app">
            <apex:column value="{!app.Name}"/>
            <apex:column value="{!app.First_Name__c}"/>
            <apex:column value="{!app.Email__c}"/>
            <apex:facet name="footer">Page {!pageNumber} of {!totalPages}</apex:facet> 
            
       </apex:pageblockTable>
      Go To Page &nbsp; <apex:inputText value="{!num}" size="1" />
      <apex:commandButton status="pageStatus" value="GO" action="{!Go}" rerender="details" />
       <apex:pageblockButtons >
         <apex:commandButton status="pageStatus" value="First" rerender="details" action="{!First}" disabled="{!prev}"/>
         <apex:commandButton status="pageStatus" value="Previous" rerender="details" action="{!previous}" disabled="{!prev}"/>
         <apex:commandButton status="pageStatus" value="Next" rerender="details" action="{!next}" disabled="{!nxt}"/>
         <apex:commandButton status="pageStatus" value="Last" rerender="details" action="{!Last}" disabled="{!nxt}"/>
       </apex:pageblockButtons>
      
      </apex:pageBlock>
    </apex:panelGrid>
  </apex:form>
</apex:page>

And My Apex Code
 
public with sharing class Pagnt {

    public void Go() 
    {
        
     x = num ;
         
    }

    public Integer num { get; set; }
    
    public Integer x {get; set;}

    public Integer getPageNumber() {
    
       x = offsetsize/LimitSize +1 ;
       
       return x;
   }
    
   public Integer getTotalPages() 
   {
      if (math.mod(totalRecs, Limitsize) > 0) 
      {
         return totalRecs/LimitSize + 1;
         
      } 
      else 
      {
         return (totalRecs/LimitSize);
      }
   }

     public integer totalRecs = 0;
     public integer OffsetSize = 0;
     public integer LimitSize= 5;
     
     public Pagnt()
     {
           totalRecs = [select count() from Applicant__c];
           
           
     }
        
     public List<Applicant__c> getapplist()
     {
          
           List<Applicant__C> app = Database.Query('SELECT Name, first_Name__C, Email__C  FROM Applicant__C ORDER BY createddate ASC NULLS LAST  LIMIT :LimitSize OFFSET :OffsetSize');
           System.debug('Values are ' + app);
           return app;
     }
        
    public void First(){
           
        OffsetSize = 0;
      }
    
    public void previous(){
           
        OffsetSize = OffsetSize - LimitSize;
      }
      
    public void next(){
           
        OffsetSize = OffsetSize + LimitSize;
      }
      
    public void Last(){
           
       OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
       
      }
    public boolean getprev()
        {
          if(OffsetSize == 0)
          return true;
          else
          return false;
        }
    public boolean getnxt()
       {
          if((OffsetSize + LimitSize) > totalRecs)
          return true;
          else
          return false;
       }
}

 
<apex:page controller="Pagnt" tabStyle="Applicant__c">
   <apex:form >
     <apex:panelGrid id="details" >
       <apex:pageBlock >
          <apex:actionStatus id="pageStatus">
            <apex:facet name="start">
              <apex:outputPanel >
                <img src="{!$Resource.Loader}" width="80" height="20" />
              <apex:outputLabel value="Loading..."/>
              </apex:outputPanel>            
            </apex:facet>
          </apex:actionStatus>
         
       <apex:pageblockTable value="{!applist}" var="app">
            <apex:column value="{!app.Name}"/>
            <apex:column value="{!app.First_Name__c}"/>
            <apex:column value="{!app.Email__c}"/>
            <apex:facet name="footer">Page {!pageNumber} of {!totalPages}</apex:facet> 
            
       </apex:pageblockTable>
      Go To Page &nbsp; <apex:inputText value="{!num}" size="1" />
      <apex:commandButton status="pageStatus" value="GO" action="{!Go}" rerender="details" />
       <apex:pageblockButtons >
         <apex:commandButton status="pageStatus" value="First" rerender="details" action="{!First}" disabled="{!prev}"/>
         <apex:commandButton status="pageStatus" value="Previous" rerender="details" action="{!previous}" disabled="{!prev}"/>
         <apex:commandButton status="pageStatus" value="Next" rerender="details" action="{!next}" disabled="{!nxt}"/>
         <apex:commandButton status="pageStatus" value="Last" rerender="details" action="{!Last}" disabled="{!nxt}"/>
       </apex:pageblockButtons>
      
      </apex:pageBlock>
    </apex:panelGrid>
  </apex:form>
</apex:page>

And My Apex Code
 
public with sharing class Pagnt {

    public void Go() 
    {
        
     x = num ;
         
    }

    public Integer num { get; set; }
    
    public Integer x {get; set;}

    public Integer getPageNumber() {
    
       x = offsetsize/LimitSize +1 ;
       
       return x;
   }
    
   public Integer getTotalPages() 
   {
      if (math.mod(totalRecs, Limitsize) > 0) 
      {
         return totalRecs/LimitSize + 1;
         
      } 
      else 
      {
         return (totalRecs/LimitSize);
      }
   }

     public integer totalRecs = 0;
     public integer OffsetSize = 0;
     public integer LimitSize= 5;
     
     public Pagnt()
     {
           totalRecs = [select count() from Applicant__c];
           
           
     }
        
     public List<Applicant__c> getapplist()
     {
          
           List<Applicant__C> app = Database.Query('SELECT Name, first_Name__C, Email__C  FROM Applicant__C ORDER BY createddate ASC NULLS LAST  LIMIT :LimitSize OFFSET :OffsetSize');
           System.debug('Values are ' + app);
           return app;
     }
        
    public void First(){
           
        OffsetSize = 0;
      }
    
    public void previous(){
           
        OffsetSize = OffsetSize - LimitSize;
      }
      
    public void next(){
           
        OffsetSize = OffsetSize + LimitSize;
      }
      
    public void Last(){
           
       OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
       
      }
    public boolean getprev()
        {
          if(OffsetSize == 0)
          return true;
          else
          return false;
        }
    public boolean getnxt()
       {
          if((OffsetSize + LimitSize) > totalRecs)
          return true;
          else
          return false;
       }
}