• SFine
  • NEWBIE
  • 50 Points
  • Member since 2010

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

We're working on getting a phone validation that would recognize the difference between US Numbers and International Number AND checks that no alpha characters are being used.

 

We have it so that the US numbers work correctly, but not the international numbers. The closest we've come runs into a syntax error.

 

IF(
LEFT(Phone, 1) <> "+",
NOT(REGEX(Phone, "\\D*?(\\d\\D*?){10}")),
NOT(REGEX(Phone, "\+[\d\-]+")
)

 

Any help would be appreciated.

  • October 27, 2011
  • Like
  • 0

Hello everyone

 

I'm trying to make a button that creates a record of a object return the user to a specific page after they've saved and created the record.

 

Normally this is relatively simple, but when dealing with recordtype selection first, I'm having some trouble getting it to functionl correctly. Particularly, when I put the save_new_Url value in, instead of going directly to the create record page, it goes to the url I specified. Is there a way to set the parameter for save Url on the create record page?

 

the url I'm using is like so:

 

/setup/ui/recordtypeselect.jsp?ent=01I30000001kSPj&retURL=%2F'+O.Id+'&save_new_url=/apex/DemoRequestProductBulkAdd%3FCF00N30000007JPKN%3D'+O.Name+'%26CF00N30000007JPKN_lkid%3D'+O.Id+'%26CF00N30000007JPK9%3D'+O.Account.name+'%26CF00N30000007JPK9_lkid%3D'+O.AccountId+'%26retURL%3D%252F'+O.Id

 

Thanks in advanced.

 

 

  • September 22, 2011
  • Like
  • 0

Hello, I'm trying to set up something so that when users select from a list of accounts that they would be brought over to a VF page, where they'll get exported into a spread sheet.

 

This mostly works, but I'm having a issue with transferring the ids from one page to the other. I've tried using a global variable and while I can populate it, it doesn't seem to carry over. Any ideas?

 

Global Class

 

global class Configero_DupeIDs {
 
 public static Boolean Ready = false;
 global static List<ID> dupeIds=new List<ID>();
 
  public static void setDupeIDs(List<ID> d){
  dupeids=d;
 }
 public static List<ID> getDupeIDs(){
  return dupeids;
 }
 
 public static void setReady(boolean r){
  ready=r;
 }
 public static boolean getReady(){
  return ready;
 }
 
 public static testMethod void testSkipTriggers(){
    list<id> ids=new list<id>();
    list <account> aids=[select id from account limit 10];
    for(account a:aids)
        ids.add(a.id);
    //SkipTriggers.dupeIds=ids;
    
        Configero_DupeIDs.setDupeIds(ids);
    

List<ID> getb;
      getb=  Configero_DupeIDs.getDupeIds();
    
    getb=Configero_DupeIDs.DupeIds;
 }
 
}

 Export method (This seems to work)

 public void Export(){
     Configero_DupeIDS.dupeids=new List<ID>();
     List<ID> dids=new List<ID>();
     System.debug('withdupelist '+withdupelist);
     for(DupeWrapper wd:withdupelist)
     {
         
     System.debug('accwrap '+wd.dupelist);
         for(AccountWrapper aw:wd.dupelist)
         {
             system.debug('aw ' +aw);
             if(aw.selected)
             {   dids.add(aw.acc.id);
             }
         }
     }
     System.debug('Dids '+dids);
     Configero_DupeIDS.setDupeids(dids);
     System.debug('Configero_DupeIDs.dupeids '+Configero_DupeIDs.dupeids);
 }

 Retrieving the ids method on another page/controller

public with sharing class DuplicationController {

    public DuplicationController(ApexPages.StandardSetController controller) {
        init();
    }


    public List<Account> DupeList { get; set; }
    
    public DuplicationController()
    {
        init();
    }
    
    public void init(){
    
        system.debug('Dupeids '+configero_dupeids.getdupeids());
        List <ID> dids=configero_dupeids.getdupeids();
        DupeList=[select id from Account where id in: dids];
        
        
    }
}

 

  • September 06, 2011
  • Like
  • 0

Hey everyone, I'm getting a "Error: Failed to parse wsdl: Unsupported Schema element found http://www.w3.org/2001/XMLSchema:attribute. At: 220:57" message when I try parsing a wsdl.

 

I'm still relatively new to wsdl and webservices, and was wondering if someone could point out the issue in the code. Any help is appreciated.

 

<?xml version="1.0" encoding="UTF-8"?>
<!--Created by TIBCO WSDL-->
<wsdl:definitions xmlns:ns1="http://www.medassets.com/ESB/schemas/EsbEnvelope.xsd" xmlns:tns="http://www.medassets.com/ESB/Match/service/1.0.0/EsbMatchingService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns0="http://www.medassets.com/ESB/MatchingService/schemas/1.0.0/MatchQuery.xsd" xmlns:jms="http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS" xmlns:soap1="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jndi="http://www.tibco.com/namespaces/ws/2004/soap/apis/jndi" name="Untitled" targetNamespace="http://www.medassets.com/ESB/Match/service/1.0.0/EsbMatchingService">
    <wsdl:documentation>Enterprise Service to perform TIBCO Matching Engine Matches</wsdl:documentation>
    <wsdl:types>
        <xs:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:esbms="http://www.medassets.com/ESB/MatchingService/schemas/1.0.0/MatchQuery.xsd" xmlns:esbenv="http://www.medassets.com/ESB/schemas/EsbEnvelope.xsd" targetNamespace="http://www.medassets.com/ESB/MatchingService/schemas/1.0.0/MatchQuery.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
            <import namespace="http://www.medassets.com/ESB/schemas/EsbEnvelope.xsd"/>
            <simpleType name="name">
                <restriction base="xs:string"/>
            </simpleType>
            <simpleType name="score">
                <restriction base="xs:double">
                    <maxInclusive value="1.0E0"/>
                    <minInclusive value="0.0E0"/>
                </restriction>
            </simpleType>
            <simpleType name="weight">
                <restriction base="xs:double">
                    <maxInclusive value="1.0E0"/>
                    <minInclusive value="0.0E0"/>
                </restriction>
            </simpleType>
            <element name="CognateQuery">
                <complexType>
                    <sequence>
                        <element ref="esbms:weight" minOccurs="0"/>
                        <element name="Field" minOccurs="0" maxOccurs="unbounded">
                            <complexType>
                                <sequence>
                                    <element ref="esbms:name"/>
                                    <element ref="esbms:weight" minOccurs="0"/>
                                    <element ref="esbms:query"/>
                                </sequence>
                            </complexType>
                        </element>
                        <element name="nonCognateWeight" type="esbms:weight"/>
                        <element ref="esbms:Options" minOccurs="0"/>
                    </sequence>
                </complexType>
            </element>
            <element name="Config">
                <complexType>
                    <sequence>
                        <element ref="esbms:maxMatches" minOccurs="0"/>
                        <element ref="esbms:scoreType" minOccurs="0"/>
                        <element ref="esbms:predicate" minOccurs="0"/>
                        <element ref="esbms:cutOffType" minOccurs="0"/>
                        <element ref="esbms:cutOffValue" minOccurs="0"/>
                    </sequence>
                </complexType>
            </element>
            <element name="CustomDateQuery">
                <complexType>
                    <sequence>
                        <element ref="esbms:weight" minOccurs="0"/>
                        <element ref="esbms:query"/>
                        <element name="Field">
                            <complexType>
                                <sequence>
                                    <element ref="esbms:name"/>
                                </sequence>
                            </complexType>
                        </element>
                        <element ref="esbms:emptyScore" minOccurs="0"/>
                        <element ref="esbms:invalidScore" minOccurs="0"/>
                    </sequence>
                </complexType>
            </element>
            <element name="Match">
                <complexType>
                    <sequence>
                        <element ref="esbms:score" minOccurs="0"/>
                        <element ref="esbms:subScore" minOccurs="0"/>
                        <element ref="esbms:recordKey" minOccurs="0"/>
                        <element name="Field" minOccurs="0" maxOccurs="unbounded">
                            <complexType>
                                <sequence>
                                    <element ref="esbms:name" minOccurs="0"/>
                                    <element ref="esbms:value" minOccurs="0"/>
                                </sequence>
                            </complexType>
                        </element>
                    </sequence>
                </complexType>
            </element>
            <element name="MatchRequest">
                <complexType>
                    <sequence>
                        <element ref="esbms:Query" maxOccurs="unbounded"/>
                    </sequence>
                </complexType>
            </element>
            <element name="MatchResponse">
                <complexType>
                    <sequence>
                        <element ref="esbms:Matches" maxOccurs="unbounded"/>
                    </sequence>
                </complexType>
            </element>
            <element name="Matches">
                <complexType>
                    <sequence>
                        <element ref="esbms:matchTime" minOccurs="0"/>
                        <element ref="esbms:Match" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="esbenv:Fault" minOccurs="0"/>
                    </sequence>
                    <attribute ref="esbms:queryId" name="QueryID" type="xs:string"/>
                </complexType>
            </element>
            <element name="Options">
                <complexType>
                    <sequence>
                        <element ref="esbms:Thesaurus" minOccurs="0"/>
                        <element ref="esbms:emptyScore" minOccurs="0"/>
                        <element ref="esbms:invalidScore" minOccurs="0"/>
                        <element ref="esbms:XOptions" minOccurs="0" maxOccurs="unbounded"/>
                    </sequence>
                </complexType>
            </element>
            <element name="PredicateQuery">
                <complexType>
                    <sequence>
                        <element ref="esbms:predicate"/>
                        <element ref="esbms:weight" minOccurs="0"/>
                    </sequence>
                </complexType>
            </element>
            <element name="Query">
                <complexType>
                    <sequence>
                        <element ref="esbms:table"/>
                        <element ref="esbms:SimpleQuery" maxOccurs="unbounded"/>
                        <element ref="esbms:CognateQuery" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="esbms:CustomDateQuery" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="esbms:PredicateQuery" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="esbms:Config" minOccurs="0"/>
                    </sequence>
                    <attribute ref="esbms:queryId" name="ID" type="xs:string"/>
                </complexType>
            </element>
            <element name="SimpleQuery">
                <complexType>
                    <sequence>
                        <element ref="esbms:query"/>
                        <element ref="esbms:weight" minOccurs="0"/>
                        <element name="Field" minOccurs="0" maxOccurs="unbounded">
                            <complexType>
                                <sequence>
                                    <element ref="esbms:name"/>
                                    <element ref="esbms:weight" minOccurs="0"/>
                                </sequence>
                            </complexType>
                        </element>
                        <element ref="esbms:Options" minOccurs="0"/>
                    </sequence>
                </complexType>
            </element>
            <element name="Thesaurus">
                <complexType>
                    <sequence>
                        <element ref="esbms:name"/>
                        <element ref="esbms:weight" minOccurs="0"/>
                    </sequence>
                </complexType>
            </element>
            <element name="XOptions">
                <complexType>
                    <sequence>
                        <element ref="esbms:id"/>
                        <element ref="esbms:value"/>
                    </sequence>
                </complexType>
            </element>
            <element name="cutOffType">
                <simpleType>
                    <restriction base="xs:string">
                        <enumeration value="none"/>
                        <enumeration value="absolute"/>
                        <enumeration value="gap"/>
                        <enumeration value="percentage"/>
                        <enumeration value="exact"/>
                    </restriction>
                </simpleType>
            </element>
            <element name="cutOffValue">
                <simpleType>
                    <restriction base="xs:int">
                        <maxInclusive value="100"/>
                        <minInclusive value="0"/>
                    </restriction>
                </simpleType>
            </element>
            <element name="emptyScore" type="esbms:score"/>
            <element name="id" type="xs:int"/>
            <element name="invalidScore" type="esbms:score"/>
            <element name="matchTime" type="xs:double"/>
            <element name="maxMatches" type="xs:int"/>
            <element name="name" type="esbms:name"/>
            <element name="predicate" type="xs:string"/>
            <element name="query" type="xs:string"/>
            <element name="recordKey" type="xs:string"/>
            <element name="score" type="esbms:score"/>
            <element name="scoreType">
                <simpleType>
                    <restriction base="xs:string">
                        <enumeration value="normal"/>
                        <enumeration value="symmetric"/>
                        <enumeration value="reverse"/>
                        <enumeration value="min"/>
                        <enumeration value="max"/>
                        <enumeration value="it"/>
                    </restriction>
                </simpleType>
            </element>
            <element name="subScore" type="xs:string"/>
            <element name="table" type="esbms:name"/>
            <element name="thesaurusWeight" type="esbms:weight"/>
            <element name="value" type="xs:string"/>
            <element name="weight" type="esbms:weight"/>
            <attribute name="queryId" type="xs:string"/>
        </schema>
        <xs:schema xmlns="http://www.medassets.com/ESB/schemas/EsbEnvelope.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.medassets.com/ESB/schemas/EsbEnvelope.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
            <xs:element name="Fault">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="ns1:code" minOccurs="0"/>
                        <xs:element ref="ns1:message" minOccurs="0"/>
                        <xs:element ref="ns1:details" minOccurs="0"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="Header">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element ref="ns1:applicationID"/>
                        <xs:element ref="ns1:componentName" minOccurs="0"/>
                        <xs:element ref="ns1:hostname" minOccurs="0"/>
                        <xs:element ref="ns1:timestamp" minOccurs="0"/>
                        <xs:element ref="ns1:transactionDomain" minOccurs="0"/>
                        <xs:element ref="ns1:transactionType" minOccurs="0"/>
                        <xs:element ref="ns1:transactionID"/>
                        <xs:element ref="ns1:correlationID" minOccurs="0"/>
                        <xs:element ref="ns1:environment" minOccurs="0"/>
                        <xs:element ref="ns1:userID" minOccurs="0"/>
                        <xs:element ref="ns1:dataCenterID" minOccurs="0"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="applicationID" type="xs:string"/>
            <xs:element name="code" type="xs:string"/>
            <xs:element name="componentName" type="xs:string"/>
            <xs:element name="correlationID" type="xs:string"/>
            <xs:element name="dataCenterID" type="xs:string"/>
            <xs:element name="details" type="xs:string"/>
            <xs:element name="environment" type="xs:string"/>
            <xs:element name="hostname" type="xs:string"/>
            <xs:element name="message" type="xs:string"/>
            <xs:element name="timestamp" type="xs:dateTime"/>
            <xs:element name="transactionDomain" type="xs:string"/>
            <xs:element name="transactionID" type="xs:string"/>
            <xs:element name="transactionType" type="xs:string"/>
            <xs:element name="userID" type="xs:string"/>
        </xs:schema>
    </wsdl:types>
    <wsdl:service name="EsbMatchingService.serviceagent">
        <wsdl:port name="MatchQueryJmsEndpoint" binding="tns:MatchQueryJmsEndpointBinding">
            <soap:address location=""/>
            <jms:connectionFactory>QueueConnectionFactory</jms:connectionFactory>
            <jms:targetAddress destination="queue">MA.ESB.MATCH.SERVICE.QUERY.V1</jms:targetAddress>
        </wsdl:port>
        <wsdl:port name="MatchQueryHttpEndpoint" binding="tns:MatchQueryHttpEndpointBinding">
            <soap:address location="http://localhost:10700/EsbMatchingService/MatchQueryHttpEndpoint"/>
        </wsdl:port>
    </wsdl:service>
    <wsdl:portType name="MatchQueryPort">
        <wsdl:operation name="MatchQueryOp">
            <wsdl:input message="tns:MatchQueryReqMsg"/>
            <wsdl:output message="tns:MatchQueryRespMsg"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="MatchQueryJmsEndpointBinding" type="tns:MatchQueryPort">
        <soap:binding style="document" transport="http://www.tibco.com/namespaces/ws/2004/soap/binding/JMS"/>
        <jms:binding messageFormat="bytes"/>
        <wsdl:operation name="MatchQueryOp">
            <soap:operation style="document" soapAction="/EsbMatchingService/MatchQueryJmsEndpoint/MatchQueryOp"/>
            <wsdl:input>
                <soap:body use="literal" parts="input"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" parts="output"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="MatchQueryHttpEndpointBinding" type="tns:MatchQueryPort">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="MatchQueryOp">
            <soap:operation style="document" soapAction="/EsbMatchingService/MatchQueryHttpEndpoint/MatchQueryOp"/>
            <wsdl:input>
                <soap:body use="literal" parts="input"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" parts="output"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:message name="MatchQueryReqMsg">
        <wsdl:part name="input" element="ns0:MatchRequest"/>
    </wsdl:message>
    <wsdl:message name="MatchQueryRespMsg">
        <wsdl:part name="output" element="ns0:MatchResponse"/>
    </wsdl:message>
</wsdl:definitions>

 

 

  • September 01, 2011
  • Like
  • 0

Hello everyone,

 

I'm currently trying to get a field to change on the opportunity when it's converted from a lead, using a custom field from the lead itself. However, I can't seem to get it change properly. My code is below. Any advice would be appreciated

 

trigger Configero_Lead_OpportunityConversion on Lead (before update) {

List<Opportunity> o = new List<Opportunity>();
List<ID> oids=new List<id>();
       for(Lead convertedLead: Trigger.new){

if(convertedLead.IsConverted == TRUE && convertedLead.ConvertedOpportunityId != NULL){               
oids.add(convertedLead.ConvertedOpportunityId);

}

o=[select id from opportunity where id IN: oids];

for(Lead convertedLead: Trigger.new){
    for(opportunity op:o)
    {
        if(op.id==convertedlead.ConvertedOpportunityId)
            op.name+=convertedLead.Proposed_Opportunity_Name__c;
    }
}

upsert o;

}

 

  • August 23, 2011
  • Like
  • 0

I'm trying to write a testMethod for a lead approval process but despite my research and best efforts, I keep getting the error: System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval process found.: []

 

Any recommendations? Below is the code.

 

static testMethod void test_LeadFunctionality_Tests(){
  Lead l=new Lead();
  l.lastname='Test';
  l.Company='Test';
  insert l;
 
  // Create an approval request for the lead 
   
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitting request for approval.');
req1.setObjectId(l.id);

// Submit the approval request for the lead 
   
Approval.ProcessResult result = Approval.process(req1); //This is where the error occurs

// Verify the result 
   
System.assert(result.isSuccess());

System.assertEquals('Pending', result.getInstanceStatus(), 'Instance Status'+result.getInstanceStatus());

// Approve the submitted request 
   

// First, get the ID of the newly created item 
   
List<Id> newWorkItemIds = result.getNewWorkitemIds();

// Instantiate the new ProcessWorkitemRequest object and populate it 
   
Approval.ProcessWorkitemRequest req2 = new Approval.ProcessWorkitemRequest();
req2.setComments('Approving request.');
req2.setAction('Reject');
req2.setNextApproverIds(new Id[] {UserInfo.getUserId()});

// Use the ID from the newly created item to specify the item to be worked 
   
req2.setWorkitemId(newWorkItemIds.get(0));

// Submit the request for approval 
   
Approval.ProcessResult result2 =  Approval.process(req2);

// Verify the results 
   
System.assert(result2.isSuccess(), 'Result Status:'+result2.isSuccess());

System.assertEquals('Approved', result2.getInstanceStatus(), 'Instance Status'+result2.getInstanceStatus());
}

  • August 22, 2011
  • Like
  • 0

Hey guys,

 

I've looked around but can't find a clear answer. Is it possible to trigger off the Approval object and if not, is it possible to get the comments of a approval process?

  • August 22, 2011
  • Like
  • 0

Hey guys,

 

I've been looking into the Content Delivery wizard and was wondering if there's a way beyond Visual Force in order to add a button to the content delivery wizard.

 

I look forward to your response.

  • August 08, 2011
  • Like
  • 0

Hello everyone,

 

At the moment, I'm trying to implement a validation rule that would check to see that certain characters are used/not used.

 

The description is basically: Available Charactersare: 0-9   a-z   A-Z.  ,  -  /  &  [blank space]

 

I figure I would need to use REGEX for this, but I'm not completely familiar with REGEX, so after doing some reading and research I came up with this:

 

REGEX ( Business_Owner_First_Name__c , "[a-zA-Z0-9 // /, /& - / ] {50}")

 

Now I know I probably have a number of things wrong with this logic and the testing seems to suggest that.

 

If any REGEX experts might be able to help, I'd be very appreciative.

  • August 01, 2011
  • Like
  • 0

Hello, I'm trying to implement afunction for a client where they can track hours. They want to add a function that if certain quote line items are in the opportunity, then they can be select and have hours ran against them.

 

This mostly works, but there's one issue I want to do and that's when initially making the hours record, the user select an opportunity but without an opportunity initially, there are no quote line items to select. I've attempting implementing Action Support, but it doesn't seem to work. Below is my VF code and Apex code:

 

 

<apex:page standardController="PM_Hours__c" extensions="PMEditController" >



    <apex:sectionHeader title="PM Hours Edit" subtitle="{!PM_Hours__c.name}"/>
    <apex:form >
        <apex:pageBlock title="PM Hours Edit" id="thePageBlock" mode="edit">
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>                
            </apex:pageBlockButtons>
            <apex:actionRegion >
                <apex:pageBlockSection title="Information" columns="2">
                    
                    <apex:inputField value="{!PM_Hours__c.Opportunity__c}" required="true"/>
                    <apex:actionSupport event="onchange" reRender="lineitem" action="{!getTrackedProducts}"/>
                    
                    <apex:inputField value="{!PM_Hours__c.Date_of_Entry__c}" required="true"/>
                    <apex:outputText value=""/>
                    <apex:inputField value="{!PM_Hours__c.Number_of_Hours__c}" required="true"/>
                    <apex:inputField value="{!PM_Hours__c.Activity_Category__c}" required="true"/>
                    <apex:inputField value="{!PM_Hours__c.Hourly_Rate__c}"/>
                    <apex:inputField value="{!PM_Hours__c.Job_Function__c}" required="true"/>
                    <apex:outputfield value="{!PM_Hours__c.Total__c}"/>
                    <apex:inputField value="{!PM_Hours__c.Task__c}" required="true"/>
                    <apex:inputfield value="{!PM_Hours__c.Billable__c}"/>
                    <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Quote Line Item" for="lineitem"/>
                    
                    <apex:selectList value="{!PM_Hours__c.Quote_Line_Item__c}" multiselect="false" size="1" id="lineitem">
                      <apex:selectOptions value="{!TrackedProducts}"/>
                    </apex:selectList>
                    </apex:pageBlockSectionItem>
                    <apex:inputField value="{!PM_Hours__c.Notes__c}"/>
                </apex:pageBlockSection>
            </apex:actionRegion>
            
        </apex:pageBlock>
        <apex:pageBlock title="User Time Table" id="TimeTable" mode="edit">
            <c:UserHoursVF2 />
            
        </apex:pageBlock>
    </apex:form>
    
<!--    <div id="PH-dialog">
    <apex:form >
        <apex:pageBlock title="" mode="edit">
            <apex:facet name="header"><div></div></apex:facet>
            <apex:pageBlockSection title="Project Hour Details" columns="1">
                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Project Name" for="PHName"/>
                    <apex:panelGroup >
                        <apex:outputText value="" id="PHName" style="width: 300px; height: 100px;"/>
                        </apex:panelGroup>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Assigned To" for="ownerId"/>
                    <apex:panelGroup >
                    <div id="phOwnerId">
                        <apex:outputText value="" id="ownerId" style="width: 300px;"/>
                    </div> 
                    </apex:panelGroup>
                </apex:pageBlockSectionItem> 
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Hourly Rate" for="HourRate"/>
                    <apex:panelGroup >
                        <apex:outputText value="" id="HourRate" style="width: 300px; height: 100px;"/>
                        </apex:panelGroup>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Number of Hours" for="NumHour"/>
                    <apex:panelGroup >
                        <apex:outputText value="" id="NumHour"/>
                        </apex:panelGroup>
                </apex:pageBlockSectionItem>
                
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
  </div>-->
  
  
</apex:page>

 

public with sharing class PMEditController {

 public Id UserID {get; set;}
 
 public Opportunity opp {get; set;}
 
 public User activeUser {get; set;}
 
 public PM_Hours__c[] PH {get; set;}
 
 public List<ProjectItem> PI {get; set;}
 
 public Map<ID,ProjectItem> ProjectMap {get;set;}
 
 public date today{get;set;}

 public String PHID {get; set;}
 
 public decimal pSunTot{get;set;}
 public decimal pMonTot{get;set;}
 public decimal pTueTot{get;set;}
 public decimal pWedTot{get;set;}
 public decimal pThuTot{get;set;}
 public decimal pFriTot{get;set;}
 public decimal pSatTot{get;set;}
 public decimal SunTot{get;set;}
 public decimal MonTot{get;set;}
 public decimal TueTot{get;set;}
 public decimal WedTot{get;set;}
 public decimal ThuTot{get;set;}
 public decimal FriTot{get;set;}
 public decimal SatTot{get;set;}
 
 public decimal total{get;set;}
 public decimal ptotal{get;set;}

 public PMEditController()
 {
        init();
 }
 
 public PMEditController(ApexPages.StandardController controller)
 {
        init();
 }

 public void init(){
        
        PHID=System.currentPageReference().getParameters().get('id');
        
        Date Late=date.Today().toStartOfWeek().addDays(6);
        Date Earl=date.Today().addDays(-7).toStartOfWeek();
        today=date.Today();
        pSunTot=0;
    pMonTot=0;
    pTueTot=0;
    pWedTot=0;
        pThuTot=0;
        pFriTot=0;
        pSatTot=0;
        SunTot=0;
    MonTot=0;
    TueTot=0;
    WedTot=0;
        ThuTot=0;
        FriTot=0;
        SatTot=0;
   activeUser=[select id from user where id =:userInfo.getUserId() limit 1];
   PH=[select Opportunity__c, Opportunity__r.name, Date_of_Entry__c, Number_of_Hours__c from PM_Hours__c where CreatedByID=:ActiveUser.Id and Date_of_Entry__c>=:Earl and Date_of_Entry__c<=:Late];
   PI=new list<ProjectItem>();
   System.debug('PH '+PH);
   ProjectMap=new Map<ID,ProjectItem>();
   for(PM_Hours__c Pm:PH)
   {
        PM p=new PM();
        p.pm=Pm;
        if(p.pm.Opportunity__c!=null && p.pm.Number_of_Hours__c!=null)
        if(ProjectMap.get(p.pm.Opportunity__c)==null)
        {       
                ProjectItem I=new ProjectItem();
                
                if(p.pm.Id==phid)
                        p.current=true;
                I.AssAcc=p.pm.Opportunity__r.name;
                I.AccID=p.pm.Opportunity__c;
                if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek())
                {
                        i.PSunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSunTot+=p.pm.Number_of_Hours__c;
                        
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(1))
                {
                        i.PMonList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pMonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(2))
                {
                        i.PTueList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pTueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(3))
                {
                        i.PWedList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pWedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(4))
                {
                        i.PThuList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(5))
                {
                        i.PFriList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pFriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(6))
                {
                        i.PSatList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSatTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek())
                {
                        i.SunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        SunTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(1))
                {
                        i.MonList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        MonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(2))
                {
                        i.TueList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        TueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(3))
                {
                        i.WedList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        WedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(4))
                {
                        i.ThuList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        ThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(5))
                {
                        i.FriList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        FriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(6))
                {
                        i.SatList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        SatTot+=p.pm.Number_of_Hours__c;
                }
                ProjectMap.put(p.pm.opportunity__c,I);
        }
        else
        {
                ProjectItem I=ProjectMap.get(p.pm.Opportunity__c);
                if(p.pm.Id==phid)
                        p.current=true;
                if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek())
                {
                        i.PSunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSunTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(1))
                {
                        i.PMonList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pMonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(2))
                {
                        i.PTueList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pTueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(3))
                {
                        i.PWedList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pWedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(4))
                {
                        i.PThuList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(5))
                {
                        i.PFriList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pFriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(6))
                {
                        i.PSatList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSatTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek())
                {
                        i.SunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        SunTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(1))
                {
                        i.MonList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        MonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(2))
                {
                        i.TueList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        TueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(3))
                {
                        i.WedList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        WedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(4))
                {
                        i.ThuList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        ThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(5))
                {
                        i.FriList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        FriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(6))
                {
                        i.SatList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        SatTot+=p.pm.Number_of_Hours__c;
                }
                ProjectMap.put(p.pm.Opportunity__c,I);
        }
   
   }
   total=suntot+montot+tuetot+wedtot+thutot+fritot+sattot;
   ptotal=psuntot+pmontot+ptuetot+pwedtot+pthutot+pfritot+psattot;
   PI=ProjectMap.Values();
  }
 
 public List<SelectOption> getTrackedProducts()
 {      
        List<Quote_Line_Item__c> qlilist;
 try{
        opp=[select id from Opportunity where id=:[select opportunity__c from PM_Hours__c where id=:phid limit 1].opportunity__c limit 1];
         qlilist=[select id, description__c, name from Quote_Line_Item__c where Opportunity__c=:opp.id and (name='STXPS-PRJMGT-310' or name='STXPS-PRJMGT-301' or name='STXPS-PRJMGT-302')];
        system.debug(qlilist);
 }
 catch(exception e){qlilist=new List<Quote_Line_Item__c>();}
  List<SelectOption> QuoteLineEntries = new List<SelectOption> ();
  SelectOption pbeoptionBlank = new SelectOption('','-- blank --');
  QuoteLineEntries.add( pbeoptionBlank );

  for(Quote_line_item__c qli:qlilist){
   String label=qli.Description__c;
   if(label==null || label==''){
    label=qli.Name;
   }
   SelectOption pbeoption = new SelectOption(qli.Id,label);
   QuoteLineEntries.add( pbeoption );
  }
  return QuoteLineEntries;
 
 
 }
 
 class PM
 {
        public PM_Hours__c pm{get;set;}
        public boolean current{get;set;}
        
        public PM(){
                current=false;
        }
 }

 class ProjectItem{
  public String AssAcc{get;set;}
  public ID AccID{get;set;}
  public List<PM> PSunList{get;set;}
  public List<PM> PMonList{get;set;}
  public List<PM> PTueList{get;set;}
  public List<PM> PWedList{get;set;}
  public List<PM> PThuList{get;set;}
  public List<PM> PFriList{get;set;}
  public List<PM> PSatList{get;set;}
  public List<PM> SunList{get;set;}
  public List<PM> MonList{get;set;}
  public List<PM> TueList{get;set;}
  public List<PM> WedList{get;set;}
  public List<PM> ThuList{get;set;}
  public List<PM> FriList{get;set;}
  public List<PM> SatList{get;set;}
  
  public Date PSun{get;set;}
  public Date PMon{get;set;}
  public Date PTue{get;set;}
  public Date PWed{get;set;}
  public Date PThu{get;set;}
  public Date PFri{get;set;}
  public Date PSat{get;set;}
  public Date Sun{get;set;}
  public Date Mon{get;set;}
  public Date Tue{get;set;}
  public Date Wed{get;set;}
  public Date Thu{get;set;}
  public Date Fri{get;set;}
  public Date Sat{get;set;}
  
  public decimal LastTotal{get;set;}
  public decimal ThisTotal{get;set;}
  
  
  
  public ProjectItem(){
   Date LastWeek=date.today().addDays(-7).tostartofWeek();
   Date ThisWeek=date.today().tostartofWeek();
   PSun=LastWeek;
   PMon=LastWeek.addDays(1);
   PTue=LastWeek.addDays(2);
   PWed=LastWeek.addDays(3);
   PThu=LastWeek.addDays(4);
   PFri=LastWeek.addDays(5);
   PSat=LastWeek.addDays(6);
   Sun=ThisWeek;
   Mon=ThisWeek.addDays(1);
   Tue=ThisWeek.addDays(2);
   Wed=ThisWeek.addDays(3);
   Thu=ThisWeek.addDays(4);
   Fri=ThisWeek.addDays(5);
   Sat=ThisWeek.addDays(6);
   
   PSunList=new List<PM>();
   PMonList=new List<PM>();
   PTueList=new List<PM>();
   PWedList=new List<PM>();
   PThuList=new List<PM>();
   PFriList=new List<PM>();
   PSatList=new List<PM>();
   SunList=new List<PM>();
   MonList=new List<PM>();
   TueList=new List<PM>();
   WedList=new List<PM>();
   ThuList=new List<PM>();
   FriList=new List<PM>();
   SatList=new List<PM>();
   
   LastTotal=0;
   ThisTotal=0;
  }

 }

}

 

