• Amy Thropp
  • NEWBIE
  • 25 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 6
    Replies
I have a custom object that acts as a parent for a grouping of opportunities of a specific record type. If a user clicks "Add" on the Opportunity related list on this custom object, a trigger on the opportunity object execs to pre-populate certain fields on the opportunity record (some custom, some standard).  Here's the trigger:

trigger GOPlanOppSync on Opportunity (before insert, before update) {

   //Loop through all records in the Trigger.new collection
   for(opportunity o: Trigger.new){
       if (o.recordtype.name =='HVAC GO Plan') {
           Go_Opp__c GOPlan = [SELECT
                                DC__c,
                               Id,
                               JDE_Agency__c,
                               JDE_Parent__c,
                               JDE_Region__c,
                               JDE_Rep__c,
                               NationalCust__c,
                               SF_Agency__c,
                               SF_Parent__c,
                               SF_Region__c,
                               SF_rep__c,
                               State__c,
                               text_ID__c
                               FROM Go_Opp__c where id=:o.Go_Plan_Opportunity__c];
           //update opp fields from go opp header
           o.jde_agency__c = GOPlan.JDE_Agency__c;
           o.accountID = GOPlan.SF_Parent__c;
           o.sf_agency__c = GOPlan.sf_agency__c;
           o.sf_region__c = GOPlan.sf_region__c;
           o.sf_rep__c = GOPlan.sf_rep__c;
           o.Parent_text_ID__c = GOPlan.text_ID__c;
           o.text_id__c = GOPlan.jde_region__c.trim()+GOPlan.jde_agency__c.trim()+GOPlan.jde_parent__c.trim()+o.jde_category__c.trim()+GOPlan.state__c.trim();
           if (GOPlan.nationalcust__c) {
               o.text_id__c=o.text_id__c+'1';
           } else {
               o.text_id__c = o.text_id__c+'0';
           }
           if (GOPlan.dc__c) {
               o.text_id__c = o.text_Id__c + '1';
           } else {
               o.text_id__c = o.text_id__c + '0';
           }
       }
   }
}

If the user just sets up one of these opportunities from the Opportunity tab, I don't want the trigger to execute, but if they click on "Add" from the "Parent" object, then I want the trigger to execute.

What can I look for to determine if the "Add" was requested standalone (from the Opportunity page) or from the custom object's related list, so I can surpress the trigger except when coming from the related list?
Hi all,

I have a visualforce page that uses a standard HTML form to get values from the account record, asks for input for an item # (custom field in quotelineitem) and calls a report, filling in the parameters. It works perfectly when I run it as an admin, but when running as a user, the parameter values drop out and one of the parameters dispappears completely. Here's the VF page:

<apex:page standardController="Account" >
    
    <apex:pageblock >
        Account: {!account.jde_account_number__c}<br/>
    
            <form name = "GetItem" action="https://na28.salesforce.com/00O1A000006Y5gD" method="get" >
             <p>Account #: <input size="5" name = "pv0" value = "{!account.JDE_Account_Number__c}"/></p>
             <p>Item #: <input size="50" name="pv1" value=""/></p>
             <p>Parent Account #: <input size="5" name = "pv2" value = "{!account.JDE_P__c}"/></p>
            <p><input type="submit" value="Search Quotes" /></p>
            </form>
</apex:pageblock>     
</apex:page>

Any ideas on why the parameters work OK when running as admin vs user?

Regards,

Amy Thropp
Hi all,

I have a visualforce component that allows a user to do a price lookup when on the accounts page. When the page renders, the cursor goes to the data entry field in the visualforce component. Because that component is towards the bottom of the page, the page scrolls past all the basic account information and the cursor is placed in the component's data entry field. Entry is not required, just there for convenience. 

Any way to control this behavior?

Thanks,

Amy Thropp

 
I'm trying to generate Apex for the WSDL below. The element that fails is: confirmedAdvCustomerPriceFields

I think it might have to do with the "complexType" definitions in the schema, but not sure. Anyone have any ideas?

