• sfdc1.3890582999007844E12
  • NEWBIE
  • 13 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 10
    Replies
New to APEX and need help bulkifying this trigger.  The Eval_Request__c is the parent object of Eval_Unit_Details__c.  Thanks in advance!!!

trigger Update_Email_on_Eval_Detail on Eval_Unit_Details__c (before insert) {

    Eval_Unit_Details__c EUD = trigger.new[0];{
        Eval_Request__c ER = [select shipping_contact_email__c from Eval_Request__c where id=:EUD.eval_request__c];
        EUD.Shipping_Contact_Email__c=ER.Shipping_Contact_Email__c;
    }

I created one custom field and it is in standard layout The requirement is the record currency USD and our org currrency is EUR 

User wants to see only USD but it's showing EUR converted also can we hide that EUR conversion(I want to hide it for this particular field) with you customization ?????
User-added image

Hi guys,

I am having an issue when trying to implement Enqueue. The error says that the constructor is not defined.
Constructor not defined: [job1].<Constructor>(List<Account>)
I have a trigger that enqueues a class:
trigger CreateAccount on object (before insert) { 
        if (Trigger.isBefore && Trigger.isInsert) { 
                   System.enqueueJob(new job1(Trigger.new)); 
        } 
}
Here is the class that I am devloping:
public class job1 implements Queueable{ 
          public static void job1 (List<Account> Acc) { 

          } 

          public void execute(QueueableContext abcs) { 
                   actions .... 
          }
}

How can I fix this error?

Thank you.
I have created multiple visualforce pages to go into lightning app builder (I have to do this instead of components because we have many users and are not ready to deploy domain name, so I cannot use lightning components yet). I'd like to expand the apex page to all corners of the alotted space that is given from the app and remove the name of the visualforce page. 

When I inspect the page, I can move the visualforce page where I'd like it to move within the area using .slds-card__body.slds-card__body--inner and modifying the top-margin to -50px, however, it modifies every visualforce page in the app. When I add this class to the code of my visualforce page and modify the margins in the style it doesn't render. It is nested under an <article class> and I'm not sure how to adjust my class in the visualforce page to account for the article, which I believe is why it's not working. Below is a picture of how this looks: User-added image
This is how it looks now:


 User-added image
This is how I'd like it to look: 
User-added image
The other option I considered was creating a visualforce page with multiple pageblock sections however (although it's not pictured in this example), I need each section to display a separate opportunity list, and I could not find a way to do that using this method, but any suggestions are welcomed!
Thank you!!
<apex:page standardController="Opportunity" recordsetvar="opportunities" id="standopp" showHeader="false">

<div class="slds-card__body.slds-card__body--outer">
<div class=".slds-card__header.slds-grid" style="margin-left:-20px; margin-top:-50px;">
 <apex:form title="form" id="form"  style="zoom:75%; height:550px;width:100% showscroll:False">
  <apex:pageblock id="firstpb" title="firstpb">
   <apex:panelgrid columns="4" id="panelg" title="panelg">
    <apex:outputlabel value="view:"/>
     <apex:selectlist value="{!filterId}" id="select1" title="select1" size="1">
     <apex:selectOptions value="{!listviewoptions}"/>
     <apex:actionsupport event="onchange" rerender="oppsection"/>
    </apex:selectlist>
   </apex:panelgrid>
  <apex:pageblockbuttons >
   <apex:commandButton value="Save" action="{!save}"/>
   <apex:commandButton value="Quick Save" action="{!save}"/>
  </apex:pageblockbuttons> 
  
 
   <apex:pageblocksection id="oppsection" showheader="true">
   <apex:outputPanel style="overflow:auto;width:650px;height:250px">
    <apex:repeat value="{!opportunities}" var="opp" id="rep">
     <apex:pageblocksection id="oppsection2" showheader="true" title="{!opp.name} - {!opp.Billing_City_State__c}">
      <apex:pageblocktable id="table"  value="{!opp.name}" title="pbt1" columns="4" var="pbt" style="width:100px">
       <apex:column headerValue="Information" style="width:100px" >
        <apex:inputField style="width:100px" value="{!opp.stageName}"/><br/>
        <apex:inputField style="width:100px" value="{!opp.LeadSource}"/> <br/><br/>
        <apex:inputField style="width:100px" value="{!opp.Priority__c}"/>
       </apex:column>
       <apex:column headerValue="Information"  style="width:100px" >
        <apex:outputtext style="width:100px" styleclass="bold" value="Overview"></apex:outputtext><br/>     
        <apex:inputField style="width:100px" value="{!opp.Company_Overview__c}" /> <br/>
        <apex:outputtext style="width:100px" styleclass="bold" value="Last Activity"></apex:outputtext><br/> 
        <apex:inputField style="width:100px" value="{!opp.Last_Activity_Date__c}" /> <br/>  
        <apex:outputtext style="width:100px" styleclass="bold" value="Next Activity"></apex:outputtext><br/> 
        <apex:outputLink style="width:100px" value="/{!opp.Next_Activity_ID__c}">{!opp.Next_Activity_Due_Date__c}</apex:outputlink> <br/> 
        <apex:outputtext style="width:100px" styleclass="bold" value="FollowUp"></apex:outputtext><br/>
        <apex:inputField style="width:100px" value="{!opp.Follow_Up_Date__c}" />
       </apex:column>
        <apex:column headerValue="Inactive Stage" id="multi">
         <apex:inputField style="zoom:75%" value="{!opp.Inactive_Stage__c}"/ >
        
         <apex:outputtext value="Corporate?"></apex:outputtext> <apex:inputField value="{!opp.Handled_From_Coorporate__c}"/> &nbsp; <apex:outputtext value="HQ:?"></apex:outputtext> &nbsp;<apex:inputField style="width:100px" value="{!opp.Headquarters__c}"/> &nbsp;
         <apex:outputtext value="Email?"></apex:outputtext> <apex:inputField value="{!opp.Email_Blast__c}"/> <apex:outputtext value="Locations"></apex:outputtext> &nbsp; <apex:inputField style="width:100px" value="{!opp.Number_of_Locations__c}"/> 
        </apex:column>
      </apex:pageblocktable>
     </apex:pageblocksection> 
    </apex:repeat>
    </apex:outputpanel>
   </apex:pageblocksection>
   
  </apex:pageblock>
 </apex:form> 
 
<style language="css">

.opportunityTab .tertiaryPalette, .individualPalette .opportunityBlock .tertiaryPalette, .layoutEdit .individualPalette .opportunityBlock .tertiaryPalette {
    background-color: #005f93;
    border-color: #005f93;
    width:650px;
   
}    
.opportunityTab .secondaryPalette, .individualPalette .opportunityBlock .secondaryPalette {
    border-color: #005f93;
    
 }    
 
span.bold {
font-weight:bold;
}


</style>  
</div>
</div>
</apex:page>
In my test class I insert new products and pricebookentries, in my test class I don't use seeAllDate=true annotation and in order to retrieve standard pricebook id I used Test.getStandardPricebookId() method, here's my code:
Product2 p1 = new Product2(Name='Product Monthly 1111', Family='Monthly', isActive=true, CurrencyIsoCode='USD');
Product2 p2 = new Product2(Name='Product Yearly 2222', Family='Yearly', isActive=true, CurrencyIsoCode='USD');

insert new List<Product2>{p1, p2};

Id pricebookId = Test.getStandardPricebookId();

PricebookEntry pbe1 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p1.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=100);
PricebookEntry pbe2 = new PricebookEntry(Pricebook2id=pricebookId, Product2id=p2.ID, isActive=true, CurrencyIsoCode='USD', unitPrice=50);

insert pbe1;
insert pbe2;

List<PricebookEntry> pbes = [SELECT ID FROM PricebookEntry 
    WHERE Product2id IN (:p1.Id, :p2.Id) AND Pricebook2.isStandard = TRUE AND Pricebook2.isActive = TRUE AND CurrencyIsoCode = 'USD' AND isActive = TRUE];

System.assertEquals(2, pbes.size());


pbes.size() returns 0. I used the same query in console for existing data and I got results. What am I doing wrong?
New to APEX and need help bulkifying this trigger.  The Eval_Request__c is the parent object of Eval_Unit_Details__c.  Thanks in advance!!!

trigger Update_Email_on_Eval_Detail on Eval_Unit_Details__c (before insert) {

    Eval_Unit_Details__c EUD = trigger.new[0];{
        Eval_Request__c ER = [select shipping_contact_email__c from Eval_Request__c where id=:EUD.eval_request__c];
        EUD.Shipping_Contact_Email__c=ER.Shipping_Contact_Email__c;
    }

How to activate Quick Access Menu for Visual Force page. Based on Object.

I have activated the opportunity products (and 2 price books) in my sandbox environment and have activated "Prompt users to add products to opportunities"

 

After making a new Opportunity, in step 2 users have to select a pricebook before products can be added to the opportunity.

 

In our situation the two price books (professionals Services and projects) are dependent on the type of Opportunity: (professional Services and project). It would be very user friendly if the price book automaticly would be chosen dependent of the opportunity type that is filled in at the new Opportunity (professional services and projects).

 

At this moment users have to fill in what type of opportunity it is, but again have to select what pricebook belongs to that opportunity type. That's not ideal.

 

Is there a solution to automate this?

 

Hi,

Is there any reason that the setWhatId function can only be used when setTargetObjectId is a contact? I am building an email notice around a template and I want to send it to a user. Without the setWhatId, none of the merge fields pull through. Is there a work around that I am not aware of?


Thanks!


I am having a problem with the following query, but the query below works.  I am not sure what the problem is here as I am certain that the date value I am using is properly constrcted.

SELECT
   mc.CreatedById, mc.CreatedDate, mc.CurrencyIsoCode, mc.Id, mc.LastModifiedById, mc.LastModifiedDate, mc.Name, mc.Opportunity__c,
   mc.SystemModstamp, o.Name, o.AcceptStatus__c, o.AccountId, Opportunity__r.CloseDate
FROM
   Manager_Commit_v2__c  mc, mc.Opportunity__r o WHERE o.CloseDate > 2007-01-01T05:00:00Z


Here is the error info:
An error has occurred: {faultcode:'sf:INVALID_FIELD', faultstring:'INVALID_FIELD: value of filter criterion for field 'CloseDate' must be of type date and should not be enclosed in quotes', detail:{fault:{exceptionCode:'INVALID_FIELD', exceptionMessage:'value of filter criterion for field 'CloseDate' must be of type date and should not be enclosed in quotes', row:'1', column:'274', }, }, }

Here is the working query.
SELECT
   mc.CreatedById, mc.CreatedDate, mc.CurrencyIsoCode, mc.Id, mc.LastModifiedById, mc.LastModifiedDate, mc.Name, mc.Opportunity__c,
   mc.SystemModstamp, o.Name, o.AcceptStatus__c, o.AccountId, Opportunity__r.CloseDate
FROM
   Manager_Commit_v2__c  mc, mc.Opportunity__r o WHERE o.CloseDate > TODAY


Thanks