Thanks in advanced

 

  • June 01, 2011
  • Like
  • 0

Hello everyone, I'm trying to make a document a word document and for the most part it works, but there's one main issue and that's the fact that the font inside the tables is much larger than the surrounded text. I've trying altering the font-size, but to no avail. Any suggestions?

  • May 13, 2011
  • Like
  • 0

Hello everyone, I'm have a bit of trouble trying to a trigger that will update a multipicklist value correctly but the code I'm using seem to cancel out all the semi colons I put in. Also, when the value is blank, it'll always return null despite my efforts to prevent it from doing so. Can anyone provide an idea? Below is the code I'm using:

 

 

trigger SaleContractUpdate on Covered_Account__c (After insert, after update) {

    List<Opportunity> OppList=new List<Opportunity>();
    List<Covered_Account__c> CAList=new List<Covered_Account__c>();
    Set<Id> trackOppProdUpdate = new Set<Id>();

    List<ID> OIDS=new List<ID>();
    List<ID> opIDS=new List<ID>();
    List<ID> CAIDS=new List<ID>();

    for (Covered_Account__c obj : Trigger.new) {
    //        Covered_account__c oldObj=trigger.oldmap.get(obj.id)
        Oids.add(obj.Opportunity_Name__c);
        if((trigger.isInsert || (trigger.oldmap.get(obj.id).opportunity_Product__c!=obj.Opportunity_Product__c)))
        opids.add(obj.Opportunity_product__c);
  }

    oppList=[select Sale_Contracting_Event_Type__c, id from Opportunity where id IN: oids];
    CAList=[select id, sale_Type__c, Opportunity_Name__c from Covered_Account__c where Opportunity_Name__c IN: oids];
    
    List<Opportunity> olist=new List<Opportunity>();
    for(Opportunity opp:opplist)
    {   String entry='';
        Set<String> track=new Set<String>(); 
        for(covered_account__c op:calist){
            if(op.Opportunity_Name__c == opp.id)
            {
                if(!track.contains(op.Sale_Type__c) && (op.sale_type__c!=null && op.sale_type__c!='null' && op.sale_type__c!=''))
                {   system.debug('sales type '+op.Sale_Type__c);
                    entry+=op.Sale_Type__c+'; ';
                    track.add(op.Sale_Type__c);
                }
            }
            System.debug('entry '+entry);
        }
        if(entry.length()>0)
            entry=Entry.substring(0,entry.length()-1);
        
        system.debug('opp '+opp);   
        opp.Sale_Contracting_Event_Type__c=entry;
        
        system.debug('opp '+opp);
        update opp;
        system.debug('opp '+opp);
    }
  //  update oList;
}

 