<?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-b13937 svn-revision#13942. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-b13937 svn-revision#13942. -->
<definitions xmlns:wssutil="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://oracle.e1.bssv.JP550002/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://oracle.e1.bssv.JP550002/" name="AdvCustomerPriceManagerService">
    <wsp:UsingPolicy wssutil:Required="true"/>
    <wsp1_2:Policy wssutil:Id="bssvpolicy">
        <ns1:TransportBinding xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
            <wsp1_2:Policy>
                <ns1:TransportToken>
                    <wsp1_2:Policy>
                        <ns1:HttpsToken/>
                    </wsp1_2:Policy>
                </ns1:TransportToken>
                <ns1:AlgorithmSuite>
                    <wsp1_2:Policy>
                        <ns1:Basic256/>
                    </wsp1_2:Policy>
                </ns1:AlgorithmSuite>
                <ns1:Layout>
                    <wsp1_2:Policy>
                        <ns1:Lax/>
                    </wsp1_2:Policy>
                </ns1:Layout>
            </wsp1_2:Policy>
        </ns1:TransportBinding>
        <ns2:SupportingTokens xmlns:ns2="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
            <wsp1_2:Policy>
                <ns2:UsernameToken ns2:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
                    <wsp1_2:Policy>
                        <ns2:WssUsernameToken10/>
                    </wsp1_2:Policy>
                </ns2:UsernameToken>
            </wsp1_2:Policy>
        </ns2:SupportingTokens>
    </wsp1_2:Policy>
    <types>
        <xsd:schema targetNamespace="http://oracle.e1.bssv.JP550002/">
            <xsd:complexType name="confirmedAdvCustomerPriceFields">
                <xsd:complexContent>
                    <xsd:extension base="ns0:valueObject">
                        <xsd:sequence>
                            <xsd:element name="price" type="xsd:decimal" minOccurs="0"/>
                            <xsd:element name="sfid" type="xsd:string" minOccurs="0"/>
                        </xsd:sequence>
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
            <xsd:complexType name="e1Message">
                <xsd:sequence>
                    <xsd:element name="message" type="xsd:string" minOccurs="0"/>
                    <xsd:element name="messagePrefix" type="xsd:string" minOccurs="0"/>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="advCustomerPriceFields">
                <xsd:complexContent>
                    <xsd:extension base="ns0:valueObject">
                        <xsd:sequence>
                            <xsd:element name="accountNumber" type="xsd:int" minOccurs="0"/>
                            <xsd:element name="item" type="xsd:string" minOccurs="0"/>
                            <xsd:element name="sfid" type="xsd:string" minOccurs="0"/>
                        </xsd:sequence>
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
            <xsd:complexType name="valueObject"/>
            <xsd:complexType name="e1MessageList">
                <xsd:sequence>
                    <xsd:element name="e1Messages" type="ns0:e1Message" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="confirmedAdvCustomerPrice">
                <xsd:complexContent>
                    <xsd:extension base="ns0:messageValueObject">
                        <xsd:sequence>
                            <xsd:element name="advancedPrices" type="ns0:confirmedAdvCustomerPriceFields" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
                        </xsd:sequence>
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
            <xsd:complexType name="BusinessServiceException">
                <xsd:sequence>
                    <xsd:element name="message" type="xsd:string" minOccurs="0"/>
                    <xsd:element name="requestID" type="xsd:string" minOccurs="0"/>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="messageValueObject">
                <xsd:complexContent>
                    <xsd:extension base="ns0:valueObject">
                        <xsd:sequence>
                            <xsd:element name="e1MessageList" type="ns0:e1MessageList" minOccurs="0"/>
                        </xsd:sequence>
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
            <xsd:complexType name="advCustomerPrice">
                <xsd:complexContent>
                    <xsd:extension base="ns0:valueObject">
                        <xsd:sequence>
                            <xsd:element name="getPrices" type="ns0:advCustomerPriceFields" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
                        </xsd:sequence>
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
            <xsd:element name="getAdvCustomerPrice" type="ns0:advCustomerPrice" nillable="true"/>
            <xsd:element name="BusinessServiceException" type="ns0:BusinessServiceException"/>
            <xsd:element name="getAdvCustomerPriceResponse" type="ns0:confirmedAdvCustomerPrice" nillable="true"/>
        </xsd:schema>
    </types>
    <message name="getAdvCustomerPrice">
        <part name="getAdvCustomerPrice" element="tns:getAdvCustomerPrice"/>
    </message>
    <message name="getAdvCustomerPriceResponse">
        <part name="getAdvCustomerPriceResponse" element="tns:getAdvCustomerPriceResponse"/>
    </message>
    <message name="BusinessServiceException">
        <part name="fault" element="tns:BusinessServiceException"/>
    </message>
    <portType name="AdvCustomerPriceManager">
        <operation name="getAdvCustomerPrice">
            <input wsam:Action="http://oracle.e1.bssv.JP550002/AdvCustomerPriceManager/getAdvCustomerPriceRequest" message="tns:getAdvCustomerPrice"/>
            <output wsam:Action="http://oracle.e1.bssv.JP550002/AdvCustomerPriceManager/getAdvCustomerPriceResponse" message="tns:getAdvCustomerPriceResponse"/>
            <fault message="tns:BusinessServiceException" name="BusinessServiceException" wsam:Action="http://oracle.e1.bssv.JP550002/AdvCustomerPriceManager/getAdvCustomerPrice/Fault/BusinessServiceException"/>
        </operation>
    </portType>
    <binding name="AdvCustomerPriceManagerPortBinding" type="tns:AdvCustomerPriceManager">
        <wsp:PolicyReference URI="#bssvpolicy"/>
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <operation name="getAdvCustomerPrice">
            <soap:operation soapAction=""/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="BusinessServiceException">
                <soap:fault name="BusinessServiceException" use="literal"/>
            </fault>
        </operation>
    </binding>
    <service name="AdvCustomerPriceManagerService">
        <port name="AdvCustomerPriceManagerPort" binding="tns:AdvCustomerPriceManagerPortBinding">
            <soap:address location="https://jdeweb03.diversitech.com:443/PY910/AdvCustomerPriceManager"/>
        </port>
    </service>
