• Ryan Pat
  • NEWBIE
  • 45 Points
  • Member since 2018

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Create an Apex class with a method that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.

The Apex class must be called StringArrayTest and be in the public scope
The Apex class must have a public static method called generateStringArray
The generateStringArray method must return an array (or list) of strings
The method must accept an incoming Integer as a parameter, which will be used to determine the number of returned strings
The method must return a string value in the format Test n where n is the index of the current string in the array
Hi i have a requirement where we have a custom object call managment__c  and 
where on a field stage__c is stage-2 
it will hide survey__c field from vf page how can i achieve ?
<apex:OutputField value="{!Managment__c.stage__c}" rendered="{! IsSurvey || IsIsSurveyDETAILS }"/>
 <apex:OutputField value="{!Managment__c.survey__c}" rendered="{!IsSurvey}" />

 
I have one object called CPM which has couple of fields one is user field which has a lookup with user object and second one is week number which is a formula field it will show which week is going on based on Todays date.
2. On opportunity object i have 2 field one is sub date it is a date field and other is current week which is a formula field it will show current week number based on opportunity sub date .
Now the requirement is based on CPM object record user and week number field it will go to all opportunity which is created this year and sub date is not blank and on opp current week is same and update CPM Field .
Here is a batch class it is working currectly but some one check and optimized this code as much as possible with bulkify also :
global class CPMBatch implements Database.Batchable<sObject> ,Database.Stateful
{
 list< CPM__c > lstToUpdate = new list <CPM__c>();
  global Database.QueryLocator start(Database.BatchableContext BC) {
            
            list <string> stValue = new list <string>();
            list <CPM_Team_List__mdt > LstSaleTeam = [select id , User_Name__c from CPM_Team_List__mdt ];
            for(CPM_Team_List__mdt  st : LstSaleTeam)
            {
                stValue.add(st.User_Name__c);
                
            }
                
                String query = 'SELECT Id,Name, Week_Number__c , User__c , User_Name__c from CPM__c  where Week_Number__c != null and  User_Name__c IN : stValue  ';
          
            
            return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List< CPM__c > scope){
          String  uname ;
          Decimal weeknum ; 
          ID  CPMId;
         for (CPM_MANAGEMENT__c mtscope : scope) 
           {
                      uname = mtscope.User_Name__c ;
                      weeknum = mtscope.Week_Number__c ;
                    CPMId = mtscope.id;
                      
           }
           
           
         list <opportunity > opp = [select id , name , Owner_Name__c from opportunity 
                                                               where sub_Date__c != null 
                                                                     and Current_Week__c =: weeknum  
                                                                     and Owner_Name__c =: uname ]  ; 
                         
                              
         
             for(CPM_MANAGEMENT__c Ctam : scope )
             {
             
                Ctam.id = CPMId ;
                Ctam.CPM_Updated_Goal__c = opp.size();
                lstToUpdate.add(Ctam);
               
         
             }
         if(lstToUpdate.size()>0)
            {
            database.update(lstToUpdate,false);
            }
         }  
    global void finish(Database.BatchableContext BC)
    {
      
    }
}

 
I have one visualforce page and based on opportunity stage = closed won and if industry is blank it is throw error message that please select industy but in the vf page at the bottom there are 2 buttons but when this error message come i do not want to show submit button i want to hide that button how can i complete this ?
Here is my code
<apex:page standardcontroller="Opportunity" extensions="OpportunityApprovalControllerExtension">
    
    <apex:Form >
        <apex:PageBlock mode="view" title="Approval Submission Details">
            <apex:messages />
            <apex:PageBlockButtons location="bottom">
                <apex:commandButton value="Submit" action="{!SubmitForApproval2}"  rendered="{!ShowSubmitButton}" />  
                <apex:commandButton value="Return to Opportunity" action="{!ReturnToOpp}" />
            </apex:PageBlockButtons>
        </apex:PageBlock>
    </apex:Form>
    
</apex:page>

 
Hi i have a requirement where we have a custom object call managment__c  and 
where on a field stage__c is stage-2 
it will hide survey__c field from vf page how can i achieve ?
<apex:OutputField value="{!Managment__c.stage__c}" rendered="{! IsSurvey || IsIsSurveyDETAILS }"/>
 <apex:OutputField value="{!Managment__c.survey__c}" rendered="{!IsSurvey}" />

 
Create an Apex class with a method that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.

The Apex class must be called StringArrayTest and be in the public scope
The Apex class must have a public static method called generateStringArray
The generateStringArray method must return an array (or list) of strings
The method must accept an incoming Integer as a parameter, which will be used to determine the number of returned strings
The method must return a string value in the format Test n where n is the index of the current string in the array
I have one visualforce page and based on opportunity stage = closed won and if industry is blank it is throw error message that please select industy but in the vf page at the bottom there are 2 buttons but when this error message come i do not want to show submit button i want to hide that button how can i complete this ?
Here is my code
<apex:page standardcontroller="Opportunity" extensions="OpportunityApprovalControllerExtension">
    
    <apex:Form >
        <apex:PageBlock mode="view" title="Approval Submission Details">
            <apex:messages />
            <apex:PageBlockButtons location="bottom">
                <apex:commandButton value="Submit" action="{!SubmitForApproval2}"  rendered="{!ShowSubmitButton}" />  
                <apex:commandButton value="Return to Opportunity" action="{!ReturnToOpp}" />
            </apex:PageBlockButtons>
        </apex:PageBlock>
    </apex:Form>
    
</apex:page>