Any help would be appreciated

 

  • May 12, 2011
  • Like
  • 0

Hello,

 

My organization is making a unique VF page for Accounts which involves the use of radio buttons that update the page. The problem isn't so much getting the buttons to work at all, but for some reason the buttons don't work on Chrome while they work fine on firefox. Is there a particular reason this is the case? Is there some way to make is so the radio buttons work for chrome as well?

 

Thanks in advanced and I eagerly await a reply.

  • April 27, 2011
  • Like
  • 0

Hello, I'm trying to utilize a piece of AppShare for hierarchy presentation which drops down and closes when clicked, found here: http://appexchange.salesforce.com/listingDetail?listingId=a0N300000016chCEAQ

 

However, my company modified the code a bit to be a bit more universal in terms of our client, but for some reason, the drop down and closing features don't work.

 

Here is the VF code we used:

 

 

<apex:component Controller="AccountStructure" >
    <apex:attribute name="currentId" description="This is the Account Id for displaying Acccount Hierarchy" type="String" required="true" assignTo="{!currentId}"/>
  
  <div id="account-hierarchy">
  <table style="width: 100%">
   <tr>
    
    <td valign="top"  width="33%">  
    <apex:repeat value="{!ObjectStructures}" var="ObjectStructur" >  
    <h3>{!ObjectStructur.title}</h3>
    <div class="treeNode">  
       <apex:repeat value="{!ObjectStructur.asms}" var="pos" >
            <apex:repeat value="{!pos.levelFlag}" var="flag" first="0">
                <apex:image url="/img/tree/empty.gif" height="16" width="20" rendered="{!IF(flag,false,true)}"/>
                <apex:image url="/s.gif" alt="" width="3" height="16" rendered="{!IF(flag,true,false)}"/>
                <apex:image url="/img/tree/chain.gif" height="16" width="20" rendered="{!IF(flag,true,false)}"/>
            </apex:repeat>
            <span height="16" v="top">
           <apex:outputText rendered="{!IF(pos.nodeType=='start',true,false)}">
                <apex:image id="tree_start" url="/img/tree/minusStart.gif" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_start" url="/img/icon/custom51_100/globe16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_start_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='parent',pos.nodeType=='parent_end'),true,false)}">
                <apex:image id="Tree_parent" url="/img/tree/minus.gif" rendered="{!IF(pos.nodeType=='parent',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_parent_end" url="/img/tree/minusEnd.gif" rendered="{!IF(pos.nodeType=='parent_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>                
                <apex:image id="Icon_parent" url="/img/icon/factory16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_parent_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child',pos.nodeType=='child_end'),true,false)}">
                <apex:image id="Tree_child" url="/img/tree/node.gif" rendered="{!IF(pos.nodeType=='child',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_child_current" url="/img/tree/nodeEnd.gif" rendered="{!IF(pos.nodeType=='child_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_child" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>    
                <apex:image id="Icon_child_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(pos.nodeType=='end',true,false)}">
                <apex:image id="Tree_end" url="/img/tree/nodeEnd.gif" height="16" width="20"/>
                <apex:image id="Icon_end" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_end_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