</definitions>
I have a custom object that has related activities. I want to query events, current or in history, related to that custom object.

I can't seem to get around the error message that the activityhistory does support query.

Any suggestions on how to get around this? I know you can use activity history in a subquery, I just can't seem to get the syntax right.
I have the following URL behind the button:

https://pi.pardot.com/list/pullCrmCampaign/fid/{!Campaign.Id}/campaignName/{!URLENCODE(Campaign.Name)}/leadCount/{!Campaign.NumberOfLeads}/contactCount/{!Campaign.NumberOfContacts}?sessionid={!$Api.Session_ID}&serverurl={!$Api.Partner_Server_URL_90}

Can I create some apex code to do this and put it on the scheduler?

Amy
When my users do a lookup of accounts and don't find the account, they click "new" and then the form that appears does not contain all our requried fields, so they can't save the record. Is there a way to add and remove fields from this form...Doesn't seem to be the Compact layout, which is what I thought it would be.
Hi all,

I have created the controller extension shown below, to add a visualforce page to my standard layout for a custom object.

Below is my controller, test class, and visualforce page. Right now, coverage is only 67%.

When I run the visualforce page that uses this extension, it works. How do I interrogate the value of “activePrograms” so I can bump up my coverage. Everything I’ve tried returns nulls.


public class DisplayActivePrograms {
               private final Call_Report__c callReport;
    
    public DisplayActivePrograms(ApexPages.StandardController stdController) {
        this.callReport = (Call_Report__c)stdController.getRecord();
    }

                public list<active_program__c> activePrograms;   
    public list<active_program__c>  getActivePrograms() {
        if (activePrograms == null) {
            activeprograms = [select
                                name,
                                category__r.name,
                                category__r.Category_Description__c,
                                start_date__c,
                                end_date__c
                 from active_program__c
                 where
                                end_date__c >= today];  
           
        }
       
        return activePrograms;
    }


@istest
public class DisplayActivePrograms_test {
  PUBLIC static @istest void DisplayActivePrograms_test() {
     account acct = new account(name='abc', phone = '999999999');
     insert acct;
     Call_report__c cr = new Call_report__c(call_date__c = date.newInstance(2014, 7, 1), customer__c=acct.id);
     insert cr;
     srp2__c cat = new srp2__c(name='123',category_description__c = '123 description');
     insert cat;
     date sdt = date.newInstance(2014, 6, 23);
     date edt = date.newInstance(2014, 8, 31);
     active_program__c ap = new active_program__c(name='test name for category 462', category__c=cat.id,start_date__c = sdt, end_date__c = edt);
     insert ap;
   
     ApexPages.StandardController sc = new ApexPages.standardController(cr);
     system.assert(sc != null);

  }
}



<apex:page standardcontroller="Call_Report__c" extensions="DisplayActivePrograms">
   <apex:pageBlock Title="Active Programs">
    <table width="100%">
        <tr>
        <td> <b>Program Name</b> </td>
        <td> &nbsp; </td>
        <td> <b>Category</b> </td>
        <td> &nbsp; </td>
        <td> <b>Category Name</b> </td>
        <td> &nbsp; </td>
        <td> <b>Start Date</b> </td>
        <td> &nbsp; </td>
        <td> <b>End Date</b> </td>
        </tr>
        <tr>
        <td colspan="9"> <hr/> </td>
        </tr>
    <apex:repeat value="{!activePrograms}" var="a">
       
