• Shrey Tyagi
  • NEWBIE
  • 60 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 8
    Replies
Hi All,
  I have a VF search page where I am passing parametres from VF pgae to SOQL in Apex contriller to return serach records. Here is my snippet of VF page. The issue is that for <input type="date">, input works only on crome  and not on IE. Please recommend changes :


function doSearch() {
        window.scrollTo(0, 0);
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("POPStartDate").value,
          document.getElementById("POPEndDate").value,


          );

      }
      
   

      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size,size1,size2">
          <apex:param name="Name" value="" />

          <apex:param name="POPStartDate" value="" />
          <apex:param name="POPEndDate" value="" />
 


      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td><br/>
         <apex:commandButton onclick="doSearch();return false;" value="Search Projects"/>&nbsp;&nbsp;
         <apex:commandButton value="Reset Filters" action="{!reset}"/>

        </td>      
      </tr>
      <tr>
        <td style="font-weight:bold;">Project #<br/>
        <input type="text" id="Name" />
        </td>
      </tr>

      <tr>
        <td style="font-weight:bold;">POP Start Date<br/>
        <input type="Date" id="POPStartDate"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">POP End Date<br/>
        <input type="Date" id="POPEndDate" />
        </td>
      </tr>
 
Hi All ,
  I have a section in vf pages that pass 2 values to apex method upon click of a link.

VF Page Code:

<table cellpadding="2" cellspacing="2">
    <tr>
       // //This value gets passed over as null 
        <td style="font-weight:bold;">Document Type<br/>
          <select id="DocTypeOnBase" value="{!searchDocType}">
            <option value=""></option>
            <apex:repeat value="{!DocTypeValues}" var="DocTypeValue">
              <option value="{!DocTypeValue}">{!DocTypeValue}</option>
            </apex:repeat>
          </select>
        </td>
      </tr>
    <tr>
       // //This value gets passed over successfully 
        <td style="font-weight:bold;">Document Text<br/><br></br>
        <apex:inputtext value="{!searchText}" id="DocumentText" rendered="true" />
        </td>
    </tr>
     <tr>
        <td><br/>
        <apex:commandlink action="{!processLinkClick}" target="_blank" ><b>Search OnBase</b></apex:commandlink>&nbsp;&nbsp;
        </td>      
      </tr>
   </table>


Apex Class:
 

public string searchText{get;set;}-- This one works
public string searchDocType{get;set;}-- This one passes null
public PageReference processLinkClick() {

      return new PageReference('https://onbasetest.rti.org/AppNet/docpop/docpop.aspclienttype=activex&cqid=196&fts='+searchText+searchDocType);
 }
Hi Everyone,
    I have a situation in which I am trying to push an apex invocable code (used by a process builder) in production . Now the process flow gets deployed as inactive flow . So in order to get coverage for my apex invocable , I am using following test class to fire the invocable . Important lines are marked in bold. Now when I run this , it does not throw any error and says 0/0 methods passed. Can someone please help me with this?
///////////////////Test Class//////////////////////////////
@isTest
private class CanInvocableHelperTest {

    @testSetup static void setup1() {

        Id currentUser = UserInfo.getUserId();
        Opportunity opp = TestUtil.setupTestData();
        opp.StageName = 'Closed Won';
        opp.Sub_Stage__c = 'Awarded';
        opp.Qty_of_CANs_Required__c = 1;
        opp.Did_Price_Change__c='No';
        update opp;
        //Updating Opportunity creates 1 can record.
        //Retrive the related CAN record using SOQL.
        CAN__c theCan = [SELECT Opportunity__c,Contract_Manager__c,Status__c,Awarded_Project__c FROM CAN__c Where Opportunity__c =:opp.Id];
        theCan.Contract_Manager__c = currentUser;
        theCan.Status__c='CP Setup';
        theCan.Awarded_Project__c='111111111';
        List<Id> TestCanIdList= new List<Id>();
        TestCanIdList.add(theCan.Id);
        // Change status to simulate process flow firing mechanism.As process flow is inactive.
        update theCan;

        Test.startTest();
        //calling invocable method here with can id
        CreateProjectRecord.ProjectRecordCreateMethod(TestCanIdList);

        
        Test.stopTest();
        }
}