<!-- Change Below -->
            <apex:outputLink value="/{!pos.account.id}" style="{!IF(pos.currentNode,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!pos.account.name}</apex:outputLink>

<!-- Include the following if you uses sites with accounts -->

            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Parent_Type__c}" rendered="{!IF(pos.account.Parent_Type__c != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Account_Sub_Type__c}" rendered="{!IF(pos.account.Account_Sub_Type__c != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Industry}" rendered="{!IF(pos.account.Industry!= '', true, false)}"/>&nbsp;
<!-- Stop -->
            </span>
            <div> </div>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),false,true)}">
                <div id='{!pos.nodeId}'></div>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),true,false)}">
                <div id='{!pos.nodeId}'><apex:image url="/s.gif" alt="" width="1" height="1"/></div>
            </apex:outputText>
            <apex:repeat value="{!pos.closeFlag}" var="close"></apex:repeat>    
   
            </apex:repeat>
        </div>   
    </apex:repeat> 
   </td>
   <td valign="top" width="33%">
   <div style="padding-bottom: 20px;">  
   <h1>Groups</h1>
   </div>
   <apex:repeat value="{!Groups}" var="group" >  
    <h3><a href="/{!group.Id}" target="_blank">{!group.Name}</a></h3>
    <div class="treeNode"> 
     <apex:outputPanel rendered="{!group.size>100}">This group has more than 100 accounts. Click on the group name to view all accounts.</apex:outputPanel>
     <apex:outputPanel rendered="{!group.size<=100}">
     <ul> 
     <apex:repeat value="{!group.accounts}" var="aw" >
      <li><apex:outputLink value="/{!aw.account.id}" style="{!IF(aw.isPrimary,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!aw.account.name}</apex:outputLink></li>
     </apex:repeat>            
     </ul>
     </apex:outputPanel>
    </div>
    </apex:repeat>       
   </td>
   
   <td valign="top" width="33%">
   <div style="padding-bottom: 20px;">  
   <h1>Contracting Hierarchy</h1>
   </div>
   <apex:repeat value="{!Contracts}" var="contract" >  
    <h3><a href="/{!contract.Id}" target="_blank">{!contract.Name}</a></h3>
    <div class="treeNode"> 
     <apex:outputPanel rendered="{!contract.size>100}">This group has more than 100 accounts. Click on the group name to view all accounts.</apex:outputPanel>
     <apex:outputPanel rendered="{!contract.size<=100}">
     <ul> 
     <apex:repeat value="{!contract.accounts}" var="aw" >
      <li><apex:outputLink value="/{!aw.account.id}" style="{!IF(aw.isPrimary,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!aw.account.name}</apex:outputLink></li>
     </apex:repeat>            
     </ul>
     </apex:outputPanel>
    </div>
    </apex:repeat>       
   </td>
   
  </tr>
 </table>
 </div>
</apex:component>

 

 

and here is the code used in the appshare

 

 

<!--
    Copyright (c)2008, Matthew Friend, Sales Engineering, Salesforce.com Inc.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    Neither the name of the�salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

<!--
    Note on Changing: Scroll down or search for "Change"
    Ignore warnings
--> 

<apex:component Controller="AccountStructure">
    <apex:attribute name="currentId" description="This is the Account Id for displaying Acccount Hierarchy" type="String" required="true" assignTo="{!currentId}"/>

    <div class="treeNode">
            <apex:repeat value="{!ObjectStructure}" var="pos" >
            <apex:repeat value="{!pos.levelFlag}" var="flag" first="0">
                <apex:image url="/img/tree/empty.gif" height="16" width="20" rendered="{!IF(flag,false,true)}"/>
                <apex:image url="/s.gif" alt="" width="3" height="16" rendered="{!IF(flag,true,false)}"/>
                <apex:image url="/img/tree/chain.gif" height="16" width="20" rendered="{!IF(flag,true,false)}"/>
            </apex:repeat>

            <span height="16" v="top">

            <apex:outputText rendered="{!IF(pos.nodeType=='start',true,false)}">
                <apex:image id="tree_start" url="/img/tree/minusStart.gif" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_start" url="/img/icon/custom51_100/globe16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_start_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='parent',pos.nodeType=='parent_end'),true,false)}">
                <apex:image id="Tree_parent" url="/img/tree/minus.gif" rendered="{!IF(pos.nodeType=='parent',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_parent_end" url="/img/tree/minusEnd.gif" rendered="{!IF(pos.nodeType=='parent_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>                
                <apex:image id="Icon_parent" url="/img/icon/factory16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_parent_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child',pos.nodeType=='child_end'),true,false)}">
                <apex:image id="Tree_child" url="/img/tree/node.gif" rendered="{!IF(pos.nodeType=='child',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_child_current" url="/img/tree/nodeEnd.gif" rendered="{!IF(pos.nodeType=='child_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_child" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>    
                <apex:image id="Icon_child_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(pos.nodeType=='end',true,false)}">
                <apex:image id="Tree_end" url="/img/tree/nodeEnd.gif" height="16" width="20"/>&nbsp;
                <apex:image id="Icon_end" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_end_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
<!-- Change Below -->
            <apex:outputLink value="/{!pos.account.id}" style="{!IF(pos.currentNode,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!pos.account.name}</apex:outputLink>

<!-- Include the following if you uses sites with accounts -->

            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Type}" rendered="{!IF(pos.account.Type != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Industry}" rendered="{!IF(pos.account.Industry!= '', true, false)}"/>&nbsp;
<!-- Stop -->
            </span>
            <div> </div>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),false,true)}">
                <div id='{!pos.nodeId}'>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),true,false)}">
                <div id='{!pos.nodeId}'><apex:image url="/s.gif" alt="" width="1" height="1"/></div>
            </apex:outputText>
            <apex:repeat value="{!pos.closeFlag}" var="close">
                </div>
            </apex:repeat>            

    </apex:repeat>
    <br/><br/><br/>
    </div>
</apex:component>

 

Any help would be appreciated. Thanks

 

  • April 26, 2011
  • Like
  • 1

Hello,

 

I'm trying to get an image to render in a MS-word ContentType VF page and for some reason it won't work properly.

 

Here is the code for the image

 

<img style="font-size:10pt; position:absolute; left:0px; width:200px;" alt="MedAssets Logo" src="https://cs3.salesforce.com/resource/1301083198000/MedAssets_Logo"/>

 

