• Matt Thomas
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

Hi,

 

I'm using a pageBlockTable on my page which displays a List of a wrapper class that I created. Each "item" in the wrapper class has its own selectList component corresponding to that item's "Type", a String variable on the wrapper class with a default getter and setter. It looks like this:

 

<apex:pageBlockTable value="{!itemList}" var="item"  headerClass="displayTableHeader" >  
    <apex:column headerValue="Name">
         <apex:outputText value="{!item.Name}" id="itemName" />
    </apex:column>
    <apex:column headerValue="Type">
         <apex:selectList size="1" value="{!item.Type}">
              <apex:selectOptions value="{!typeList}"/>
         </apex:selectList> 
    </apex:column>
    <apex:column headerValue="Action">
         <apex:image value="{!$Resource.addIcon}" width="25" height="25" onclick="doScript('{!item.Name}','{!item.Type}');" />
    </apex:column>
</apex:pageBlockTable>

 When an option is selected from the selectList and the image's onclick javaScript is invoked calling the "doScript" function, the value of "Type" (String) is never set to the option which was selected. However, if the image is then clicked again, it is properly set. Immediately after a change to the selectList option "item.Type" is always the prior value. Does anyone know why item.Type is not being immediately changed to the selected value in the onchange event? I also tried invoking JS onchange from the selectList, but with the same results.

 

Thanks!

I have a visualforce page overriding the standard Account detail page. In that page, I'm using <apex:detail> to display the page layout. I'm currently faced with the challenge of situationally locking down the ability to edit the record type of the Account based on some kind of Product situation. Ideally, I'd like to be able to just show/hide the [Change] link next to the record type field on the page. Is this possible by using something like Account.fields.RecordType.isAccessible?

 

If not, is there any better way than creating a separate visualforce page and putting it on the page layout? Obviously, with a rendered="{!showChangeLink}" for the [Change] link after the outputField of RecordType.Name. This solution feels like too much for such a simple requirement. I'm also aware I could just inline it above or below the apex:detail tag, but that severely limits my location options.

 

I've also considered making it read only on the page layout indefinitely, and rendering a detail button on the page depending on whether or not it can be changed. Anyone's input on this would be greatly appreciated. Thanks for reading!

Hi All,

 

I have a requirement where I need to have an 3-step approval process and each of the user should be able to enter some comments/notes to the custom object field before they go on with the approval.

 

I am a newbie to creating an approval processes using Apex code.

 

Any guidance on this will be highly appreciated.

 

Thanks

 

  • November 07, 2013
  • Like
  • 0

Hi All,

 

I am getting 'System.LimitException: Apex CPU time limit exceeded' error while reading and parsing XML as web service response.Debug log jhas reached its maximum size.

 

Below is my class:

 

public class readXMLResponseAndMapXMLDom{

 

public List<SiteSolutionProperty> getMap(){

Http http = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('URL'); // did not include the actual URL; conncetion is successful.
req.setMethod('GET');
HttpResponse res = http.send(req);
List<XmlDom.Element> result1 = new List<XmlDom.Element>();
List<SiteSolutionProperty> result2 = new List<SiteSolutionProperty>();
SiteSolutionProperty ssp;
List<SiteSolutionPropertyDetails> finalResult = new List<SiteSolutionPropertyDetails>();
Integer counter = 0;
// create the xml doc that will contain the results of the REST operation

/********* USING XMLDOM ******/
XmlDom doc = new XmlDom(res.getBody());
// process the results
//System.debug('Total Collection size ---'+doc.getElementsByTagName('ClassBrokerAvailabilities').size());
system.debug('Limits.getHeapSize()'+Limits.getHeapSize());
for (XmlDom.Element element: doc.getElementsByTagName('ClassBrokerAvailabilities')){
ssp = new SiteSolutionProperty();
//element.textContent()
if(element.getElementsByTagName('BuildingKey') !=null){
//System.out.println("IF child name "+element.getElementsByTagName("BuildingKey").item(0).getTextContent());
ssp.setBuildingKey(element.getElementsByTagName('BuildingKey').get(0).textContent());
}
if(element.getElementsByTagName('AddressLine2') !=null){
ssp.setAddressLine2(element.getElementsByTagName('AddressLine2').get(0).textContent());
}
if(element.getElementsByTagName('BuildingName') !=null){
ssp.setBuildingName(element.getElementsByTagName('BuildingName').get(0).textContent());
}
/*if(element.getElementsByTagName('BuildingOwner') !=null){
ssp.setBuildingOwner(element.getElementsByTagName('BuildingOwner').get(0).textContent());
}*/

/*if(element.getElementsByTagName('BuildingStatus') !=null){
ssp.setBuildingStatus(element.getElementsByTagName('BuildingStatus').get(0).textContent());
}*/
if(element.getElementsByTagName('City_State') !=null){
ssp.setCity_State(element.getElementsByTagName('City_State').get(0).textContent());
}
/*if(element.getElementsByTagName('DateBuilt') !=null){
ssp.setDateBuilt(element.getElementsByTagName('DateBuilt').get(0).textContent());
}*/
/*if(element.getElementsByTagName('ForSale') !=null){
ssp.setForSale(element.getElementsByTagName('ForSale').get(0).textContent());
}*/
if(element.getElementsByTagName('LeasingAgent') !=null){
ssp.setLeasingAgent(element.getElementsByTagName('LeasingAgent').get(0).textContent());
}
if(element.getElementsByTagName('MarketName') !=null){
ssp.setMarketName(element.getElementsByTagName('MarketName').get(0).textContent());
}
/*if(element.getElementsByTagName('PropertyClass') !=null){
ssp.setPropertyClass(element.getElementsByTagName('PropertyClass').get(0).textContent());
}*/
if(element.getElementsByTagName('Recordnumber') !=null){
ssp.setRecordnumber(element.getElementsByTagName('Recordnumber').get(0).textContent());
}
if(element.getElementsByTagName('Rent') !=null){
ssp.setRent(element.getElementsByTagName('Rent').get(0).textContent());
}
if(element.getElementsByTagName('Rentable') !=null){
ssp.setRentable(element.getElementsByTagName('Rentable').get(0).textContent());
}
/*if(element.getElementsByTagName('SubMarket') !=null){
ssp.setSubMarket(element.getElementsByTagName('SubMarket').get(0).textContent());
}*/
/*if(element.getElementsByTagName('Vacant') !=null){
ssp.setVacant(element.getElementsByTagName('Vacant').get(0).textContent());
}*/
result2.add(ssp);

}

return result2;
}


}

 