///////////////////Invocable apex class////////////////////////////
public class CreateProjectRecord{ 
    
    @InvocableMethod     
    public static void ProjectRecordCreateMethod(List<Id> CanIds)     
    {        
        //Logic here
    }
}
Hi Evryone ,
   I have this pretty simple code given below. Now everything works well here. What i want to do is, rather than the record being displayed as a 1 row with 3 columns. I want it to be displayed as 1 column 3 rows. Can anyone please help me with this?

Current Display Format : Name, Narrative Technical, Narrative Staffing
Desired Display Format : Name 1
                                             Narrative Technical 1
                                             Narrative Staffing 1
                                         Name 2
                                             Narrative Technical 2
                                             Narrative Staffing 2

<apex:page standardController="Project_Form__c" recordSetVar="ProjectForms">
    <apex:sectionHeader title="Form History"/>
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />

            <apex:pageBlockSection title="Selected Project Review Forms" columns="1">
                 <apex:pageBlockTable value="{!selected}" var="form" columns="3">
                    <apex:column value="{!form.name}"/>
                    <apex:column value="{!form.Narrative_Technical__c}"/><br></br>
                    <apex:column value="{!form.Narrative_Staffing__c}"/><br></br>
                  </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Hi Everyone,
        I have a question on how to cover exceptions of Database.Save method. The method I want to cover is given below:

Apex Code : 
     Database.SaveResult[] lsr = Database.insert(GateReviewShrs,false); 
     // Create counter
     Integer i=0;
     // Process the save results
        for(Database.SaveResult sr : lsr){
            if(!sr.isSuccess()){
                // Get the first save result error
                Database.Error err = sr.getErrors()[0];
                if(!(err.getStatusCode() == StatusCode.FIELD_FILTER_VALIDATION_EXCEPTION  
                                               &&  err.getMessage().contains('AccessLevel'))){

                    trigger.newMap.get(GateReviewShrs[i].ParentId).
                      addError(
                       'Unable to grant sharing access due to following exception: '
                       + err.getMessage());
                }
            }
            i++;
        }
I am trying to cover this exception by making a wrong entry in my test class (one of inactive user). Code given below: 


@isTest
public class Test_PrasApexCode {
    