I don't know if the src url there is the 'Complete URL' I've heard about here (http://boards.developerforce.com/t5/Visualforce-Development/Apex-Image-with-Static-Resource-on-MS-Word/m-p/136765) or not and if it's not, I do not know how you get it.

 

Any help would be appreciated.

 

  • April 07, 2011
  • Like
  • 0

Hello,

 

My client wants me to make it so that when you hover your mouse over a link, it'll pop up a small window that displays information about that record, much like how salesforce already does. What is the best way to go about doing this? Any responses would be appreciated.

  • April 01, 2011
  • Like
  • 0

I'm trying to build a unit test for a project my company is working on and we're mostly covered, but the only error that I can't figure out is the following:

 

System.DmlException: ConvertLead failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the required permission. To continue, you must have the 'Edit' permission on contacts : : []

 

Class.LeadConversion.convertLeadToNewOpp: line 34, column 16 Class.LeadConversion.testConvertLead: line 64, column 9 External entry point

 

We thought it might have to do with the Profile so we chose a user with System Administrator access but it still doesn't seem to work. Any thoughts? The code is below

 

 

public class LeadConversion {
    public static void addContactToOpportunity(Id opportunityId, Id contactId) {
        // make sure the contact doesn't already exist in the opp
        // even though SF allows dupes, we won't
        List<OpportunityContactRole> ex = [select Id from OpportunityContactRole where OpportunityId = :opportunityId and ContactId = :contactId];
        if (!ex.isEmpty()) return;

        OpportunityContactRole ct = new OpportunityContactRole();
        ct.OpportunityId = opportunityId;
        ct.ContactId = contactId;
        insert ct;
    }
    private static String getDefaultConvertStatus() {
        LeadStatus convertstatus = [select Id, MasterLabel from LeadStatus where IsConverted= true limit 1];
        return convertStatus.MasterLabel;
    }
    public static Database.Leadconvertresult convertLeadToExistingOpp(Id opportunityId, Id accountId, Id contactId, Id leadId) {
        Database.Leadconvert lc = new Database.Leadconvert();
        lc.setConvertedStatus(getDefaultConvertStatus());
        lc.setAccountId(accountId);
        lc.setLeadId(leadId);
        lc.setContactId(contactId);
        lc.setDoNotCreateOpportunity(true);
        return Database.convertLead(lc);
    }
    public static Database.Leadconvertresult convertLeadToNewOpp(String opportunityName, Id ownerId, Id accountId, Id contactId, Id leadId) {
        Database.Leadconvert lc = new Database.Leadconvert();
        lc.setConvertedStatus(getDefaultConvertStatus());
        lc.setAccountId(accountId);
        lc.setLeadId(leadId);
        lc.setContactId(contactId);
        lc.setOpportunityName(opportunityName);
        lc.setOwnerId(ownerId);
        return Database.convertLead(lc);
    }
    public static testMethod void testConvertLead() {
        Account ac = new Account(name = 'Test Account');
        insert ac;
        Opportunity op = new Opportunity(name = 'Test Account - Test Method opp', AccountId = ac.Id,StageName='Test',CloseDate=date.Today());
        Profile p=[select id from Profile where name='System Administrator' limit 1];
        user u=[select id from user where LastName='Fine' limit 1];
         op.ownerID=u.id;
        reporting_position__c rp=new reporting_Position__c();
        rp.assigned_User__c=u.id;
        Reporting_Position__c rp2=[select id, territory__c from Reporting_Position__c limit 1];
        rp.Territory__c=rp2.id;
        insert rp;
        op.reporting_Position__c=rp.id;
        insert op;
        Contact ct = new Contact(LastName = 'Test Last Name', accountid=ac.id);
        insert ct;
        Lead l = new Lead(LastName = 'Test Lead',Company='Test Company');
        insert l;
        convertLeadToExistingOpp(op.id, ac.Id, ct.Id, l.Id);
        delete l;
        delete ct;
        delete op;

        //User u2 = new User(LastName = 'some user', Username='test@test.com', Email='test@test.com', Alias='test', CommunityNickname='test', TimeZoneSidKey, LocaleSidKey, EmailEncodingKey, ProfileId, LanguageLocaleKey]: [Username, Email, Alias, CommunityNickname, TimeZoneSidKey, LocaleSidKey, EmailEncodingKey, ProfileId, LanguageLocaleKey);
        //insert u2;
        User u2=[select id from user where LastName='Fine' and isActive=true limit 1];
        l = new Lead(LastName = 'Test Lead',Company='test company');
        insert l;
        convertLeadToNewOpp('test Opp', u2.Id, ac.Id, ct.Id, l.Id);
        delete ac;
    }
    public static testMethod void testAddContactToOpportunity() {
        Opportunity op = new Opportunity(name = 'Test Method opp', StageName='Test',CloseDate=date.Today());
        Profile p=[select id from Profile where name='System Administrator' limit 1];
        user u=[select id from user where LastName='Fine' limit 1];
        op.ownerID=u.id;
        reporting_position__c rp=new reporting_Position__c();
        rp.assigned_User__c=u.id;
        Reporting_Position__c rp2=[select id, territory__c from Reporting_Position__c limit 1];
        rp.Territory__c=rp2.id;
        insert rp;
        op.reporting_Position__c=rp.id;
        insert op;
        Contact ct = new Contact(LastName = 'Testing123');
        insert ct;
        addContactToOpportunity(op.Id, ct.Id);
        addContactToOpportunity(op.Id, ct.Id);
        delete ct;
        delete op;
    }
}

 

 

  • March 25, 2011
  • Like
  • 0

Hello everyone. I'm currently trying adjust a pdf to have a signature block to always have it at the bottom of a page and then when the notes above it would push it to the next page, the block remains where it is and the text of the notes then carries onto the next page instead.

 

I'm not too sure where to begin with that. Does anyone have a good idea where to begin?

 

Thanks in advanced and I look forward to your response.

  • March 07, 2011
  • Like
  • 0

Hello everyone, I'm tryng to make it so that my pdf controller can build by product subcategory, without the need to hardcode it in.

 

To do this, I performed a mix of Custom Object and Map<String, List<LineItems>> in my controller, and for the most part it works, except when transferring the values of the Map to a List<List<LineItems>>, it becomes out of order and products will be put under the wrong category. Any idea how I can address this issue?

 

Thank you for your time.

  • February 22, 2011
  • Like
  • 0

Hello everyone.

 

I'm currently trying to get a function to work that would either a) match the child quantity with that of it's parents or b) make the child price value be a percentage of it's parents.

 

We originally had the relationship from child to parent and in that regard it worked fine, but now they want it to be from parent to child and while I've gotten everything else to work fine. This particular function I can't get and I was hoping some light could be shed onto it.

 

I'll just show the main part I'm working with

 

 

for(OLIListWrapper oli:opp_products_list){
   if(oli.Item.Quantity<=0 || oli.Item.UnitPrice<0 || oli.Item.Quantity==null){
    ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.WARNING, 'Quantities must be greater than 0 and prices cannot be negative.');
    ApexPages.addMessage( myMsg);
    return null;
   }
   
   QuoteLineItem olnew=new QuoteLineItem();
   Decimal DiscountPrice;
   olnew.PricebookEntryId=oli.Item.PricebookEntryId;
   olnew.UnitPrice=oli.Item.UnitPrice;  
   olnew.QuoteId=opp.Id;     
   olnew.Notes__c=oli.Item.Notes__c;
   oli.quantity=oli.item.Quantity;   
   olnew.Description=oli.Item.Description;
   if(oli.over !=null)
                olnew.isOverage__c=oli.over;
   if(oli.hasRelate !=null)
                olnew.hasOverage__c=oli.hasRelate;
   olnew.Quantity=oli.Quantity;
   
   System.debug('Quantity Item - ' +oli.quantity);
   //if(!oli.over)
   if(oli.related!=null && oli.Dependency=='Set Child Qty from Parent')
   {
       boolean find=false;
       System.debug('*** Parent quantity is being selected *** Product List: '+opp_products_list);
       
       for(OLIListWrapper i:opp_products_list)
       {
           System.debug('RELATED PARENT - ' +oli.related);
           System.debug('RELATED Child - ' +i.identity);
   
           if(oli.related == i.identity)
           {
                oli.Quantity=i.quantity;
                find=true;
                System.debug('New Child Quantity - '+i.quantity);
           }
       }
   }
   else
   {
        olnew.Quantity=oli.Quantity;
   }
   
   if(oli.related!=null && oli.Dependency=='Set Child Price as % of Parent Price')
   {
       boolean find=false;
       System.debug('*** Parent quantity is being selected ***');
       
       for(OLIListWrapper i:opp_products_list)
       {
           if(oli.related == i.Identity && i.item.MRC_RATE__C!=null)
           {
                i.item.MRC_Rate__c=oli.item.MRC_RATE__C * (oli.ChildPercent/100); //10% test for MRC rate
                find=true;
           }
       }
       if(!find)
       {
          ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity.ERROR, 'There is a problem here. Please try saving again. If the problem persists, please contact your administrator...?');
          ApexPages.addMessage( myMsg); 
          olnew.MRC_Rate__c=100; 
       }
   }
}

 

 

The variable identity is the product id while the variable 'related' is the id of the child relation the product has.

 

The idea I had was that when loop through to find the child, it would change the custom LineItemWrapper value of quantity and then when the child goes through, it'll pick up the new quantity, but it never seems to do that. ANy ideas why or solutions?

 

Also, I'm not entirely sure if the price section would work. Could anyone give some clarification or ideas?

  • January 25, 2011
  • Like
  • 0

Hello, I'm trying to utilize a piece of AppShare for hierarchy presentation which drops down and closes when clicked, found here: http://appexchange.salesforce.com/listingDetail?listingId=a0N300000016chCEAQ

 

However, my company modified the code a bit to be a bit more universal in terms of our client, but for some reason, the drop down and closing features don't work.

 

Here is the VF code we used:

 

 

<apex:component Controller="AccountStructure" >
    <apex:attribute name="currentId" description="This is the Account Id for displaying Acccount Hierarchy" type="String" required="true" assignTo="{!currentId}"/>
  
  <div id="account-hierarchy">
  <table style="width: 100%">
   <tr>
    
    <td valign="top"  width="33%">  
    <apex:repeat value="{!ObjectStructures}" var="ObjectStructur" >  
    <h3>{!ObjectStructur.title}</h3>
    <div class="treeNode">  
       <apex:repeat value="{!ObjectStructur.asms}" var="pos" >
            <apex:repeat value="{!pos.levelFlag}" var="flag" first="0">
                <apex:image url="/img/tree/empty.gif" height="16" width="20" rendered="{!IF(flag,false,true)}"/>
                <apex:image url="/s.gif" alt="" width="3" height="16" rendered="{!IF(flag,true,false)}"/>
                <apex:image url="/img/tree/chain.gif" height="16" width="20" rendered="{!IF(flag,true,false)}"/>
            </apex:repeat>
            <span height="16" v="top">
           <apex:outputText rendered="{!IF(pos.nodeType=='start',true,false)}">
                <apex:image id="tree_start" url="/img/tree/minusStart.gif" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_start" url="/img/icon/custom51_100/globe16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_start_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='parent',pos.nodeType=='parent_end'),true,false)}">
                <apex:image id="Tree_parent" url="/img/tree/minus.gif" rendered="{!IF(pos.nodeType=='parent',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_parent_end" url="/img/tree/minusEnd.gif" rendered="{!IF(pos.nodeType=='parent_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>                
                <apex:image id="Icon_parent" url="/img/icon/factory16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_parent_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child',pos.nodeType=='child_end'),true,false)}">
                <apex:image id="Tree_child" url="/img/tree/node.gif" rendered="{!IF(pos.nodeType=='child',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_child_current" url="/img/tree/nodeEnd.gif" rendered="{!IF(pos.nodeType=='child_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_child" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>    
                <apex:image id="Icon_child_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(pos.nodeType=='end',true,false)}">
                <apex:image id="Tree_end" url="/img/tree/nodeEnd.gif" height="16" width="20"/>
                <apex:image id="Icon_end" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_end_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
<!-- Change Below -->
            <apex:outputLink value="/{!pos.account.id}" style="{!IF(pos.currentNode,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!pos.account.name}</apex:outputLink>

