• Harold Crouse 8
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 11
    Replies
I have a multi-step approval process that I want to give certain users the ability to "kill".  What I've done is create a method witht he following code.
 
ID workItem = getWorkItemId(oEnrollmentApp.ID); //retrieves the current process step
      while(workItem != null){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
          req.setComments('Final Rejection.');
          req.setAction('Reject');
          //req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
          req.setWorkitemId(workItem);
              // Submit the request for approval
          Approval.ProcessResult result =  Approval.process(req);
          workItem = getWorkItemId(oEnrollmentApp.id);
       
      }

It works great to continually reject the steps until it reaches the final step.  My problem is that rejecting this way doesn't cause the approval process to do it's default behaviors that are designed into the process.  For example when the record is rejected it should change a status field on the record.  Then when the final step, step 1 is rejected it should set the record type and lock the record by setting a field.  None of the happens.  The all the process say rejected though.  
Here is my issue.  I have a Visualforce page that uses a standard controller for a custom object.  I have multiple layouts that display based on the record type.  For instance I have on record type that when it comes into the page as that record type it only displays 2 fields to force the user to enter some followup data.  When they click save, part of the process is to update the recordtype and then refresh the page so that it loads the new data and displays a different layout.  My problem seems to be that the recordtype is not fully commited to the database before the page refreshes which causes the current layout to display.  If I hit refresh again it reloads the correct layout.  I'm not sure how to make the page wait to reload until the the update process is complete.
I have a project where I need to be able to allow a user create and edit listviews for a custom object.  We have worked pretty hard to create a total branded experience that hides everything salesforce shows and keeps the user within our branded experience.  So now I need to create a page that will allow a user to create / edit the views without taking them to a legacy SF page.  Is this possible?
I have a Flow that has two different paths the user can take.  At the end of one path I want to redirect the user to a visualforce page and at the end of another path I want to direct the user to a standard layout using an id.  
public class takeMetoCustomerCallController {

public Flow.Interview.Call_Center_Flow aFlow {get; set;}

    public String getcallID() {
        if (aFlow==null) return '';
        else {
            boolean VFPage = aflow.bVFPage;
            if(!bVFPage)
                return '/' + aFlow.NewCustomerCallBidGenID;
            else
                return '/apex/MyVFPage;
        }
    }

    public PageReference getFinishPage(){
        PageReference p = new PageReference(getcallID());
        p.setRedirect(true);
        return p;
    }
    
}
 
<apex:page sidebar="false" controller="takeMetoCustomerCallController" >
  <flow:interview name="Call_Center_Flow" interview="{!aFlow}" finishLocation="{!FinishPage}"/>
</apex:page>

But I can't seem to access the variable.  I have an assingment rule at the end of the flow to either set the variable to true or false but it's always null when the flow ends?  Is there a way to set a variable so that I have access at the end of process?
I have a use case where I need to display a single chatter feed item.  Similar to what would happen if you clicked on view comment or item button in the standard salesforce chatter email when @mentioning somone.  

I've tried setting the entityID in the chatter:feed component to the feed item id that I'm trying to access. But the feed displays nothing.  However if I get the ParentID from the feed item and set the entityID to the parentID it shows the group feed where that Item exists.  Is there a way to display just the single feed item?
 
I have a visualforce page that displays some data.  It has filters that allows the user to reduce what is displayed.  After they have filtered the page down to the values they want to print, they can then click a print button.  In order for the page to print properly I need to spin them off into a whole new page that will use a different CSS to format the print.

What I would like to do is spin off the new page, but use the current data in the current controller so that I can retain all the filter options that the user chose.  Is there a way to spin off the new page without the controller re-instantiating?
I have an apex repeat that is dumping out some projects by name.  There is an image of a checkbox that displays.  When the user clicks on the check box I would like to find the img and change the name to "unchecked" so that it displays an image of an un-checked box.  I'm trying to use JQuery.  However the script keeps returning "undefinded"?  How do I get to the img with JQuery?
Here is the script:
<pre>
<script>
            function checkBoxClicked(itemID){
                elem = $(this);
                alert(elem.attr("class")); 
                toggleFilterItemJS(itemID);

            }
        </script>
<pre>

Visualforce: 
<pre>
<table class="Filter-content" >
                             <tr class="Filter-Project">
                                 <h4 class="projectclass">Projects</h4>
                                 <ol class="ProjectList">
                                     <apex:repeat value="{!mapProjects}" var="Prorow" id="apexrepeat">
                                         <li class="liid">
                                             <a id="href" class="href" href="#" onclick="checkBoxClicked('{!mapProjects[Prorow].oProject.ID}'); return false;" ><img id="checked" class="checked" />
                                             </a>
                                             <apex:outputLabel id="labelid" for="theCheckbox" value="{!mapProjects[Prorow].oProject.Project_Name__c} {!mapProjects[Prorow].bShowProject}">
                                             </apex:outputLabel>
                                         </li>
                                     </apex:repeat>
                                 </ol>
                             </tr>
                         </table>   