    static testMethod void testDoGet1() {



        
        Costpoint_Project__c testCostpointProject = new Costpoint_Project__c();
        testCostpointProject.Name = '0281300.003';

        insert testCostpointProject;

        //Fetch related Project Risk Review form.
        Project_Risk_Review__c ProRiskRev=[Select id,DVP__c,Project_Manager__c,Chair_Reviewer__c,Delegate__c 
                                           from Project_Risk_Review__c where Costpoint_Project__c=:testCostpointProject.Id];

        List<User> u2= [SELECT Id FROM User WHERE isActive=False and ProfileId=:Label.PRAS_RTI_BusinessDevelopment_Profile_Id Limit 1];

  
         ProRiskRev.Delegate__c=u2[0].Id;
         Update ProRiskRev;

      
But when I try to do this my coverage increases but test method fails . It has to fail because the user is inactive. Is there any way to pass the test method and increase the coverage?

 
Hi ,
 I have this code below. I need to add values to Map<Id,List<Id>>, it is giving an error , can anyone pleas ehelp?


trigger Project_Risk_Review_Trigger on Project_Risk_Review__c (after insert,after update) {
   
   
         // Create a new list of sharing objects for Project_Risk_Review
         List<Project_Risk_Review__Share> ProjectRiskReviewShrs  = new List<Project_Risk_Review__Share>();

         Map<Id,List<Id>> OldSharesMap=new Map<Id,List<Id>>();
         // Declare variables for super user sharing.
         Project_Risk_Review__Share SuperUserShrDvp;
         Project_Risk_Review__Share SuperUserShrDelegate;
         Project_Risk_Review__Share SuperUserShrProjectDirector;
         Project_Risk_Review__Share SuperUserShrChairReviewer;
         for(Project_Risk_Review__c NewAssessment : trigger.new){
                  
                  Project_Risk_Review__c oldReview = Trigger.oldMap.get(NewAssessment.ID);                  
                  if(NewAssessment.DVP__c != Null && ((Trigger.IsInsert && Trigger.IsAfter)||(Trigger.IsUpdate && Trigger.IsAfter && (NewAssessment.DVP__c !=oldReview.DVP__c)))){
                      // Instantiate the sharing objects
                      SuperUserShrDvp = new Project_Risk_Review__Share();
                      // Set the ID of record being shared
                      SuperUserShrDvp.ParentId = NewAssessment.Id;
                      // Set the ID of user or group being granted access
                      SuperUserShrDvp.UserOrGroupId =NewAssessment.DVP__c;
                      SuperUserShrDvp.AccessLevel = 'edit';
                      // Set the Apex sharing reason for DVP
                      SuperUserShrDvp.RowCause = Schema.Project_Risk_Review__Share.RowCause.PRAS_Super_Users_R_W_Access__c;
                      // Add objects to list for insert
                      ProjectRiskReviewShrs.add(SuperUserShrDvp);
                      if(Trigger.IsAfter && Trigger.IsUpdate){
                        OldSharesMap.put(oldReview.ID,oldReview.DVP__c);
                      }
                  }
Hi Everyone ,
      I have 2 visualforce pages given below . One works , other does not . I am trying to grey out the page upon click of  a button , so I am trying to call out an action status from command button .  In this page given below it works perfectly well:

<apex:page standardController="Account">
<style>
    /* This is for the full screen DIV */
    .popupBackground {
        /* Background color */
        background-color:black;
        opacity: 0.20;
        filter: alpha(opacity = 20);
    
        /* Dimensions */
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 998;
        position: absolute;
        
        /* Mouse */
        cursor:wait;
    }
 
    /* This is for the message DIV */
    .PopupPanel {
        /* Background color */
        border: solid 2px blue;
        background-color: white;
 
        /* Dimensions */
        left: 50%;
        width: 200px;
        margin-left: -100px;
        top: 50%;
        height: 50px;
        margin-top: -25px;
        z-index: 999;
        position: fixed;
        
        /* Mouse */
        cursor:pointer;
    }
</style>
<apex:actionStatus id="statusSaveTrip" stopText="">
    <apex:facet name="start">
        <div>
            <div class="popupBackground" />
            <div class="PopupPanel">
                <table border="0" width="100%" height="100%">
                    <tr>
                        <td align="center"><b>Please Wait</b></td>
                    </tr>
                    <tr>
                        <td align="center"><img src="{!$Resource.ProgressBar}"/></td>
                    </tr>
                </table>
            </div>
        </div>
    </apex:facet>
</apex:actionStatus>
<apex:form id="myForm">
    <apex:pageMessages />
    <apex:pageBlock >
        <apex:pageBlockButtons location="Top">
            <apex:commandButton value="Click Me" action="{!quicksave}" rerender="myForm" status="statusSaveTrip" />
        </apex:pageBlockButtons>
        <apex:pageBlockSection >
            <apex:inputField value="{!Account.Name}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>


When I try to imitate the same piece of code in this page it does not work , can I please know why this is the case? What am I doing wrong here:

<apex:page controller="ProposalSearchControllerModified" sidebar="false" readonly="True">

<style>
    /* This is for the full screen DIV */
    .popupBackground {
        /* Background color */
        background-color:black;
        opacity: 0.20;
        filter: alpha(opacity = 20);
    
        /* Dimensions */
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 998;
        position: absolute;
        
        /* Mouse */
        cursor:wait;
    }
 
    /* This is for the message DIV */
    .PopupPanel {
        /* Background color */
        border: solid 2px blue;
        background-color: white;
 
        /* Dimensions */
        left: 50%;
        width: 200px;
        margin-left: -100px;
        top: 50%;
        height: 50px;
        margin-top: -25px;
        z-index: 999;
        position: fixed;
        
        /* Mouse */
        cursor:pointer;
    }
</style>
<apex:actionStatus id="statusSaveTrip" stopText="">
    <apex:facet name="start">
        <div>
            <div class="popupBackground" />
            <div class="PopupPanel">
                <table border="0" width="100%" height="100%">
                    <tr>
                        <td align="center"><b>Please Wait</b></td>
                    </tr>
                    <tr>
                        <td align="center"><img src="{!$Resource.ProgressBar}"/></td>
                    </tr>
                </table>
            </div>
        </div>
    </apex:facet>
</apex:actionStatus>


  <apex:form >
  <apex:pageMessages id="errors"/>

  <apex:pageBlock title="Search Proposal Records" mode="edit" id="OuterPageBlock">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Search Parameters" mode="edit" id="criteria">

      <script type="text/javascript">
      function stopRKey(evt) {
       var evt = (evt) ? evt : ((event) ? event : null);
       var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
       if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
       }

       document.onkeypress = stopRKey; 
       
      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("OpportunityID").value
         
          );

      }
     
   

      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size,size1,size2">
          <apex:param name="Name" value="" />
          <apex:param name="OpportunityID" value="" />

      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Opportunity ID<br/>
        <input type="text" id="OpportunityID" />
        </td>
      </tr>
    
      <tr>
        <td><br/>
         <apex:commandButton onclick="doSearch();return false;" value="Search Proposals”/ status=“statusSaveTrip”>&nbsp;&nbsp;
         <apex:commandButton value="Reset Filters" action="{!reset}"/>



        </td>      
      </tr>


      
      <tr>
        <td>
               
        </td>  
      </tr>
      

       
   </table>
  </apex:pageBlock>

    </td>

    <td valign="top">
    <table style="width: 100%;">
    <td>
    
    <apex:pageBlock mode="edit" id="results">    

        <div style="overflow: auto; height: 300px;">
          
        <apex:pageBlockTable value="{!Opportunities}" var="opp">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>

                <apex:commandlink value="{!opp.Name}" rerender="RecordDetailSection" action="{!ClearOrder}">                
                 <apex:param name="DetailRecordId"  value="{!opp.Id}" assignTo="{!DetailRecordId}"/>   
                </apex:commandlink>               

            </apex:column>
            


            
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity ID" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="OpportunityID" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!opp.Opportunity_ID__c}"/>
            </apex:column>
            
          

        </apex:pageBlockTable>
       </div>
       
    </apex:pageBlock>
    
    </td>

    <tr>
        <td>
                        </td>
            </tr>
            </table>
    
    
        </td>

  </tr>

  </table>

   

  </apex:pageBlock>

  </apex:form>
   
 
Hi Everyone,
      
        I have a search page that looks for opportunity records depending on the search parameters given in input texts. The search function works on OnKeyUp instance. This code given below works perfectly fine for on  ky up event . The issue is that I want to change on key up to custom button click . When I do this , the entire page seems to relaod again , including the input parametres and page gets reset completely . Can anyone please help?


Rendering parts work well when onkeyup is used . But render acts weirrd and rerenders the entire page when button is used to invoke javascript.

<apex:page controller="ProposalSearchController" sidebar="false">

  <apex:form >
  <apex:pageMessages id="errors" />

  <apex:pageBlock title="Search Proposal Records" mode="edit">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Search Parameters" mode="edit" id="criteria">

      <script type="text/javascript">
      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("OpportunityID").value,
          document.getElementById("SolicitationNo").value,

          );

      }
     
   

      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size">
          <apex:param name="Name" value="" />
          <apex:param name="OpportunityID" value="" />
          <apex:param name="SolicitationNo" value="" />


      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Opportunity ID<br/>
        <input type="text" id="OpportunityID" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Solicitation #<br/>
        <input type="text" id="SolicitationNo" onkeyup="doSearch();"/>
        </td>
      </tr>



      <tr>
        <td><br/>
         <apex:commandButton value="Reset Filters" action="{!reset}"/>
           <apex:commandButton onclick="doSearch();" value="Search"/>
        </td>      
      </tr>
       
      </table>

      </apex:pageBlock>

    </td>
   
  </tr>
  </table>
  </apex:pageBlock>
  </apex:form>
      