        <tr>
            <td> {!a.Name} </td>
                    <td> &nbsp; </td>
            <td> {!a.Category__r.name} </td>
                    <td> &nbsp; </td>
            <td> {!a.Category__r.Category_Description__c} </td>
                    <td> &nbsp; </td>
            <td><apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                <apex:param value="{!a.Start_Date__c}" />
                </apex:outputText> </td>
                        <td> &nbsp; </td>
            <td><apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                <apex:param value="{!a.End_Date__c}" />
                </apex:outputText> </td>
           
        </tr>
    </apex:repeat>
        </table>

    </apex:pageBlock>
</apex:page>
If I want to show a smaller, more compact layout on salesforce1 for my mobile users, but continue to show our current default view when users are using a computer to view salesforce, how do I do that? If you can only have one profile per user and one page layout per profile for a specific record type, how can I do this?
Hi all,

We have a problem in production because, after removing some classes that weren't in use, but were well tested, our total coverage has dropped down below 75% and now we can't add any more stuff until we work out what we need to do.

Much of our Apex is contractor-developed code for our integration with our JD Edwards ERP system.  Many of the classes installed already look like the one listed below, and are coming up with 0% code coverage. If I can work out how to hit these classes with test procedures, I'm sure I can get us back over 75% (we're at 72% now).

My question is: How do you test a class like the one listed below?


public class jdeContractPriceManagerBase {
    public class ValueObject {
        private String[] apex_schema_type_info = new String[]{'http://base.bssvfoundation.e1.oracle','false','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class MessageValueObject {
        public jdeContractPriceManagerUtil.E1MessageList e1MessageList;
        private String[] e1MessageList_type_info = new String[]{'e1MessageList','http://util.bssvfoundation.e1.oracle','E1MessageList','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://base.bssvfoundation.e1.oracle','false','false'};
        private String[] field_order_type_info = new String[]{'e1MessageList'};
    }
}

Thanks for any help you can provide.
Hi all,

I have a visualforce page that uses a standard HTML form to get values from the account record, asks for input for an item # (custom field in quotelineitem) and calls a report, filling in the parameters. It works perfectly when I run it as an admin, but when running as a user, the parameter values drop out and one of the parameters dispappears completely. Here's the VF page:

<apex:page standardController="Account" >
    
    <apex:pageblock >
        Account: {!account.jde_account_number__c}<br/>
    
            <form name = "GetItem" action="https://na28.salesforce.com/00O1A000006Y5gD" method="get" >
             <p>Account #: <input size="5" name = "pv0" value = "{!account.JDE_Account_Number__c}"/></p>
             <p>Item #: <input size="50" name="pv1" value=""/></p>
             <p>Parent Account #: <input size="5" name = "pv2" value = "{!account.JDE_P__c}"/></p>
            <p><input type="submit" value="Search Quotes" /></p>
            </form>
</apex:pageblock>     
</apex:page>

Any ideas on why the parameters work OK when running as admin vs user?

Regards,

Amy Thropp
I have a custom object that has related activities. I want to query events, current or in history, related to that custom object.

I can't seem to get around the error message that the activityhistory does support query.

Any suggestions on how to get around this? I know you can use activity history in a subquery, I just can't seem to get the syntax right.
Hi all,

I have created the controller extension shown below, to add a visualforce page to my standard layout for a custom object.

Below is my controller, test class, and visualforce page. Right now, coverage is only 67%.

When I run the visualforce page that uses this extension, it works. How do I interrogate the value of “activePrograms” so I can bump up my coverage. Everything I’ve tried returns nulls.


public class DisplayActivePrograms {
               private final Call_Report__c callReport;
    