<pre>
I'm trying to rerender the filter list when the user clicks on an image.  However the rerender in the apex:action function is causing the entire panel to just disappear?  There is no rendered code on the output panel ProjectFilter?

 <apex:outputPanel id="ProjectFilter">
         <table class="Filter-content">
             <tr class="Filter-Project">
                 <h4>Projects</h4>
                 <ol class="ProjectList">
                 <apex:repeat value="{!mapProjects}" var="Prorow">
                 <li>
                     <apex:outputPanel rendered="{!mapProjects[Prorow].bShowProject}">
                         <a href="#" onclick="toggleFilterItem('{!mapProjects[Prorow].oProject.ID}')" ><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" />
                         </a>
                     </apex:outputPanel>
                     <apex:outputLabel for="theCheckbox" value="{!mapProjects[Prorow].oProject.Project_Name__c} {!mapProjects[Prorow].bShowProject}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
             </tr>
             <apex:actionFunction name="toggleFilterItem" action="{!toggleFilterItem}" reRender="ProjectFilter,messages" immediate="false" status="status">
                      <apex:param name="uncheckValParam" assignTo="{!UnCheckVal}" value="test"> </apex:param>
             </apex:actionFunction>
         </table> 
         </apex:outputPanel>

Can anyone tell me why it's disappearing?
I have this chunck of code
<apex:outputPanel id="FilterSide">
<div class="filter">
                        <table class="Filter-content">
                                    <tr class="filterHead">
                                                <div class="filterHeader">
                                                            <h3>Filter By</h3>
                                                            <a class="applyBtn">Apply</a>
                                                </div>
                                    </tr>
                         <table class="Filter-content">
                                    <tr class="Filter-Project">
                                                <h4>Projects</h4>
                                                <ol class="ProjectList">
                                                <apex:repeat value="{!mapProjects}" var="Prorow">
                                                <li>
                                                            <apex:outputPanel rendered="{!mapProjects[Prorow].bShowProject}">
                                                                        <a href="#" onclick="toggleFilterItem('{!mapProjects[Prorow].oProject.ID}')" ><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" />
                                                                        </a>
                                                            </apex:outputPanel>
                                                            <apex:outputLabel for="theCheckbox" value="{!mapProjects[Prorow].oProject.Project_Name__c}"></apex:outputLabel>
                                                </li>
                                                </apex:repeat>
                                                </ol>
                                    </tr>
                                    <apex:actionFunction name="toggleFilterItem" action="{!toggleFilterItem}" reRender="FilterSide" immediate="false">
                                                            <apex:param name="uncheckValParam" assignTo="{!UnCheckVal}" value="test"> </apex:param>
                                    </apex:actionFunction>
                         </table>
                        </div>
                        </apex:outputPanel>

I have a click event on the href that calls the action function which in turn calls a method in my controller.  It works fine but the rerender causes the entire output panel to disappear. I'm not sure why.
</tr>
             <tr class="Filter-Project">
                 <h4>Project Manager</h4>
                 <ol class="ProjectManagerList">
                 <apex:repeat value="{!mapProjectManagers}" var="row">
                 <li><!--<apex:inputCheckbox id="theCheckbox" value="{!mapProjectManagers[row].bShowPMProjects}">
                 </apex:inputCheckbox> -->
                 <a href="#"><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" /></a><apex:outputLabel value="{!mapProjectManagers[row].ProjectManagerName}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
             </tr>

So I have a the above code, as you can see i've commented out the row <apex:inputCheckbox... As soon as I do  I get the following error..

The value '005q0000000IAIoAAO' is not a valid number
Error is in expression '{!mapProjectManagers[row].ProjectManagerName}' in component <apex:outputLabel> in page br_milestonecalendar

If the row is not commentd out, it works fine???  I'm really at a loss because I need to remove the checkbox because I want to use the image.
I have a map in my controller map<id,ProjectManagerWrapper> mapProjectManager.

In my Visualforce page I have the following code that works fine to display the project Managers

<ol class="ProjectManagerList">
                 <apex:repeat value="{!mapProjectManagers}" var="row">
                 <li><apex:inputCheckbox id="theCheckbox" value="{!mapProjectManagers[row].bShowPMProjects}">
                 </apex:inputCheckbox>
                 <a href="#"><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" /></a><apex:outputLabel value="      {!mapProjectManagers[row].ProjectManagerName}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