</apex:page>
Hi Everyone,
      I need to conditionally render the highlighted apex out put texts but this is not wotking. Can someone please help me with the code below:
Rendered attribute is dependent on value of Variable ResultSize. The variable is showing the correct value hence I am not putting any apex code . The flow of code is gven below:

1. User key in the input values in input text boxes.
2. There is an onkeyup written on the input boxes. Than on key up function calles for a javascript that in turn calls for the apex action function . This apex action function rerenders the attribute. All other id's are being rerendered fine by action function except id's of out put texts size,size1.

<apex:page controller="ProposalSearchControllerModified" sidebar="false" readonly="True">

  <apex:form >
  <apex:pageMessages id="errors"/>

  <apex:pageBlock title="Search Proposal Records" mode="edit" id="OuterPageBlock">

  <table width="100%" border="0">
  <tr>  
    <td width="200" valign="top">

      <apex:pageBlock title="Search Parameters" mode="edit" id="criteria">

      <script type="text/javascript">

      function doSearch() {
        searchServer(
          document.getElementById("Name").value,
          document.getElementById("OpportunityID").value,
          document.getElementById("SolicitationNo").value,
          document.getElementById("ProposalNo").value

          );

      }
     
   

      </script> 

      <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors,size,size1">
          <apex:param name="Name" value="" />
          <apex:param name="OpportunityID" value="" />
          <apex:param name="SolicitationNo" value="" />
          <apex:param name="ProposalNo" value="" />

      </apex:actionFunction>

      <table cellpadding="2" cellspacing="2">
      <tr>
        <td style="font-weight:bold;">Opportunity ID<br/>
        <input type="text" id="OpportunityID" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Solicitation #<br/>
        <input type="text" id="SolicitationNo" onkeyup="doSearch();"/>
        </td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Proposal #<br/>
        <input type="text" id="ProposalNo" onkeyup="doSearch();"/>
        </td>
      </tr>
      


      <tr>
        <td>
          <b><apex:outputText id="size"  style="font-style:Bold;" value="Total Records Returned  :  {!ResultSize}" rendered="{!ResultSize<1000}"/></b>
          <b><apex:outputText id="size1"  style="font-style:Bold;" value="Total Records Returned  :  {!ResultSize} ++" rendered="{!ResultSize==1000}"/></b>

     
         
        </td>  
      </tr>
      

       
   </table>
  </apex:pageBlock>
       

    </td>

    <td valign="top">
    <table style="width: 100%;">
    <td>
    
    <apex:pageBlock mode="edit" id="results">    

        <div style="overflow: auto; height: 300px;">
          
        <apex:pageBlockTable value="{!Opportunities}" var="opp">

            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity Name" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="Name" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <!--<apex:outputLink value="/apex/SiteDetailPage?id={!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,false,true)}">{!opp.Name}</apex:outputLink>
                <apex:outputLink value="/{!opp.id}" target="_blank" rendered="{!IF(URLL=$Label.SalesforceURL,true,false)}">{!opp.Name}</apex:outputLink>-->
                <apex:commandlink value="{!opp.Name}" rerender="RecordDetailSection" action="{!ClearOrder}">                
                 <apex:param name="DetailRecordId"  value="{!opp.Id}" assignTo="{!DetailRecordId}"/>   
                </apex:commandlink>               

            </apex:column>
            


            
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Opportunity ID" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="OpportunityID" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!opp.Opportunity_ID__c}"/>
            </apex:column>
            
            <apex:column >
                <apex:facet name="header">
                    <apex:commandLink value="Proposal #" action="{!toggleSort}" rerender="results,debug">
                        <apex:param name="sortField" value="ProposalNo" assignTo="{!sortField}"/>
                    </apex:commandLink>
                </apex:facet>
                <apex:outputField value="{!opp.Proposal__c}"/>
            </apex:column>          


        </apex:pageBlockTable>
       </div>
       
    </apex:pageBlock>
    
    </td>

    </tr>
    </table>
    
    
    </td>

  </tr>

  </table>

   

  </apex:pageBlock>

  </apex:form>
   