<!-- Include the following if you uses sites with accounts -->

            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Parent_Type__c}" rendered="{!IF(pos.account.Parent_Type__c != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Account_Sub_Type__c}" rendered="{!IF(pos.account.Account_Sub_Type__c != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Industry}" rendered="{!IF(pos.account.Industry!= '', true, false)}"/>&nbsp;
<!-- Stop -->
            </span>
            <div> </div>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),false,true)}">
                <div id='{!pos.nodeId}'></div>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),true,false)}">
                <div id='{!pos.nodeId}'><apex:image url="/s.gif" alt="" width="1" height="1"/></div>
            </apex:outputText>
            <apex:repeat value="{!pos.closeFlag}" var="close"></apex:repeat>    
   
            </apex:repeat>
        </div>   
    </apex:repeat> 
   </td>
   <td valign="top" width="33%">
   <div style="padding-bottom: 20px;">  
   <h1>Groups</h1>
   </div>
   <apex:repeat value="{!Groups}" var="group" >  
    <h3><a href="/{!group.Id}" target="_blank">{!group.Name}</a></h3>
    <div class="treeNode"> 
     <apex:outputPanel rendered="{!group.size>100}">This group has more than 100 accounts. Click on the group name to view all accounts.</apex:outputPanel>
     <apex:outputPanel rendered="{!group.size<=100}">
     <ul> 
     <apex:repeat value="{!group.accounts}" var="aw" >
      <li><apex:outputLink value="/{!aw.account.id}" style="{!IF(aw.isPrimary,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!aw.account.name}</apex:outputLink></li>
     </apex:repeat>            
     </ul>
     </apex:outputPanel>
    </div>
    </apex:repeat>       
   </td>
   
   <td valign="top" width="33%">
   <div style="padding-bottom: 20px;">  
   <h1>Contracting Hierarchy</h1>
   </div>
   <apex:repeat value="{!Contracts}" var="contract" >  
    <h3><a href="/{!contract.Id}" target="_blank">{!contract.Name}</a></h3>
    <div class="treeNode"> 
     <apex:outputPanel rendered="{!contract.size>100}">This group has more than 100 accounts. Click on the group name to view all accounts.</apex:outputPanel>
     <apex:outputPanel rendered="{!contract.size<=100}">
     <ul> 
     <apex:repeat value="{!contract.accounts}" var="aw" >
      <li><apex:outputLink value="/{!aw.account.id}" style="{!IF(aw.isPrimary,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!aw.account.name}</apex:outputLink></li>
     </apex:repeat>            
     </ul>
     </apex:outputPanel>
    </div>
    </apex:repeat>       
   </td>
   
  </tr>
 </table>
 </div>
</apex:component>

 

 

and here is the code used in the appshare

 

 

<!--
    Copyright (c)2008, Matthew Friend, Sales Engineering, Salesforce.com Inc.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    Neither the name of the�salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->

<!--
    Note on Changing: Scroll down or search for "Change"
    Ignore warnings
--> 

<apex:component Controller="AccountStructure">
    <apex:attribute name="currentId" description="This is the Account Id for displaying Acccount Hierarchy" type="String" required="true" assignTo="{!currentId}"/>

    <div class="treeNode">
            <apex:repeat value="{!ObjectStructure}" var="pos" >
            <apex:repeat value="{!pos.levelFlag}" var="flag" first="0">
                <apex:image url="/img/tree/empty.gif" height="16" width="20" rendered="{!IF(flag,false,true)}"/>
                <apex:image url="/s.gif" alt="" width="3" height="16" rendered="{!IF(flag,true,false)}"/>
                <apex:image url="/img/tree/chain.gif" height="16" width="20" rendered="{!IF(flag,true,false)}"/>
            </apex:repeat>

            <span height="16" v="top">

            <apex:outputText rendered="{!IF(pos.nodeType=='start',true,false)}">
                <apex:image id="tree_start" url="/img/tree/minusStart.gif" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_start" url="/img/icon/custom51_100/globe16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_start_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='parent',pos.nodeType=='parent_end'),true,false)}">
                <apex:image id="Tree_parent" url="/img/tree/minus.gif" rendered="{!IF(pos.nodeType=='parent',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_parent_end" url="/img/tree/minusEnd.gif" rendered="{!IF(pos.nodeType=='parent_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>                
                <apex:image id="Icon_parent" url="/img/icon/factory16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_parent_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child',pos.nodeType=='child_end'),true,false)}">
                <apex:image id="Tree_child" url="/img/tree/node.gif" rendered="{!IF(pos.nodeType=='child',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Tree_child_current" url="/img/tree/nodeEnd.gif" rendered="{!IF(pos.nodeType=='child_end',true,false)}" height="16" width="20" title="Click to expand/collapse nested items." onClick="TreeNodeElement.prototype.toggle(this,'{!pos.nodeId}')"/>
                <apex:image id="Icon_child" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>    
                <apex:image id="Icon_child_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
            <apex:outputText rendered="{!IF(pos.nodeType=='end',true,false)}">
                <apex:image id="Tree_end" url="/img/tree/nodeEnd.gif" height="16" width="20"/>&nbsp;
                <apex:image id="Icon_end" url="/img/icon/desk16.png" width="16" height="16" rendered="{!IF(pos.currentNode,false,true)}"/>
                <apex:image id="Icon_end_current" url="/img/icon/star16.png" width="16" height="16" rendered="{!IF(pos.currentNode,true,false)}"/>
            </apex:outputText>
<!-- Change Below -->
            <apex:outputLink value="/{!pos.account.id}" style="{!IF(pos.currentNode,'font-weight: bold;','')}" styleClass="columnHeadActiveBlack" target="_top">{!pos.account.name}</apex:outputLink>

<!-- Include the following if you uses sites with accounts -->

            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Type}" rendered="{!IF(pos.account.Type != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Industry}" rendered="{!IF(pos.account.Industry!= '', true, false)}"/>&nbsp;
<!-- Stop -->
            </span>
            <div> </div>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),false,true)}">
                <div id='{!pos.nodeId}'>
            </apex:outputText>
            <apex:outputText rendered="{!IF(OR(pos.nodeType=='child_end',pos.nodeType=='child'),true,false)}">
                <div id='{!pos.nodeId}'><apex:image url="/s.gif" alt="" width="1" height="1"/></div>
            </apex:outputText>
            <apex:repeat value="{!pos.closeFlag}" var="close">
                </div>
            </apex:repeat>            

    </apex:repeat>
    <br/><br/><br/>
    </div>
</apex:component>

 

Any help would be appreciated. Thanks

 

  • April 26, 2011
  • Like
  • 1

Hello,

 

I have checked the boards and tried the samples, but for some reason when I used this bit of code to format my currency:

 

         <apex:outputText value="Rs{0,number, $###,##0.00}">
             <apex:param value="${!opp.Total_Referrals__c}"/>
         </apex:outputText>

 

I get this error:

 

Error: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.

 

I'm clueless in what to do. I merely wish for a basic currency formatting technique. If you can offer any advice, I'd be appreciative.

  • October 18, 2010
  • Like
  • 1

Hello everyone,

 

At the moment, I'm trying to implement a validation rule that would check to see that certain characters are used/not used.

 

The description is basically: Available Charactersare: 0-9   a-z   A-Z.  ,  -  /  &  [blank space]

 

I figure I would need to use REGEX for this, but I'm not completely familiar with REGEX, so after doing some reading and research I came up with this:

 

REGEX ( Business_Owner_First_Name__c , "[a-zA-Z0-9 // /, /& - / ] {50}")

 

Now I know I probably have a number of things wrong with this logic and the testing seems to suggest that.

 

If any REGEX experts might be able to help, I'd be very appreciative.

  • August 01, 2011
  • Like
  • 0

Hello, I'm trying to implement afunction for a client where they can track hours. They want to add a function that if certain quote line items are in the opportunity, then they can be select and have hours ran against them.

 

This mostly works, but there's one issue I want to do and that's when initially making the hours record, the user select an opportunity but without an opportunity initially, there are no quote line items to select. I've attempting implementing Action Support, but it doesn't seem to work. Below is my VF code and Apex code:

 

 

<apex:page standardController="PM_Hours__c" extensions="PMEditController" >



    <apex:sectionHeader title="PM Hours Edit" subtitle="{!PM_Hours__c.name}"/>
    <apex:form >
        <apex:pageBlock title="PM Hours Edit" id="thePageBlock" mode="edit">
            <apex:pageMessages />
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
                <apex:commandButton value="Cancel" action="{!cancel}"/>                
            </apex:pageBlockButtons>
            <apex:actionRegion >
                <apex:pageBlockSection title="Information" columns="2">
                    
                    <apex:inputField value="{!PM_Hours__c.Opportunity__c}" required="true"/>
                    <apex:actionSupport event="onchange" reRender="lineitem" action="{!getTrackedProducts}"/>
                    
                    <apex:inputField value="{!PM_Hours__c.Date_of_Entry__c}" required="true"/>
                    <apex:outputText value=""/>
                    <apex:inputField value="{!PM_Hours__c.Number_of_Hours__c}" required="true"/>
                    <apex:inputField value="{!PM_Hours__c.Activity_Category__c}" required="true"/>
                    <apex:inputField value="{!PM_Hours__c.Hourly_Rate__c}"/>
                    <apex:inputField value="{!PM_Hours__c.Job_Function__c}" required="true"/>
                    <apex:outputfield value="{!PM_Hours__c.Total__c}"/>
                    <apex:inputField value="{!PM_Hours__c.Task__c}" required="true"/>
                    <apex:inputfield value="{!PM_Hours__c.Billable__c}"/>
                    <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Quote Line Item" for="lineitem"/>
                    
                    <apex:selectList value="{!PM_Hours__c.Quote_Line_Item__c}" multiselect="false" size="1" id="lineitem">
                      <apex:selectOptions value="{!TrackedProducts}"/>
                    </apex:selectList>
                    </apex:pageBlockSectionItem>
                    <apex:inputField value="{!PM_Hours__c.Notes__c}"/>
                </apex:pageBlockSection>
            </apex:actionRegion>
            
        </apex:pageBlock>
        <apex:pageBlock title="User Time Table" id="TimeTable" mode="edit">
            <c:UserHoursVF2 />
            
        </apex:pageBlock>
    </apex:form>
    
<!--    <div id="PH-dialog">
    <apex:form >
        <apex:pageBlock title="" mode="edit">
            <apex:facet name="header"><div></div></apex:facet>
            <apex:pageBlockSection title="Project Hour Details" columns="1">
                
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Project Name" for="PHName"/>
                    <apex:panelGroup >
                        <apex:outputText value="" id="PHName" style="width: 300px; height: 100px;"/>
                        </apex:panelGroup>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Assigned To" for="ownerId"/>
                    <apex:panelGroup >
                    <div id="phOwnerId">
                        <apex:outputText value="" id="ownerId" style="width: 300px;"/>
                    </div> 
                    </apex:panelGroup>
                </apex:pageBlockSectionItem> 
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Hourly Rate" for="HourRate"/>
                    <apex:panelGroup >
                        <apex:outputText value="" id="HourRate" style="width: 300px; height: 100px;"/>
                        </apex:panelGroup>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Number of Hours" for="NumHour"/>
                    <apex:panelGroup >
                        <apex:outputText value="" id="NumHour"/>
                        </apex:panelGroup>
                </apex:pageBlockSectionItem>
                
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
  </div>-->
  
  
</apex:page>

 