    public DisplayActivePrograms(ApexPages.StandardController stdController) {
        this.callReport = (Call_Report__c)stdController.getRecord();
    }

                public list<active_program__c> activePrograms;   
    public list<active_program__c>  getActivePrograms() {
        if (activePrograms == null) {
            activeprograms = [select
                                name,
                                category__r.name,
                                category__r.Category_Description__c,
                                start_date__c,
                                end_date__c
                 from active_program__c
                 where
                                end_date__c >= today];  
           
        }
       
        return activePrograms;
    }


@istest
public class DisplayActivePrograms_test {
  PUBLIC static @istest void DisplayActivePrograms_test() {
     account acct = new account(name='abc', phone = '999999999');
     insert acct;
     Call_report__c cr = new Call_report__c(call_date__c = date.newInstance(2014, 7, 1), customer__c=acct.id);
     insert cr;
     srp2__c cat = new srp2__c(name='123',category_description__c = '123 description');
     insert cat;
     date sdt = date.newInstance(2014, 6, 23);
     date edt = date.newInstance(2014, 8, 31);
     active_program__c ap = new active_program__c(name='test name for category 462', category__c=cat.id,start_date__c = sdt, end_date__c = edt);
     insert ap;
   
     ApexPages.StandardController sc = new ApexPages.standardController(cr);
     system.assert(sc != null);

  }
}



<apex:page standardcontroller="Call_Report__c" extensions="DisplayActivePrograms">
   <apex:pageBlock Title="Active Programs">
    <table width="100%">
        <tr>
        <td> <b>Program Name</b> </td>
        <td> &nbsp; </td>
        <td> <b>Category</b> </td>
        <td> &nbsp; </td>
        <td> <b>Category Name</b> </td>
        <td> &nbsp; </td>
        <td> <b>Start Date</b> </td>
        <td> &nbsp; </td>
        <td> <b>End Date</b> </td>
        </tr>
        <tr>
        <td colspan="9"> <hr/> </td>
        </tr>
    <apex:repeat value="{!activePrograms}" var="a">
       
        <tr>
            <td> {!a.Name} </td>
                    <td> &nbsp; </td>
            <td> {!a.Category__r.name} </td>
                    <td> &nbsp; </td>
            <td> {!a.Category__r.Category_Description__c} </td>
                    <td> &nbsp; </td>
            <td><apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                <apex:param value="{!a.Start_Date__c}" />
                </apex:outputText> </td>
                        <td> &nbsp; </td>
            <td><apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                <apex:param value="{!a.End_Date__c}" />
                </apex:outputText> </td>
           
        </tr>
    </apex:repeat>
        </table>

    </apex:pageBlock>
</apex:page>
If I want to show a smaller, more compact layout on salesforce1 for my mobile users, but continue to show our current default view when users are using a computer to view salesforce, how do I do that? If you can only have one profile per user and one page layout per profile for a specific record type, how can I do this?
Hi all,

We have a problem in production because, after removing some classes that weren't in use, but were well tested, our total coverage has dropped down below 75% and now we can't add any more stuff until we work out what we need to do.

Much of our Apex is contractor-developed code for our integration with our JD Edwards ERP system.  Many of the classes installed already look like the one listed below, and are coming up with 0% code coverage. If I can work out how to hit these classes with test procedures, I'm sure I can get us back over 75% (we're at 72% now).

My question is: How do you test a class like the one listed below?


public class jdeContractPriceManagerBase {
    public class ValueObject {
        private String[] apex_schema_type_info = new String[]{'http://base.bssvfoundation.e1.oracle','false','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class MessageValueObject {
        public jdeContractPriceManagerUtil.E1MessageList e1MessageList;
        private String[] e1MessageList_type_info = new String[]{'e1MessageList','http://util.bssvfoundation.e1.oracle','E1MessageList','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://base.bssvfoundation.e1.oracle','false','false'};
        private String[] field_order_type_info = new String[]{'e1MessageList'};
    }
}

Thanks for any help you can provide.