</apex:page>
Hi Everyone,
           Due to some SOQL sub query limitations I have to query list of opportunity records into 2 seperate lists. for our e.g lets call them List A and List B.

So List A gets its values from soql query

List<Opportunity> ListA=[select Id, Name from Opportunity where StageName='Claosed Won'];

List<Opportunity> ListB=[select Id,Name from Oppoortunity where Sub_Stage__c='Aawarded'];

Set<Opportunity> SetC=ListA+ListB.

Now I want to combine List A and List B , take out the duplaicate data out of the combination and make a set out of it  Set c= List A+ List B ( but it should not have any duplaicate records)

Can anyone please help me with the syntax to join 2 lists into a set?

Please note that due to some limits I cannot get all my data into 1 list . The where clause e/g used above are just for theory . It's bit more complicated than that.
Need help with following SOQL

Select Id,Name from Opportunity where
name != null
and
 (
    Id In (Select OpportunityId FROM OpportunityTeamMember where Name LIKE '%shrey%')
    OR
    (Proposal_Leader__r.Name='Shrey Tyagi')
 )
order by Name asc nulls first limit 50

Error : MALFORMED_QUERY: Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions.
Hi Everyone ,
         I have an apex class whose constructor is calling a method . The call out is done after setting 1 parameter . The code is given below:

Constructor:

  public ProposalSearchControllerModified() {
     //String variable for soql
      soql = 'Select Id,Name from Opportunity where name != null';
     //executing SOQL AND PAASING VALUES TO THE LIST.
     Opportunities = Database.query(soql + ' order by ' + sortField + ' ' + sortDir+ ' Limit 50');
     //USING 1ST RECORD OF LIST TO EXECUTE ANOTHE METHOD - CLEAR Order
     DetailRecordId=Opportunities[0].Id;    
    ClearOrder();
  }


Test Class Code:

@istest
public class ProposalSearchControllerModifiedTest{
    public static testmethod void ProposalSearchMethod(){
         
         
         PageReference pageRef = Page.ProposalSearchModified;
         pageRef.getParameters().put('Name', 'Te');
         pageRef.getParameters().put('OpportunityID', '0');
         pageRef.getParameters().put('SolicitationNo', '0');
         pageRef.getParameters().put('ProposalNo', '0');
         
         Test.setCurrentPage(pageRef);
         ProposalSearchControllerModified cs=new ProposalSearchControllerModified();
         String sd=cs.sortDir;
         String sf=cs.sortField;
         String ds=cs.debugSoql;
         list<String> ls=cs.Stages;
         list<String> ls1=cs.SubStages;
         list<String> ls2=cs.FiscalYearValues;
         
         cs.toggleSort();
         cs.runQuery();
         cs.runSearch();
         cs.reset();
         
         
    
    }
}​



Error Message:

System.ListException: List index out of bounds: 0

Error is thrown when highlighted line in code above is covered through test class.
Hi Everyone ,
        I have this query and it works well. 