When I try and remove the inputCheckbox, because I'm replacing it with an image of a check box. Like this:
<ol class="ProjectManagerList">
                 <apex:repeat value="{!mapProjectManagers}" var="row">
                 <li>
                 <a href="#"><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" /></a><apex:outputLabel value="{!mapProjectManagers[row].ProjectManagerName}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
I get the following error:
The value '005q0000000IAIoAAO' is not a valid number

The value 005... is the key to the map, the id of the project manager.  I'm stumped.
I have a Visualforce page that is using a standard set controller and displaying the current list views for the object.  When the page loads with a list view option chosen the page loads with no records.  But changing the listview to another option and then back to the original option displays the records.  I can see that I have the correct filter id when the page loads.  I set the filter id on the standardsetcontroller and then get the records but it returns nothing.   I'm really baffled because it was working fine this morning and now doesn't.  It even stopped working on an existing page that hasn't been modified in months.  

Can anyone offer a way to debug this?  
I have a multi-step approval process that I want to give certain users the ability to "kill".  What I've done is create a method witht he following code.
 
ID workItem = getWorkItemId(oEnrollmentApp.ID); //retrieves the current process step
      while(workItem != null){
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
          req.setComments('Final Rejection.');
          req.setAction('Reject');
          //req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
          req.setWorkitemId(workItem);
              // Submit the request for approval
          Approval.ProcessResult result =  Approval.process(req);
          workItem = getWorkItemId(oEnrollmentApp.id);
       
      }

It works great to continually reject the steps until it reaches the final step.  My problem is that rejecting this way doesn't cause the approval process to do it's default behaviors that are designed into the process.  For example when the record is rejected it should change a status field on the record.  Then when the final step, step 1 is rejected it should set the record type and lock the record by setting a field.  None of the happens.  The all the process say rejected though.  
I have a Flow that has two different paths the user can take.  At the end of one path I want to redirect the user to a visualforce page and at the end of another path I want to direct the user to a standard layout using an id.  
public class takeMetoCustomerCallController {

public Flow.Interview.Call_Center_Flow aFlow {get; set;}

    public String getcallID() {
        if (aFlow==null) return '';
        else {
            boolean VFPage = aflow.bVFPage;
            if(!bVFPage)
                return '/' + aFlow.NewCustomerCallBidGenID;
            else
                return '/apex/MyVFPage;
        }
    }

    public PageReference getFinishPage(){
        PageReference p = new PageReference(getcallID());
        p.setRedirect(true);
        return p;
    }
    
}
 
<apex:page sidebar="false" controller="takeMetoCustomerCallController" >
  <flow:interview name="Call_Center_Flow" interview="{!aFlow}" finishLocation="{!FinishPage}"/>
</apex:page>

But I can't seem to access the variable.  I have an assingment rule at the end of the flow to either set the variable to true or false but it's always null when the flow ends?  Is there a way to set a variable so that I have access at the end of process?
The trigger I created is saving and running but it does not create  a new record.  I am putting information in a custom object called Customer Fact Sheet and moving the data into Status Report.  In the developer console does not show problems.  Does anyone see a prolem with the trigger?

Customer_Fact_Sheet__c = Source object
Status_Report__c = Target object

trigger InsertStatusReport on Customer_Fact_Sheet__c  (after insert)
{  for (Customer_Fact_Sheet__c cfs : Trigger.new)
        String cid = cfs.
{try{    Status_Report__c sta = new Status_Report__c();
        // Insert new Status record
        system.debug(cfs.Project_c__c);
        sta.Status_Unique_ID__c = '12a';
        sta.Project__c = cfs.Project_c__c;
     insert sta;
   }
 catch (Exception e) {system.debug('Exception'+e);}
   }
}
 
I'm trying to rerender the filter list when the user clicks on an image.  However the rerender in the apex:action function is causing the entire panel to just disappear?  There is no rendered code on the output panel ProjectFilter?

 <apex:outputPanel id="ProjectFilter">
         <table class="Filter-content">
             <tr class="Filter-Project">
                 <h4>Projects</h4>
                 <ol class="ProjectList">
                 <apex:repeat value="{!mapProjects}" var="Prorow">
                 <li>
                     <apex:outputPanel rendered="{!mapProjects[Prorow].bShowProject}">
                         <a href="#" onclick="toggleFilterItem('{!mapProjects[Prorow].oProject.ID}')" ><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" />
                         </a>
                     </apex:outputPanel>
                     <apex:outputLabel for="theCheckbox" value="{!mapProjects[Prorow].oProject.Project_Name__c} {!mapProjects[Prorow].bShowProject}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
             </tr>
             <apex:actionFunction name="toggleFilterItem" action="{!toggleFilterItem}" reRender="ProjectFilter,messages" immediate="false" status="status">
                      <apex:param name="uncheckValParam" assignTo="{!UnCheckVal}" value="test"> </apex:param>
             </apex:actionFunction>
         </table> 
         </apex:outputPanel>