public with sharing class PMEditController {

 public Id UserID {get; set;}
 
 public Opportunity opp {get; set;}
 
 public User activeUser {get; set;}
 
 public PM_Hours__c[] PH {get; set;}
 
 public List<ProjectItem> PI {get; set;}
 
 public Map<ID,ProjectItem> ProjectMap {get;set;}
 
 public date today{get;set;}

 public String PHID {get; set;}
 
 public decimal pSunTot{get;set;}
 public decimal pMonTot{get;set;}
 public decimal pTueTot{get;set;}
 public decimal pWedTot{get;set;}
 public decimal pThuTot{get;set;}
 public decimal pFriTot{get;set;}
 public decimal pSatTot{get;set;}
 public decimal SunTot{get;set;}
 public decimal MonTot{get;set;}
 public decimal TueTot{get;set;}
 public decimal WedTot{get;set;}
 public decimal ThuTot{get;set;}
 public decimal FriTot{get;set;}
 public decimal SatTot{get;set;}
 
 public decimal total{get;set;}
 public decimal ptotal{get;set;}

 public PMEditController()
 {
        init();
 }
 
 public PMEditController(ApexPages.StandardController controller)
 {
        init();
 }

 public void init(){
        
        PHID=System.currentPageReference().getParameters().get('id');
        
        Date Late=date.Today().toStartOfWeek().addDays(6);
        Date Earl=date.Today().addDays(-7).toStartOfWeek();
        today=date.Today();
        pSunTot=0;
    pMonTot=0;
    pTueTot=0;
    pWedTot=0;
        pThuTot=0;
        pFriTot=0;
        pSatTot=0;
        SunTot=0;
    MonTot=0;
    TueTot=0;
    WedTot=0;
        ThuTot=0;
        FriTot=0;
        SatTot=0;
   activeUser=[select id from user where id =:userInfo.getUserId() limit 1];
   PH=[select Opportunity__c, Opportunity__r.name, Date_of_Entry__c, Number_of_Hours__c from PM_Hours__c where CreatedByID=:ActiveUser.Id and Date_of_Entry__c>=:Earl and Date_of_Entry__c<=:Late];
   PI=new list<ProjectItem>();
   System.debug('PH '+PH);
   ProjectMap=new Map<ID,ProjectItem>();
   for(PM_Hours__c Pm:PH)
   {
        PM p=new PM();
        p.pm=Pm;
        if(p.pm.Opportunity__c!=null && p.pm.Number_of_Hours__c!=null)
        if(ProjectMap.get(p.pm.Opportunity__c)==null)
        {       
                ProjectItem I=new ProjectItem();
                
                if(p.pm.Id==phid)
                        p.current=true;
                I.AssAcc=p.pm.Opportunity__r.name;
                I.AccID=p.pm.Opportunity__c;
                if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek())
                {
                        i.PSunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSunTot+=p.pm.Number_of_Hours__c;
                        
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(1))
                {
                        i.PMonList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pMonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(2))
                {
                        i.PTueList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pTueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(3))
                {
                        i.PWedList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pWedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(4))
                {
                        i.PThuList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(5))
                {
                        i.PFriList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pFriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(6))
                {
                        i.PSatList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSatTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek())
                {
                        i.SunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        SunTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(1))
                {
                        i.MonList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        MonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(2))
                {
                        i.TueList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        TueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(3))
                {
                        i.WedList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        WedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(4))
                {
                        i.ThuList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        ThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(5))
                {
                        i.FriList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        FriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(6))
                {
                        i.SatList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        SatTot+=p.pm.Number_of_Hours__c;
                }
                ProjectMap.put(p.pm.opportunity__c,I);
        }
        else
        {
                ProjectItem I=ProjectMap.get(p.pm.Opportunity__c);
                if(p.pm.Id==phid)
                        p.current=true;
                if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek())
                {
                        i.PSunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSunTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(1))
                {
                        i.PMonList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pMonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(2))
                {
                        i.PTueList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pTueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(3))
                {
                        i.PWedList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pWedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(4))
                {
                        i.PThuList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(5))
                {
                        i.PFriList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pFriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().addDays(-7).tostartofWeek().addDays(6))
                {
                        i.PSatList.Add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        pSatTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek())
                {
                        i.SunList.add(p);
                        i.lastTotal+=p.pm.Number_of_Hours__c;
                        SunTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(1))
                {
                        i.MonList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        MonTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(2))
                {
                        i.TueList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        TueTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(3))
                {
                        i.WedList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        WedTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(4))
                {
                        i.ThuList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        ThuTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(5))
                {
                        i.FriList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        FriTot+=p.pm.Number_of_Hours__c;
                }
                else if(p.pm.Date_of_Entry__c==date.today().tostartofWeek().addDays(6))
                {
                        i.SatList.Add(p);
                        i.thisTotal+=p.pm.Number_of_Hours__c;
                        SatTot+=p.pm.Number_of_Hours__c;
                }
                ProjectMap.put(p.pm.Opportunity__c,I);
        }
   
   }
   total=suntot+montot+tuetot+wedtot+thutot+fritot+sattot;
   ptotal=psuntot+pmontot+ptuetot+pwedtot+pthutot+pfritot+psattot;
   PI=ProjectMap.Values();
  }
 
 public List<SelectOption> getTrackedProducts()
 {      
        List<Quote_Line_Item__c> qlilist;
 try{
        opp=[select id from Opportunity where id=:[select opportunity__c from PM_Hours__c where id=:phid limit 1].opportunity__c limit 1];
         qlilist=[select id, description__c, name from Quote_Line_Item__c where Opportunity__c=:opp.id and (name='STXPS-PRJMGT-310' or name='STXPS-PRJMGT-301' or name='STXPS-PRJMGT-302')];
        system.debug(qlilist);
 }
 catch(exception e){qlilist=new List<Quote_Line_Item__c>();}
  List<SelectOption> QuoteLineEntries = new List<SelectOption> ();
  SelectOption pbeoptionBlank = new SelectOption('','-- blank --');
  QuoteLineEntries.add( pbeoptionBlank );

  for(Quote_line_item__c qli:qlilist){
   String label=qli.Description__c;
   if(label==null || label==''){
    label=qli.Name;
   }
   SelectOption pbeoption = new SelectOption(qli.Id,label);
   QuoteLineEntries.add( pbeoption );
  }
  return QuoteLineEntries;
 
 
 }
 
 class PM
 {
        public PM_Hours__c pm{get;set;}
        public boolean current{get;set;}
        
        public PM(){
                current=false;
        }
 }

 class ProjectItem{
  public String AssAcc{get;set;}
  public ID AccID{get;set;}
  public List<PM> PSunList{get;set;}
  public List<PM> PMonList{get;set;}
  public List<PM> PTueList{get;set;}
  public List<PM> PWedList{get;set;}
  public List<PM> PThuList{get;set;}
  public List<PM> PFriList{get;set;}
  public List<PM> PSatList{get;set;}
  public List<PM> SunList{get;set;}
  public List<PM> MonList{get;set;}
  public List<PM> TueList{get;set;}
  public List<PM> WedList{get;set;}
  public List<PM> ThuList{get;set;}
  public List<PM> FriList{get;set;}
  public List<PM> SatList{get;set;}
  
  public Date PSun{get;set;}
  public Date PMon{get;set;}
  public Date PTue{get;set;}
  public Date PWed{get;set;}
  public Date PThu{get;set;}
  public Date PFri{get;set;}
  public Date PSat{get;set;}
  public Date Sun{get;set;}
  public Date Mon{get;set;}
  public Date Tue{get;set;}
  public Date Wed{get;set;}
  public Date Thu{get;set;}
  public Date Fri{get;set;}
  public Date Sat{get;set;}
  
  public decimal LastTotal{get;set;}
  public decimal ThisTotal{get;set;}
  
  
  
  public ProjectItem(){
   Date LastWeek=date.today().addDays(-7).tostartofWeek();
   Date ThisWeek=date.today().tostartofWeek();
   PSun=LastWeek;
   PMon=LastWeek.addDays(1);
   PTue=LastWeek.addDays(2);
   PWed=LastWeek.addDays(3);
   PThu=LastWeek.addDays(4);
   PFri=LastWeek.addDays(5);
   PSat=LastWeek.addDays(6);
   Sun=ThisWeek;
   Mon=ThisWeek.addDays(1);
   Tue=ThisWeek.addDays(2);
   Wed=ThisWeek.addDays(3);
   Thu=ThisWeek.addDays(4);
   Fri=ThisWeek.addDays(5);
   Sat=ThisWeek.addDays(6);
   
   PSunList=new List<PM>();
   PMonList=new List<PM>();
   PTueList=new List<PM>();
   PWedList=new List<PM>();
   PThuList=new List<PM>();
   PFriList=new List<PM>();
   PSatList=new List<PM>();
   SunList=new List<PM>();
   MonList=new List<PM>();
   TueList=new List<PM>();
   WedList=new List<PM>();
   ThuList=new List<PM>();
   FriList=new List<PM>();
   SatList=new List<PM>();
   
   LastTotal=0;
   ThisTotal=0;
  }

 }

}

 

Thanks in advanced

 

  • June 01, 2011
  • Like
  • 0

Hello everyone, I'm have a bit of trouble trying to a trigger that will update a multipicklist value correctly but the code I'm using seem to cancel out all the semi colons I put in. Also, when the value is blank, it'll always return null despite my efforts to prevent it from doing so. Can anyone provide an idea? Below is the code I'm using:

 

 

trigger SaleContractUpdate on Covered_Account__c (After insert, after update) {

    List<Opportunity> OppList=new List<Opportunity>();
    List<Covered_Account__c> CAList=new List<Covered_Account__c>();
    Set<Id> trackOppProdUpdate = new Set<Id>();

    List<ID> OIDS=new List<ID>();
    List<ID> opIDS=new List<ID>();
    List<ID> CAIDS=new List<ID>();

    for (Covered_Account__c obj : Trigger.new) {
    //        Covered_account__c oldObj=trigger.oldmap.get(obj.id)
        Oids.add(obj.Opportunity_Name__c);
        if((trigger.isInsert || (trigger.oldmap.get(obj.id).opportunity_Product__c!=obj.Opportunity_Product__c)))
        opids.add(obj.Opportunity_product__c);
  }

    oppList=[select Sale_Contracting_Event_Type__c, id from Opportunity where id IN: oids];
    CAList=[select id, sale_Type__c, Opportunity_Name__c from Covered_Account__c where Opportunity_Name__c IN: oids];
    
    List<Opportunity> olist=new List<Opportunity>();
    for(Opportunity opp:opplist)
    {   String entry='';
        Set<String> track=new Set<String>(); 
        for(covered_account__c op:calist){
            if(op.Opportunity_Name__c == opp.id)
            {
                if(!track.contains(op.Sale_Type__c) && (op.sale_type__c!=null && op.sale_type__c!='null' && op.sale_type__c!=''))
                {   system.debug('sales type '+op.Sale_Type__c);
                    entry+=op.Sale_Type__c+'; ';
                    track.add(op.Sale_Type__c);
                }
            }
            System.debug('entry '+entry);
        }
        if(entry.length()>0)
            entry=Entry.substring(0,entry.length()-1);
        
        system.debug('opp '+opp);   
        opp.Sale_Contracting_Event_Type__c=entry;
        
        system.debug('opp '+opp);
        update opp;
        system.debug('opp '+opp);
    }
  //  update oList;
}

 

Any help would be appreciated

 

  • May 12, 2011
  • Like
  • 0

Hello,

 

My organization is making a unique VF page for Accounts which involves the use of radio buttons that update the page. The problem isn't so much getting the buttons to work at all, but for some reason the buttons don't work on Chrome while they work fine on firefox. Is there a particular reason this is the case? Is there some way to make is so the radio buttons work for chrome as well?

 

Thanks in advanced and I eagerly await a reply.

  • April 27, 2011
  • Like
  • 0

I'm trying to build a unit test for a project my company is working on and we're mostly covered, but the only error that I can't figure out is the following:

 

System.DmlException: ConvertLead failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, You do not have the required permission. To continue, you must have the 'Edit' permission on contacts : : []

 

Class.LeadConversion.convertLeadToNewOpp: line 34, column 16 Class.LeadConversion.testConvertLead: line 64, column 9 External entry point

 

We thought it might have to do with the Profile so we chose a user with System Administrator access but it still doesn't seem to work. Any thoughts? The code is below

 

 