select Id,Name,StageName,Sub_Stage__c,Opportunity_ID__c,Account.Name,Proposal__r.Name,(Select Project__c From Awarded_Projects__r where Name != null Limit 1) from Opportunity where Name!= null order by Name asc limit 30

Now I want to order this query by  Project __c field that is fetched from the Child Record of :Awarded_Project__r. Can anyone please help me with the syntax?


Thanks 
Shrey Tyagi
 
Hi Everyone,
    I have a situation in which I am trying to push an apex invocable code (used by a process builder) in production . Now the process flow gets deployed as inactive flow . So in order to get coverage for my apex invocable , I am using following test class to fire the invocable . Important lines are marked in bold. Now when I run this , it does not throw any error and says 0/0 methods passed. Can someone please help me with this?
///////////////////Test Class//////////////////////////////
@isTest
private class CanInvocableHelperTest {

    @testSetup static void setup1() {

        Id currentUser = UserInfo.getUserId();
        Opportunity opp = TestUtil.setupTestData();
        opp.StageName = 'Closed Won';
        opp.Sub_Stage__c = 'Awarded';
        opp.Qty_of_CANs_Required__c = 1;
        opp.Did_Price_Change__c='No';
        update opp;
        //Updating Opportunity creates 1 can record.
        //Retrive the related CAN record using SOQL.
        CAN__c theCan = [SELECT Opportunity__c,Contract_Manager__c,Status__c,Awarded_Project__c FROM CAN__c Where Opportunity__c =:opp.Id];
        theCan.Contract_Manager__c = currentUser;
        theCan.Status__c='CP Setup';
        theCan.Awarded_Project__c='111111111';
        List<Id> TestCanIdList= new List<Id>();
        TestCanIdList.add(theCan.Id);
        // Change status to simulate process flow firing mechanism.As process flow is inactive.
        update theCan;

        Test.startTest();
        //calling invocable method here with can id
        CreateProjectRecord.ProjectRecordCreateMethod(TestCanIdList);

        
        Test.stopTest();
        }
}


///////////////////Invocable apex class////////////////////////////
public class CreateProjectRecord{ 
    
    @InvocableMethod     
    public static void ProjectRecordCreateMethod(List<Id> CanIds)     
    {        
        //Logic here
    }
}
Hi Evryone ,
   I have this pretty simple code given below. Now everything works well here. What i want to do is, rather than the record being displayed as a 1 row with 3 columns. I want it to be displayed as 1 column 3 rows. Can anyone please help me with this?

Current Display Format : Name, Narrative Technical, Narrative Staffing
Desired Display Format : Name 1
                                             Narrative Technical 1
                                             Narrative Staffing 1
                                         Name 2
                                             Narrative Technical 2
                                             Narrative Staffing 2

<apex:page standardController="Project_Form__c" recordSetVar="ProjectForms">
    <apex:sectionHeader title="Form History"/>
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />

            <apex:pageBlockSection title="Selected Project Review Forms" columns="1">
                 <apex:pageBlockTable value="{!selected}" var="form" columns="3">
                    <apex:column value="{!form.name}"/>
                    <apex:column value="{!form.Narrative_Technical__c}"/><br></br>
                    <apex:column value="{!form.Narrative_Staffing__c}"/><br></br>
                  </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Hi ,
 I have this code below. I need to add values to Map<Id,List<Id>>, it is giving an error , can anyone pleas ehelp?