Can anyone tell me why it's disappearing?
I have this chunck of code
<apex:outputPanel id="FilterSide">
<div class="filter">
                        <table class="Filter-content">
                                    <tr class="filterHead">
                                                <div class="filterHeader">
                                                            <h3>Filter By</h3>
                                                            <a class="applyBtn">Apply</a>
                                                </div>
                                    </tr>
                         <table class="Filter-content">
                                    <tr class="Filter-Project">
                                                <h4>Projects</h4>
                                                <ol class="ProjectList">
                                                <apex:repeat value="{!mapProjects}" var="Prorow">
                                                <li>
                                                            <apex:outputPanel rendered="{!mapProjects[Prorow].bShowProject}">
                                                                        <a href="#" onclick="toggleFilterItem('{!mapProjects[Prorow].oProject.ID}')" ><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" />
                                                                        </a>
                                                            </apex:outputPanel>
                                                            <apex:outputLabel for="theCheckbox" value="{!mapProjects[Prorow].oProject.Project_Name__c}"></apex:outputLabel>
                                                </li>
                                                </apex:repeat>
                                                </ol>
                                    </tr>
                                    <apex:actionFunction name="toggleFilterItem" action="{!toggleFilterItem}" reRender="FilterSide" immediate="false">
                                                            <apex:param name="uncheckValParam" assignTo="{!UnCheckVal}" value="test"> </apex:param>
                                    </apex:actionFunction>
                         </table>
                        </div>
                        </apex:outputPanel>

I have a click event on the href that calls the action function which in turn calls a method in my controller.  It works fine but the rerender causes the entire output panel to disappear. I'm not sure why.
</tr>
             <tr class="Filter-Project">
                 <h4>Project Manager</h4>
                 <ol class="ProjectManagerList">
                 <apex:repeat value="{!mapProjectManagers}" var="row">
                 <li><!--<apex:inputCheckbox id="theCheckbox" value="{!mapProjectManagers[row].bShowPMProjects}">
                 </apex:inputCheckbox> -->
                 <a href="#"><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" /></a><apex:outputLabel value="{!mapProjectManagers[row].ProjectManagerName}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
             </tr>

So I have a the above code, as you can see i've commented out the row <apex:inputCheckbox... As soon as I do  I get the following error..

The value '005q0000000IAIoAAO' is not a valid number
Error is in expression '{!mapProjectManagers[row].ProjectManagerName}' in component <apex:outputLabel> in page br_milestonecalendar

If the row is not commentd out, it works fine???  I'm really at a loss because I need to remove the checkbox because I want to use the image.
I have a map in my controller map<id,ProjectManagerWrapper> mapProjectManager.

In my Visualforce page I have the following code that works fine to display the project Managers

<ol class="ProjectManagerList">
                 <apex:repeat value="{!mapProjectManagers}" var="row">
                 <li><apex:inputCheckbox id="theCheckbox" value="{!mapProjectManagers[row].bShowPMProjects}">
                 </apex:inputCheckbox>
                 <a href="#"><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" /></a><apex:outputLabel value="      {!mapProjectManagers[row].ProjectManagerName}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
When I try and remove the inputCheckbox, because I'm replacing it with an image of a check box. Like this:
<ol class="ProjectManagerList">
                 <apex:repeat value="{!mapProjectManagers}" var="row">
                 <li>
                 <a href="#"><img src="{!URLFOR($Resource.BR_Assets, 'images/checked.png')}" class="checked" /></a><apex:outputLabel value="{!mapProjectManagers[row].ProjectManagerName}"></apex:outputLabel>
                 </li>
                 </apex:repeat>
                 </ol>
I get the following error:
The value '005q0000000IAIoAAO' is not a valid number

The value 005... is the key to the map, the id of the project manager.  I'm stumped.
I have a Visualforce page that is using a standard set controller and displaying the current list views for the object.  When the page loads with a list view option chosen the page loads with no records.  But changing the listview to another option and then back to the original option displays the records.  I can see that I have the correct filter id when the page loads.  I set the filter id on the standardsetcontroller and then get the records but it returns nothing.   I'm really baffled because it was working fine this morning and now doesn't.  It even stopped working on an existing page that hasn't been modified in months.  

Can anyone offer a way to debug this?