and the Vf page is below:

 

<apex:page controller="readXMLResponseAndMapXMLDom" standardStylesheets="false" sidebar="false">
     <apex:form >
          <apex:pageBlock >
           <!-- section for button Add Property -->
               <apex:pageBlockButtons > 
                   <apex:commandButton value="Add Selected Property" action="{!propertySelected}" rerender="table"/> 
               </apex:pageBlockButtons>    
              <apex:pageBlockTable value="{!MAP}" var="propdetails" id="table">
                  <apex:column >
                      <!-- This is our select checkbox to select Properties data -->
                      <apex:inputCheckbox value="{!propdetails.selected}"/>
                  </apex:column>
                  <!-- Site Property Solution Details --> 
                  <!-- <apex:column headerValue="Recordnumber"  value="{!propdetails.Recordnumber}" /> -->
                  <apex:column headerValue="BuildingKey"  value="{!propdetails.BuildingKey}" />                  
                 <!--  <apex:column headerValue="BuildingName"  value="{!propdetails.BuildingName}" />
                  <apex:column headerValue="AddressLine2"  value="{!propdetails.AddressLine2}" />
                  <apex:column headerValue="City_State"  value="{!propdetails.City_State}" />
                  <apex:column headerValue="MarketName"  value="{!propdetails.MarketName}" />
                  <apex:column headerValue="Rentable"  value="{!propdetails.Rentable}" />
                  <apex:column headerValue="Vacant"  value="{!propdetails.Vacant}" /> 
                  <apex:column headerValue="PropertyClass"  value="{!propdetails.PropertyClass}" />
                  <apex:column headerValue="Rent"  value="{!propdetails.Rent}" />                  
                  <apex:column headerValue="LeasingAgent"  value="{!propdetails.LeasingAgent}" />
                  <apex:column headerValue="SubMarket"  value="{!propdetails.SubMarket}" />
                  <apex:column headerValue="BuildingType"  value="{!propdetails.BuildingType}" />
                  <apex:column headerValue="BuildingStatus"  value="{!propdetails.BuildingStatus}" />
                  <apex:column headerValue="DateBuilt"  value="{!propdetails.DateBuilt}" />
                  <apex:column headerValue="ForSale"  value="{!propdetails.ForSale}" />
                  <apex:column headerValue="BuildingOwner"  value="{!propdetails.BuildingOwner}" /> -->                      
    
              </apex:pageBlockTable>
          </apex:pageBlock>
          <apex:panelGrid columns="4">
              <apex:commandLink action="{!first}">First</apex:commandlink>
              <apex:commandLink action="{!previous}" rendered="{!hasPrevious}">Previous</apex:commandlink>
              <apex:commandLink action="{!next}" rendered="{!hasNext}">Next</apex:commandlink>
              <apex:commandLink action="{!last}">Last</apex:commandlink>
          </apex:panelGrid>
      </apex:form>
  </apex:page>




  • November 07, 2013
  • Like
  • 0

Hi,

 

I'm using a pageBlockTable on my page which displays a List of a wrapper class that I created. Each "item" in the wrapper class has its own selectList component corresponding to that item's "Type", a String variable on the wrapper class with a default getter and setter. It looks like this:

 

<apex:pageBlockTable value="{!itemList}" var="item"  headerClass="displayTableHeader" >  
    <apex:column headerValue="Name">
         <apex:outputText value="{!item.Name}" id="itemName" />
    </apex:column>
    <apex:column headerValue="Type">
         <apex:selectList size="1" value="{!item.Type}">
              <apex:selectOptions value="{!typeList}"/>
         </apex:selectList> 
    </apex:column>
    <apex:column headerValue="Action">
         <apex:image value="{!$Resource.addIcon}" width="25" height="25" onclick="doScript('{!item.Name}','{!item.Type}');" />
    </apex:column>
</apex:pageBlockTable>

 When an option is selected from the selectList and the image's onclick javaScript is invoked calling the "doScript" function, the value of "Type" (String) is never set to the option which was selected. However, if the image is then clicked again, it is properly set. Immediately after a change to the selectList option "item.Type" is always the prior value. Does anyone know why item.Type is not being immediately changed to the selected value in the onchange event? I also tried invoking JS onchange from the selectList, but with the same results.

 

Thanks!