public class LeadConversion {
    public static void addContactToOpportunity(Id opportunityId, Id contactId) {
        // make sure the contact doesn't already exist in the opp
        // even though SF allows dupes, we won't
        List<OpportunityContactRole> ex = [select Id from OpportunityContactRole where OpportunityId = :opportunityId and ContactId = :contactId];
        if (!ex.isEmpty()) return;

        OpportunityContactRole ct = new OpportunityContactRole();
        ct.OpportunityId = opportunityId;
        ct.ContactId = contactId;
        insert ct;
    }
    private static String getDefaultConvertStatus() {
        LeadStatus convertstatus = [select Id, MasterLabel from LeadStatus where IsConverted= true limit 1];
        return convertStatus.MasterLabel;
    }
    public static Database.Leadconvertresult convertLeadToExistingOpp(Id opportunityId, Id accountId, Id contactId, Id leadId) {
        Database.Leadconvert lc = new Database.Leadconvert();
        lc.setConvertedStatus(getDefaultConvertStatus());
        lc.setAccountId(accountId);
        lc.setLeadId(leadId);
        lc.setContactId(contactId);
        lc.setDoNotCreateOpportunity(true);
        return Database.convertLead(lc);
    }
    public static Database.Leadconvertresult convertLeadToNewOpp(String opportunityName, Id ownerId, Id accountId, Id contactId, Id leadId) {
        Database.Leadconvert lc = new Database.Leadconvert();
        lc.setConvertedStatus(getDefaultConvertStatus());
        lc.setAccountId(accountId);
        lc.setLeadId(leadId);
        lc.setContactId(contactId);
        lc.setOpportunityName(opportunityName);
        lc.setOwnerId(ownerId);
        return Database.convertLead(lc);
    }
    public static testMethod void testConvertLead() {
        Account ac = new Account(name = 'Test Account');
        insert ac;
        Opportunity op = new Opportunity(name = 'Test Account - Test Method opp', AccountId = ac.Id,StageName='Test',CloseDate=date.Today());
        Profile p=[select id from Profile where name='System Administrator' limit 1];
        user u=[select id from user where LastName='Fine' limit 1];
         op.ownerID=u.id;
        reporting_position__c rp=new reporting_Position__c();
        rp.assigned_User__c=u.id;
        Reporting_Position__c rp2=[select id, territory__c from Reporting_Position__c limit 1];
        rp.Territory__c=rp2.id;
        insert rp;
        op.reporting_Position__c=rp.id;
        insert op;
        Contact ct = new Contact(LastName = 'Test Last Name', accountid=ac.id);
        insert ct;
        Lead l = new Lead(LastName = 'Test Lead',Company='Test Company');
        insert l;
        convertLeadToExistingOpp(op.id, ac.Id, ct.Id, l.Id);
        delete l;
        delete ct;
        delete op;

        //User u2 = new User(LastName = 'some user', Username='test@test.com', Email='test@test.com', Alias='test', CommunityNickname='test', TimeZoneSidKey, LocaleSidKey, EmailEncodingKey, ProfileId, LanguageLocaleKey]: [Username, Email, Alias, CommunityNickname, TimeZoneSidKey, LocaleSidKey, EmailEncodingKey, ProfileId, LanguageLocaleKey);
        //insert u2;
        User u2=[select id from user where LastName='Fine' and isActive=true limit 1];
        l = new Lead(LastName = 'Test Lead',Company='test company');
        insert l;
        convertLeadToNewOpp('test Opp', u2.Id, ac.Id, ct.Id, l.Id);
        delete ac;
    }
    public static testMethod void testAddContactToOpportunity() {
        Opportunity op = new Opportunity(name = 'Test Method opp', StageName='Test',CloseDate=date.Today());
        Profile p=[select id from Profile where name='System Administrator' limit 1];
        user u=[select id from user where LastName='Fine' limit 1];
        op.ownerID=u.id;
        reporting_position__c rp=new reporting_Position__c();
        rp.assigned_User__c=u.id;
        Reporting_Position__c rp2=[select id, territory__c from Reporting_Position__c limit 1];
        rp.Territory__c=rp2.id;
        insert rp;
        op.reporting_Position__c=rp.id;
        insert op;
        Contact ct = new Contact(LastName = 'Testing123');
        insert ct;
        addContactToOpportunity(op.Id, ct.Id);
        addContactToOpportunity(op.Id, ct.Id);
        delete ct;
        delete op;
    }
}

 

 

  • March 25, 2011
  • Like
  • 0

Hello everyone, I'm tryng to make it so that my pdf controller can build by product subcategory, without the need to hardcode it in.

 

To do this, I performed a mix of Custom Object and Map<String, List<LineItems>> in my controller, and for the most part it works, except when transferring the values of the Map to a List<List<LineItems>>, it becomes out of order and products will be put under the wrong category. Any idea how I can address this issue?

 

Thank you for your time.

  • February 22, 2011
  • Like
  • 0

I'm having a bit of trouble getting a syncing feature to work.

 

Basically, it's getting information from several Long Text Area fields on the product level to one other field on the quote level.

 

I got it most working, but I'm having two problems.

 

One involves the quote level field started with ther word 'null' before putting the other notes in and the other is instructing a new line command "+ '\n' " but not actually making a new line.

 

Any ideas? Thanks in advanced

  • January 18, 2011
  • Like
  • 0

I was correcting some mistakes when I began to receive this error on something that previously worked and I'm not sure why it's not working now. I've narrowed it down to this section of code:

 

 

List<Contract_Line_Item__c> current_cls=[select Id, hasCPI__c, Name, Product__c, Net_Price__c, Quantity__c, Maintenance_Amount__c, isCheckbox__c from Contract_Line_Item__c where Contract__c=:current.Id];
    
    List<Contract_Line_Item__c> cls=new  List<Contract_Line_Item__c>();
   
    boolean cpiX;
    for(Contract_Line_Item__c cli:current_cls){
     if(cli.Maintenance_Amount__c > 0)
     {	
     	
     	cpiX=false;
     	Contract_Line_Item__c cl = cli.clone(false, true);
     	Contract_Line_Item__c cpi = cli.clone(false, true);
     	cl.Net_Price__c=0;
     	cl.Services_Amount__c=0;
     	if(!cli.isCheckbox__c)
     	{
     	cpi.Net_Price__c=0;
     	cl.Contract__c=c.Id;
     	cl.Net_Price__c=0;
     	if(current.CIPIX_Increase__c=='Yes' && current.CPI_Increase_Percent__c!=null){
      		if(cli.hasCPI__c)
      			cl.Maintenance_Amount__c*=1+(current.CPI_Increase_Percent__c/100);
     		cl.hasCpi__c=true;
     		cpi.hasCPI__c=true;
     		cpi.Contract__c=c.Id;
     		cpi.Maintenance_Amount__c=cl.Maintenance_Amount__c*(current.CPI_Increase_Percent__c/100);
     		cpi.Name=cli.Name;
     		cpi.isCheckbox__c=true;
     		cpiX=true;
     		}
     	cls.add(cl);
     	if(cpiX)
     		cls.add(cpi);
     	
     	a=new Asset();
     	a.AccountId = c.AccountId;
  	    a.Product2Id=cli.Product__c;
   	    a.Name=cli.Name + ' - Asset';
 	    a.ContactId=Cont;
 	    if(c.startDate!=null){
 	    a.installDate=c.StartDate;
 	    date enddate=c.StartDate.addMonths(12).addDays(-1);
 	    a.UsageEndDate=enddate;
 	    }
 	    
 	    insert a;}
 	    else{
 	    	delete cli;}
     	
	  }
    }
   
    insert cls;

 

And when I comment out the "If.isCheckBox__c) sections, I get a 'de-referencing a null object error'. Any advice?

 

  • November 29, 2010
  • Like
  • 0

I need to increment a variable in VF here's the jist of what I have.

 

                <apex:variable value="{!0}" var="rowNum"/>

                <apex:pageBlockTable value="{!opp_products_list}" var="item">
                   <apex:variable var="rowNum" value="{!rowNum+1}"/>

               </apex:pageBlockTable>

 

Any ideas?

  • November 16, 2010
  • Like
  • 0

Hello, I'm trying to only display certain information based on a certain criteria. For instance, in the following code, only the information within the outputfield should should if there is a value in the Hotel__c field. However, I can't seem to make that work. Can you offer any advice?

 

<outPutfield rendered="{!IF(ISBLANK(Travel_Service__c.Hotel__c), false, true)}">
     <tr>
         <td  colspan="5">HTL - {!Travel_Service__c.Hotel__c} - {!Travel_Service__c.Hotel_Confirmation_Number__c}</td>
         <td align="right" style="border-left:1px solid black;">
             <apex:outputText value="${0, number,###,##0.00}">
                 <apex:param value="{!Travel_Service__c.Hotel_Total_Cost__c}"/>
             </apex:outputtext>
         </td>
     </tr>
     <tr colspan="6" class="separator">
         <td  colspan="5"></td>
         <td style="border-left:1px solid black;"></td>
     </tr>

</outputField>

 

Edit: I have looked around the boards and found a few solutions, but none work. The closest one being as follows:

 

<outputfield rendered="{!NOT(ISBLANK(Travel_Service__c.Hotel__c))}">
     <tr>
         <td  colspan="5">HTL - {!Travel_Service__c.Hotel__c} - {!Travel_Service__c.Hotel_Confirmation_Number__c}</td>
         <td align="right" style="border-left:1px solid black;">
             <apex:outputText value="${0, number,###,##0.00}">
                 <apex:param value="{!Travel_Service__c.Hotel_Total_Cost__c}"/>
             </apex:outputtext>
         </td>
     </tr>
     <tr colspan="6" class="separator">
         <td  colspan="5"></td>
         <td style="border-left:1px solid black;"></td>
     </tr>
</outputfield>

 

Progress: I can make it so that fields are hidden when they don't have a value, but not when they do have a value, I get a 'value for outputfield is not a dynamic binding'. Any idea what that means? The new code is:

 

     <apex:outputfield rendered="{!NOT(ISBLANK(Travel_Service__c.Auto_Provider__c))}">
     <tr>
         <td  colspan="5">AUTO - {!Travel_Service__c.Auto_Provider__c} - {!Travel_Service__c.Auto_Conf__c}</td>
         <td align="right" style="border-left:1px solid black;">
             <apex:outputText value="${0, number,###,##0.00}">
                 <apex:param value="{!Travel_Service__c.Auto_Total_Cost__c}"/>
             </apex:outputtext>
         </td>
     </tr>
     <tr colspan="6" class="separator">
         <td  colspan="5"></td>
         <td style="border-left:1px solid black;"></td>
     </tr>
     </apex:outputField>

  • November 02, 2010
  • Like
  • 0

Hello everyone,

 

I was formatting some outputText informaton the other day, but now I have the opposite. Formatting input. My code is like so

 

<apex:column style="width: 60px;">
      <apex:inputText value="{!item.QuoteLine.Standard_Unit_Cost__c}" style="width: 60px;"/>
     <apex:facet name="header">PE/Standard Unit Cost</apex:facet>
     <apex:facet name="footer">
         <apex:outputText value="${0, number,###,##0.00}">
             <apex:param value="{!hardware.totalPE}"/>
         </apex:outputtext>
      </apex:facet>
    </apex:column>

 

Basically, it comes out as something like '20.0' and in this case I'd like for it to come out as '20.00'

 

Any recommendations?

  • October 19, 2010
  • Like
  • 0

Hello,

 

I have checked the boards and tried the samples, but for some reason when I used this bit of code to format my currency:

 

         <apex:outputText value="Rs{0,number, $###,##0.00}">
             <apex:param value="${!opp.Total_Referrals__c}"/>
         </apex:outputText>

 

I get this error:

 

Error: The value attribute on <apex:outputText> is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.

 

I'm clueless in what to do. I merely wish for a basic currency formatting technique. If you can offer any advice, I'd be appreciative.

  • October 18, 2010
  • Like
  • 1