trigger Project_Risk_Review_Trigger on Project_Risk_Review__c (after insert,after update) {
   
   
         // Create a new list of sharing objects for Project_Risk_Review
         List<Project_Risk_Review__Share> ProjectRiskReviewShrs  = new List<Project_Risk_Review__Share>();

         Map<Id,List<Id>> OldSharesMap=new Map<Id,List<Id>>();
         // Declare variables for super user sharing.
         Project_Risk_Review__Share SuperUserShrDvp;
         Project_Risk_Review__Share SuperUserShrDelegate;
         Project_Risk_Review__Share SuperUserShrProjectDirector;
         Project_Risk_Review__Share SuperUserShrChairReviewer;
         for(Project_Risk_Review__c NewAssessment : trigger.new){
                  
                  Project_Risk_Review__c oldReview = Trigger.oldMap.get(NewAssessment.ID);                  
                  if(NewAssessment.DVP__c != Null && ((Trigger.IsInsert && Trigger.IsAfter)||(Trigger.IsUpdate && Trigger.IsAfter && (NewAssessment.DVP__c !=oldReview.DVP__c)))){
                      // Instantiate the sharing objects
                      SuperUserShrDvp = new Project_Risk_Review__Share();
                      // Set the ID of record being shared
                      SuperUserShrDvp.ParentId = NewAssessment.Id;
                      // Set the ID of user or group being granted access
                      SuperUserShrDvp.UserOrGroupId =NewAssessment.DVP__c;
                      SuperUserShrDvp.AccessLevel = 'edit';
                      // Set the Apex sharing reason for DVP
                      SuperUserShrDvp.RowCause = Schema.Project_Risk_Review__Share.RowCause.PRAS_Super_Users_R_W_Access__c;
                      // Add objects to list for insert
                      ProjectRiskReviewShrs.add(SuperUserShrDvp);
                      if(Trigger.IsAfter && Trigger.IsUpdate){
                        OldSharesMap.put(oldReview.ID,oldReview.DVP__c);
                      }
                  }
Need help with following SOQL

Select Id,Name from Opportunity where
name != null
and
 (
    Id In (Select OpportunityId FROM OpportunityTeamMember where Name LIKE '%shrey%')
    OR
    (Proposal_Leader__r.Name='Shrey Tyagi')
 )
order by Name asc nulls first limit 50

Error : MALFORMED_QUERY: Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions.
Hi Everyone ,
         I have an apex class whose constructor is calling a method . The call out is done after setting 1 parameter . The code is given below:

Constructor:

  public ProposalSearchControllerModified() {
     //String variable for soql
      soql = 'Select Id,Name from Opportunity where name != null';
     //executing SOQL AND PAASING VALUES TO THE LIST.
     Opportunities = Database.query(soql + ' order by ' + sortField + ' ' + sortDir+ ' Limit 50');
     //USING 1ST RECORD OF LIST TO EXECUTE ANOTHE METHOD - CLEAR Order
     DetailRecordId=Opportunities[0].Id;    
    ClearOrder();
  }


Test Class Code:

@istest
public class ProposalSearchControllerModifiedTest{
    public static testmethod void ProposalSearchMethod(){
         
         
         PageReference pageRef = Page.ProposalSearchModified;
         pageRef.getParameters().put('Name', 'Te');
         pageRef.getParameters().put('OpportunityID', '0');
         pageRef.getParameters().put('SolicitationNo', '0');
         pageRef.getParameters().put('ProposalNo', '0');
         
         Test.setCurrentPage(pageRef);
         ProposalSearchControllerModified cs=new ProposalSearchControllerModified();
         String sd=cs.sortDir;
         String sf=cs.sortField;
         String ds=cs.debugSoql;
         list<String> ls=cs.Stages;
         list<String> ls1=cs.SubStages;
         list<String> ls2=cs.FiscalYearValues;
         
         cs.toggleSort();
         cs.runQuery();
         cs.runSearch();
         cs.reset();
         
         
    
    }
}​



Error Message:

System.ListException: List index out of bounds: 0

Error is thrown when highlighted line in code above is covered through test class.
Hi Everyone ,
        I have this query and it works well. 

select Id,Name,StageName,Sub_Stage__c,Opportunity_ID__c,Account.Name,Proposal__r.Name,(Select Project__c From Awarded_Projects__r where Name != null Limit 1) from Opportunity where Name!= null order by Name asc limit 30

Now I want to order this query by  Project __c field that is fetched from the Child Record of :Awarded_Project__r. Can anyone please help me with the syntax?


Thanks 
Shrey Tyagi