• Aron Schor [Dev]
  • NEWBIE
  • 161 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 55
    Replies
Hi, there is a Apex class tied to a managed package.  It is failing as it is currently running with an inactive user.
We get emails like "Failed to process batch for class 'stayclassy.ClassyAggregateBatch' for job id 'XX'"
If I go to Apex Classes -> Schedule Apex, I do not see it.  I see the similar named "ClassyAggregate"

Any reason why I can't schedule ClassyAggregateBatch?  Thanks.  I am not a developer.
When I go to the "Streaming Push Topics" area of Workbench, it seems to keep generating handshakes.  Another colleague does not have this issue with a different Sandbox.  How do I resolve? 
Hi, I am trying a simple Mulesoft flow to read and create metadata, specifically a custom field. I have tried a variety of Transform outputs, and the ones that generate include
as Object {class : "com.sforce.soap.metadata.CustomField"} but that gives me the error. Any idea how to solve? Thanks...I am not a developer.
 
Read Metadata
Type: CustomField (CustomField) (CustomField)
Full Names: ["Contact.mulesoftid__c"]
 
Example Create Metadata
%dw 2.0
output application/java
---
[{
valueSet: {
valueSetDefinition: {
value: [{
fullName: payload.valueSet.valueSetDefinition.value[0].fullName
}]
}
}
} as Object {
class : "com.sforce.soap.metadata.CustomField"
}]
 
Thanks!
Hi,

I have a Visual Force template that shows items shipped and tracking information.
Each Sales Order has many Sales Order Lines.
 
Sales Order Lines are either Tracking or Products.
Products have a Line_Status__C that isn't null.
Tracking is on the Description field.  All other fields are null.
 
The template separates these, but it displays a blank section, almost like Tracking shows blank in the Products section and Products are blank in the Tracking section.  I have screen shots to illustrate.
 
Code is below.  Any idea here?  Thanks!  Not a developer here...

User-added image

Here is the second image.  Tracking is shown further below.
User-added image

<messaging:emailTemplate subject="{!relatedTo.Purchase_Order__c} Shipped" recipientType="User" relatedToType="Order_Header__c">
    <messaging:htmlEmailBody >
        <body style="font-family: 'Trebuchet MS'">
            <h4>
                Just letting you know Purchase Order - {!relatedTo.Purchase_Order__c},
                was shipped today.
            </h4>
            <hr style="border: solid thin #0099CC; margin-top: -18px;" />
 
            <br />
 
            <br />
 
            <table cellpadding="5" style="border-collapse: collapse" width="100%">
                <tr>
                    <td style="background-color: #0099CC; color: #FFFFFF">
                        <b>Stock Code</b>
                    </td>
                    <td style="background-color: #0099CC; color: #FFFFFF">
                        <b>Description</b>
                    </td>
                    <td style="background-color: #0099CC; color: #FFFFFF">
                        <b>Shipped Qty</b>
                    </td>
                    <td style="background-color: #0099CC; color: #FFFFFF">
                        <b>Status</b>
                    </td>
                </tr>
                <apex:repeat value="{!relatedTo.Order_Detail__r}" var="lineItem">
                    <tr style="display:{!IF(lineItem.Line_Status__c != null, '', 'none')}">
                        <td style="border-bottom: 1px solid #0099CC;">
                            <b>{!lineItem.Stock_Code__c}</b>
                        </td>
                        <td style="border-bottom: 1px solid #0099CC;">
                            {!lineItem.Description__c}
                        </td>
                        <td style="border-bottom: 1px solid #0099CC;">
                            {!lineItem.Shipped_Qty__c}
                        </td>
                        <td style="border-bottom: 1px solid #0099CC;">
                            {!lineItem.Line_Status__c}
                        </td>
                    </tr>
                </apex:repeat>
            </table>
 
            <br/>
 
            <h4>
                Tracking Code:
                <strong>
                    <apex:repeat value="{!relatedTo.Order_Detail__r}" var="lineItem">
                        <BR>{!IF(ISBLANK(lineItem.Stock_Code__c), lineItem.Description__c, NULL)}</BR>
                    </apex:repeat>
                </strong>
            </h4>
        </body>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>
 
Hi, I am trying to create a Visual Force email template that would display recently shipped items and tracking.

From the App Exchange, I downloaded "Product Line Items in Email Templates."

Its semi helpful, but it includes Opportunity and Products which seems to be a related or maybe lookup relationship.

In our system, the related Objects are a Master Detail Relationship.
Accounts -> Sales Orders -> Sales Order Lines

I am trying to do two unique things.

1. In terms of who gets emailed, instead of a Contact, is it possible to send an email to an address in an email field on the Sales Order Record, and if that is blank/null, send it to an address an on the Account object?

2. The Sales Order Lines will likely include Products and tracking. (I might need to make additional tweaks)
To display Products, I'd like to show Sales Order Lines where Line Status equals Shipped today.
To display tracking, I'd like to show Sales Order Lines where Description starts with TRPK.  (In our system, tracking lines display as TRPK 1Z11205, someting along those lines.)

If anyone can provide guidance to get me going, that would be appreciated.

Thanks,

Aron

Hi,

I get that error when I try to save this code.

trigger ExampleTrigger2 on Contact (after insert, after delete) {
    if (Trigger.isInsert) {
        Integer recordCount = Trigger.New.size();
        // Call a utility method from another class
        EmailManager.sendMail('aschor@acmeunited.com', 'Trailhead Trigger Tutorial', 
                    recordCount + ' contact(s) were inserted.');
    }
    else if (Trigger.isDelete) {
        // Process after delete
    }
}

thanks,
 

Aron

I am not sure if my subject is clear, but hopefully this helps.

I am working on a Site with a Product search feature for different divisions (division__C)

I want each division search page to only search for products of that division.

I have a search feature working, just need help tweaking it.  I have tried some things on my own with no luck, so I am hoping I can get some help.

1. If I change the class to say
WHERE Division__C = Office/School AND Area__C...

it says Authorization Required on search (Guest has field access)
I have a search feature working, just need help tweaking it.

2. If I change class to say
...OR Case_Quantity__c like \'%'+searchstring+'%\' AND Division__c like \'%'+Office/School+'%\''

it says Error    Error: Compile Error: Variable does not exist: Office at line 15 column 521

_____________

Working code:

public with sharing class prodsearchschool {

    private String sortOrder = 'Name';
    public list <Product2> Prod {get;set;} 
    public String searchstring {get;set;}
    public String searchquery {get;set;}
    public String sortField {get;set;}
    public String lastClicked {get;set;}
    public String sortDir {get;set;}

    public prodsearchschool() {}
     
         
    public PageReference search(){
        searchquery='select Area__C, ProductCode, Name, Color__C, Overall_Length__C, H__C, W__C, L__C, Case_Quantity__c from Product2 WHERE Area__C like \'%'+searchstring+'%\' OR ProductCode like \'%'+searchstring+'%\' OR Name like \'%'+searchstring+'%\' OR Color__C like \'%'+searchstring+'%\' OR Overall_Length__C like \'%'+searchstring+'%\' OR H__C like \'%'+searchstring+'%\' OR L__C like \'%'+searchstring+'%\' OR W__C like \'%'+searchstring+'%\' OR Case_Quantity__c like \'%'+searchstring+'%\'';  
        Prod = database.query(searchquery);
        return null;
    } 

    public void clear(){ 
        prod.clear(); 
    }

    public PageReference sortThis() {  
        if(lastClicked == null){
            sortDir = 'ASC';
        }
        else{
            if(lastClicked == sortField){
                sortDir = 'DESC';
            }
            else{
                sortDir = 'ASC';
            }
        }
        lastClicked = sortField;
       prod = Database.query(searchquery + ' order by ' + sortField + ' ' + sortDir);
       return null;
    } 
}
I am having problems creating this Apex class, a little confused as I have done them before.

Error: Compile Error: Illegal assignment from List<SObject> to List<User> at line 4 column 1

public class LastLogin {
    private String sortOrder = 'LastLoginDate';
public List<User> getUsers() {
List<User> results = Database.query(
        'SELECT FirstName, LastName, Username, MobilePhone, IsActive, LastLoginDate FROM User ' +
        'ORDER BY ' + sortOrder + ' DESC'
        );
    return results;
}
}

Thanks.
Hi, I have search page that I am using and I am trying to tweak the code to allow the columns displaying the results to be sorted (high to low or low to high or A-Z/Z-A.)  I know there was a Trailhead that showed it for a SOQL database query, so I tried using that code here but it didn't seem to do anything (I am not an experienced programmer.)  If there is an easy way to tweak this code to do this, let me know!  Code is below.

Thanks,

Aron

APEX CODE

<apex:page standardController="Product2" extensions="prodsearchcontroller" showheader="false" sidebar="false">  
  <apex:form >  
 <apex:inputText value="{!searchstring}" label="Input"/>   
  <apex:commandButton value="Search records" action="{!search}"/>  
  <apex:commandButton value="Clear records" action="{!search}"/>  
   <apex:pageBlock title="Search Result">  
         <apex:pageblockTable value="{!prod}" var="a">  
             <apex:column headerValue="Name">  
        <apex:commandLink action="{! sortByName }">  //ADDED THIS LINE
                    <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">
                             {!a.Name}
                   </apex:outputlink>  
                           </apex:commandLink> //ADDED THIS LINE
            </apex:column> 
            <apex:column headerValue="Product Family">
                 <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">
                            {!a.Family}
                 </apex:outputlink>  
           </apex:column> 
            <apex:column headerValue="Product Code">
                 <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">
                            {!a.ProductCode}
                 </apex:outputlink>  
           </apex:column> 
           <apex:column headerValue="Description"> 
                 <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">
                          {!a.Description}
               </apex:outputlink>  
            </apex:column> 
            <apex:column headerValue="Notes">
                  <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">
                           {!a.Notes__c}
                  </apex:outputlink>
                              </apex:column> 
            <apex:column headerValue="Dimensions">
                  <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">
                           {!a.Dimensions__c}
                  </apex:outputlink>    
            </apex:column>   
    </apex:pageBlockTable>     
   </apex:pageBlock>   
  </apex:form>  
   </apex:page>

APEX CLASS

public with sharing class prodsearchcontroller {  
private String sortOrder = 'Name';
   public list <Product2> Prod {get;set;}  
   public string searchstring {get;set;}  
   public prodsearchcontroller(ApexPages.StandardController controller) {  
   }  
   public void search(){  
     string searchquery='select Name, Family, ProductCode, Description, Dimensions__C, Notes__C from Product2 where Name like \'%'+searchstring+'%\' OR ProductCode like \'%'+searchstring+'%\' OR Description like \'%'+searchstring+'%\' OR Notes__C like \'%'+searchstring+'%\'';
     Prod= Database.query(searchquery);  
   }  
   public void clear(){  
   prod.clear();  
   }
   public void sortByName() {  //ADDED THIS LINE
    this.sortOrder = 'Name'; //ADDED THIS LINE
}  
 }
Hi,

I am conufsed on what to do, and I know I did this before which is adding to my frustration!

I hope I am on the right start...
If I go to Develop - Sites - Site Label - I see all Visual Page force pages there.
If I go to Public Access Settings - I have Default on for Documents
and Read for Documents under Standard Object Permissions.

Documents (images) aren't showing and I can't access other pages.  Any help would be appreciated.

thanks.

Aron
Hi, first, I am having problems linking a page to the main page.

It says "You have attempted to access a page that requires a salesforce.com login. If you are already a user of the system, please log in below" when I click the link.  It should be a public site.
If I go to "Sites:" "Home Page" and scroll down to "Site Visualforce Pages" it is shown there.  What else do I need to do.

Also, the images aren't displayed.
If I go to the image in Documents, it says "Externally Available Image."  What else do I need to do?

Lastly, if I view the page while signed in, the nav bar is displayed properly.  If not, it is shown as vertical text instead of a horizontal bar.

ie
o Products 
o Pricing 
 o Camillus 
 o Clauss 

Any idea why?

Thanks, Aron

Hi,
This is probably easy but I am a newbie and basically partially edited other code so not sure how to correct this issue.

IMAGE
OSHA

ISSUES:
There is no spacing or ideally other columns dividing the information.
There is no title.  Simply having the Name, ProductCode, Description, Notes would be fine.
I don't need the Product Id section but I tried using that info as it shows the Title.

I tried doing some searching and something called </apex:pageBlockSectionItem> but maybe that's for something else or I didn't use it properly.

CODE:
<apex:page standardController="Product2" extensions="prodsearchcontroller">  
  <apex:form >  
 <apex:inputText value="{!searchstring}" label="Input"/>   
  <apex:commandButton value="Search records" action="{!search}"/>  
  <apex:commandButton value="Clear records" action="{!search}"/>  
   <apex:pageBlock title="Search Result">  
    <apex:pageblockTable value="{!prod}" var="a">  
  <apex:column >  
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.Name}</apex:outputlink>  
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.ProductCode}</apex:outputlink>  
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.Description}</apex:outputlink>  
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.Notes__c}</apex:outputlink>  
     </apex:column>  
     <apex:column value="{!a.id}"/>  
    </apex:pageBlockTable>     
   </apex:pageBlock>   
  </apex:form>  
 </apex:page>

Thanks.

Hi, the page simply says "Saucony" and no data below.

The only thing I can think of based on a past one I did is to change line 2 of the class

From: public List<Sales_Order_Line__C> Sales_Order_Lines {get;set;} 
To: public List<Sales_Order_Line__C> Sales_Order_Line__C {get;set;} 

but I get the error
Error: Compile Error: Invalid identifier: Sales_Order_Line__C at line 2 column 34    

Any idea?  I have done similar ones that work, can't figure this one out.

This query alone does work and returns matches
SELECT SalesOrderSalesOrderLine__r.Account__r.Name, SalesOrderSalesOrderLine__r.OrderDate__C, ProductName__c, PurchaseQuantity__c FROM sales_order_line__C WHERE ProductName__C LIKE '%Guide%'

CLASS

public class SauconyController {
public List<Sales_Order_Line__C> Sales_Order_Lines {get;set;} 
    private String sortOrder = 'SalesOrderSalesOrderLine__r.OrderDate__C';
public List<Sales_Order_Line__C> getSales_Order_Lines() {
    List<Sales_Order_Line__C> results = Database.query(
        'SELECT SalesOrderSalesOrderLine__r.Account__r.Name, SalesOrderSalesOrderLine__r.OrderDate__C, ProductName__c, PurchaseQuantity__c ' +
        'FROM Sales_Order_Line__C' +
        'WHERE ProductName__c like %Guide% ' +
        'ORDER BY ' + sortOrder + ' DESC '
    );
    return results;
}
}

PAGE

<apex:page controller="SauconyController" sidebar="false" showheader="false">
<font size="5">
    <apex:form >
        <apex:pageBlock title="Saucony" id="Sales_Order_Lines_list">
            <!-- Sales Order Lines list -->
            <apex:pageBlockTable value="{! Sales_Order_Lines }" var="sl">
            <apex:column value="{!sl.SalesOrderSalesOrderLine__r.Account__r.Name}"/>
            <apex:column value="{!sl.SalesOrderSalesOrderLine__r.OrderDate__c}"/>
            <apex:column value="{!sl.ProductName__c}"/>
            <apex:column value="{!sl.PurchaseQuantity__c}"/>
        </apex:pageBlockTable>  
        </apex:pageBlock>
            </apex:form>
</font>
</apex:page>
 

Thanks.

Hi, I can use the code here, but I want to tweak it to work for Products.  I am hoping with some basic changes it can work.  I am a bit new to programming.  I posted on the site asking for help but got no reply so hoping someone here can help.
http://nirmalchristopher.blogspot.com/2013/12/search-page-in-visualforce-simplified.html

I tried changing the query to be
     string searchquery='select Name, ProductCode, Description, Notes__C from Product2 where (Name like \'%'+searchstring+'%\' OR ProductCode like \'%'+searchstring+'%\' OR Description like \'%'+searchstring+'%\' OR Notes__C like \'%'+searchstring+'%\');

and it says
    Error: Compile Error: line breaks not allowed in string literals at line 7 column -1

How do I fix?

Also, I assume to modify the page I would have to change 

1. <apex:page standardController="account" extensions="accsearchcontroller">  
"account" to "Product2"

2. and also change add output.
      <apex:outputlink value="https://ap1.salesforce.com/{!a.id}">{!a.ProductCode}</apex:outputlink>  
etc

Anything else?

Thanks!
I have been able to get similar ones to work (based on prior challenges) but I am struggling here.  Probably a newbie mistake somewhere.  Any help would be appreciated!  Thanks, Aron

-> Page (Gives Error: Unknown property 'String.Id error)

<apex:page controller="NewCaseListController">
    <apex:form >
        <apex:pageBlock title="Case List" id="Case_list">
            <!-- Case_list -->
         <apex:repeat value="{!Case}" var="case">
            <apex:outputLink value="{!Case.Id}">{!Case.Id}</apex:outputLink>
            <apex:outputLink value="{!case.CaseNumber}">{!case.CaseNumber}</apex:outputLink>
        </apex:repeat>      
        </apex:pageBlock>
    </apex:form>
</apex:page>

-> Class

ublic class NewCaseListController {

    public String getCase() {
        return null;
    }


    public String getCases() {
        return null;
    }

private String sortOrder = 'CaseNumber';
public List<Case> getNewCases() {
    List<Case> results = Database.query(
        'SELECT Id, CaseNumber ' +
        'FROM Case ' +
        'WHERE Status = New ' +
        'ORDER BY ' + sortOrder + ' ASC ' +
    );
    return results;
    }
}
Hi,

I am having problems setting up a custom controller.  I was able to create one based on a custom object with no problem, but I can't seem to get this to work.  I have tried twice and followed the Trailhead example. Information is below.  Thanks for any help.

-> APEX CLASS

public class CudaController {
    private String sortOrder = 'Sales_Order__C';
public List<Lead> getLeads() {
List<Lead> results = Database.query(
        'SELECT LastModifiedDate, Sales_Order__C, FirstName, LastName, Description' +
        'FROM Lead ' +
        'ORDER BY ' + sortOrder + ' DESC ' +
        'LIMIT 10'
    );
    return results;
}
}

-> PAGE

<apex:page controller="CudaController">
    <apex:form >
        <apex:pageBlock title="Cuda" id="Lead_list">
            <!-- Lead_list -->
            <apex:pageBlockTable value="{! Leads }" var="Lead">
            <apex:column value="{!Lead.LastModifiedDate}"/>
            <apex:column value="{!Lead.Sales_Order__c}"/>
            <apex:column value="{!Lead.FirstName}"/>
            <apex:column value="{!Lead.LastName}"/>
            <apex:column value="{!Lead.Description}"/>
        </apex:pageBlockTable>            
        </apex:pageBlock>
    </apex:form>
</apex:page>

-> ERROR ON PAGE

unexpected token: ORDER 
An unexpected error has occurred. Your development organization has been notified.

-> EMAIL WITH ERROR THAT IS SENT WHEN I VIEW THE PAGE

Visualforce Page: /apex/CudaControllerPage

caused by: System.QueryException: unexpected token: ORDER

Class.CudaController.getLeads: line 4, column 1
             
From the "Using Standard List Controllers" example, I tried following the code.  I see the filter option but I don't see "records per page" or previous/next.  Can someone help?  Image and code below.  Thanks, Aron.

User-added image

<apex:page standardController="Contact" recordSetVar="contacts">
        <apex:form >
     
            <apex:pageBlock title="Contacts List" id="contacts_list">
             
                Filter:
                <apex:selectList value="{! filterId }" size="1">
                    <apex:selectOptions value="{! listViewOptions }"/>
                    <apex:actionSupport event="onchange" reRender="contacts_list"/>
                </apex:selectList>
     
                <!-- Contacts List -->
                <apex:pageBlockTable value="{! contacts }" var="ct">
<!-- Pagination -->
    <table style="width: 100%"><tr>
     
        <td>
Page: <apex:outputText value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/>
        </td>           
     
        <td align="center">
<!-- Previous page -->
    <!-- active -->
    <apex:commandLink action="{! Previous }" value="« Previous"
         rendered="{! HasPrevious }"/>
    <!-- inactive (no earlier pages) -->
    <apex:outputText style="color: #ccc;" value="« Previous"
         rendered="{! NOT(HasPrevious) }"/>
     
    &nbsp;&nbsp; 
     
    <!-- Next page -->
    <!-- active -->
    <apex:commandLink action="{! Next }" value="Next »"
         rendered="{! HasNext }"/>
    <!-- inactive (no more pages) -->
    <apex:outputText style="color: #ccc;" value="Next »"
         rendered="{! NOT(HasNext) }"/>
        </td>
         
        <td align="right">
    Records per page:
    <apex:selectList value="{! PageSize }" size="1">
        <apex:selectOption itemValue="5" itemLabel="5"/>
        <apex:selectOption itemValue="20" itemLabel="20"/>
        <apex:actionSupport event="onchange" reRender="contacts_list"/>
    </apex:selectList>
        </td>
     
    </tr></table>
                    <apex:column value="{! ct.FirstName }"/>
                    <apex:column value="{! ct.LastName }"/>
                    <apex:column value="{! ct.Email }"/>
                    <apex:column value="{! ct.Account.Name }"/>
                </apex:pageBlockTable>
                 
            </apex:pageBlock>
     
        </apex:form>
    </apex:page>
I am having problems adding an image as a background to a VF page.  I only know the basics of HTML and I have been searching for a way to do so with no luck.  I tried following the steps on this page but nothing seemed to happen when I followed the steps and added this code.

https://success.salesforce.com/answers?id=90630000000grroAAA
<apex:stylesheet value="{!URLFOR($Resource.imageStyle, 'customCss.css')}"/>

I want to use the blue background image from this website, and I believe its a simple image that repeats if it helps.  Thanks.
http://www.acmeunited.com/

Thanks.
Error says Challenge not yet complete... here's what's wrong: 
You do not have the correct account fields in the 'New Detailed Account' publisher action

Trailhead Challenge says
Add the Account Name, Type, Rating and Fax fields to the compact layout.

What am I doing wrong?

User-added image
Thanks!
Aron
I completed the example and the challenge but it doesn't seem to be working 100% or I am missing something.

For the Example, if I create a tab for it is says

java.lang.reflect.InvocationTargetException
Error is in expression '{!componentBody}' in component <apex:page> in component interview.apexc
when I go to the tab.

For the Challenge, if I create a tab and enter this information
First Name John
Last Name Smith
Company Name Misc Co
Opportunity Amount 100
Opportunity Stage Prospecting

It says
An unhandled fault has occurred in this flow
An unhandled fault has occurred while processing the flow. Please contact your system administrator for more information.

Thanks.
Error says Challenge not yet complete... here's what's wrong: 
You do not have the correct account fields in the 'New Detailed Account' publisher action

Trailhead Challenge says
Add the Account Name, Type, Rating and Fax fields to the compact layout.

What am I doing wrong?

User-added image
Thanks!
Aron
I've been working on this trail for a bit - and while I undertsand the concepts, I'm stumped on why I'm getting this error: 
 
Challenge Not yet complete... here's what's wrong: 
A Create a Record action for the Closed Won criteria node isn't properly configured. Make sure that it creates a draft contract according to the instructions in the ‘Create contract for closed opportunity’ task action. Make sure that Start Date is set by using a formula.

I've gone over all of the workflow tasks information to recreate the contact. If I activate the process and close an opportunity, it creates a contract with the expected information and the date is 1mo away with 12mo term. The workflow's task (which is the template for the actual contract) specifies the following: 
 
Use the closed opportunity to create a contract for the associated account. 

Account: The account associated with this opportunity
Status: Draft
Contract Start Date: 1 month from today
Contract Term: 12
Here are my actions: 
User-added image

The Contract Start Date is set to the following formula:
DATE(
    YEAR(Today()) +
    FLOOR((1 + MONTH(Today())) / 12) -
    IF (MOD(MONTH(Today()) + 1, 12) = 0,
        1,
        0),

    MOD((1 + MONTH(Today()) - 1), 12) + 1,

    DAY(Today())
)

Again, for all practical purposes I'm passing this, as it functions and the contract is created. But I must be missing some small detail, named field, something that's tripping up the validation settings. Any help is appreciated!

 
Hi, I am trying to create a Visual Force email template that would display recently shipped items and tracking.

From the App Exchange, I downloaded "Product Line Items in Email Templates."

Its semi helpful, but it includes Opportunity and Products which seems to be a related or maybe lookup relationship.

In our system, the related Objects are a Master Detail Relationship.
Accounts -> Sales Orders -> Sales Order Lines

I am trying to do two unique things.

1. In terms of who gets emailed, instead of a Contact, is it possible to send an email to an address in an email field on the Sales Order Record, and if that is blank/null, send it to an address an on the Account object?

2. The Sales Order Lines will likely include Products and tracking. (I might need to make additional tweaks)
To display Products, I'd like to show Sales Order Lines where Line Status equals Shipped today.
To display tracking, I'd like to show Sales Order Lines where Description starts with TRPK.  (In our system, tracking lines display as TRPK 1Z11205, someting along those lines.)

If anyone can provide guidance to get me going, that would be appreciated.

Thanks,

Aron

Hi,

I get that error when I try to save this code.

trigger ExampleTrigger2 on Contact (after insert, after delete) {
    if (Trigger.isInsert) {
        Integer recordCount = Trigger.New.size();
        // Call a utility method from another class
        EmailManager.sendMail('aschor@acmeunited.com', 'Trailhead Trigger Tutorial', 
                    recordCount + ' contact(s) were inserted.');
    }
    else if (Trigger.isDelete) {
        // Process after delete
    }
}

thanks,
 

Aron

I am not sure if my subject is clear, but hopefully this helps.

I am working on a Site with a Product search feature for different divisions (division__C)

I want each division search page to only search for products of that division.

I have a search feature working, just need help tweaking it.  I have tried some things on my own with no luck, so I am hoping I can get some help.

1. If I change the class to say
WHERE Division__C = Office/School AND Area__C...

it says Authorization Required on search (Guest has field access)
I have a search feature working, just need help tweaking it.

2. If I change class to say
...OR Case_Quantity__c like \'%'+searchstring+'%\' AND Division__c like \'%'+Office/School+'%\''

it says Error    Error: Compile Error: Variable does not exist: Office at line 15 column 521

_____________

Working code:

public with sharing class prodsearchschool {

    private String sortOrder = 'Name';
    public list <Product2> Prod {get;set;} 
    public String searchstring {get;set;}
    public String searchquery {get;set;}
    public String sortField {get;set;}
    public String lastClicked {get;set;}
    public String sortDir {get;set;}

    public prodsearchschool() {}
     
         
    public PageReference search(){
        searchquery='select Area__C, ProductCode, Name, Color__C, Overall_Length__C, H__C, W__C, L__C, Case_Quantity__c from Product2 WHERE Area__C like \'%'+searchstring+'%\' OR ProductCode like \'%'+searchstring+'%\' OR Name like \'%'+searchstring+'%\' OR Color__C like \'%'+searchstring+'%\' OR Overall_Length__C like \'%'+searchstring+'%\' OR H__C like \'%'+searchstring+'%\' OR L__C like \'%'+searchstring+'%\' OR W__C like \'%'+searchstring+'%\' OR Case_Quantity__c like \'%'+searchstring+'%\'';  
        Prod = database.query(searchquery);
        return null;
    } 

    public void clear(){ 
        prod.clear(); 
    }

    public PageReference sortThis() {  
        if(lastClicked == null){
            sortDir = 'ASC';
        }
        else{
            if(lastClicked == sortField){
                sortDir = 'DESC';
            }
            else{
                sortDir = 'ASC';
            }
        }
        lastClicked = sortField;
       prod = Database.query(searchquery + ' order by ' + sortField + ' ' + sortDir);
       return null;
    } 
}

Hello,

        I am a novice in writing SOQL statements concerning Master Detail relationships. I would like to know how I need to write a SELECT SOQL statement on these:

Master object: Opportunity
Detail object: Quote
Child Relationship Name: Quotes
Field Name: Opportunity

Basically, I want to extract the Id from Opportunity and add it to the other fields of the Quote object in a single SELECT SOQL statement. How do I proceed? 

Regards, 
Vijay.

I am having problems creating this Apex class, a little confused as I have done them before.

Error: Compile Error: Illegal assignment from List<SObject> to List<User> at line 4 column 1

public class LastLogin {
    private String sortOrder = 'LastLoginDate';
public List<User> getUsers() {
List<User> results = Database.query(
        'SELECT FirstName, LastName, Username, MobilePhone, IsActive, LastLoginDate FROM User ' +
        'ORDER BY ' + sortOrder + ' DESC'
        );
    return results;
}
}

Thanks.
I have been able to get similar ones to work (based on prior challenges) but I am struggling here.  Probably a newbie mistake somewhere.  Any help would be appreciated!  Thanks, Aron

-> Page (Gives Error: Unknown property 'String.Id error)

<apex:page controller="NewCaseListController">
    <apex:form >
        <apex:pageBlock title="Case List" id="Case_list">
            <!-- Case_list -->
         <apex:repeat value="{!Case}" var="case">
            <apex:outputLink value="{!Case.Id}">{!Case.Id}</apex:outputLink>
            <apex:outputLink value="{!case.CaseNumber}">{!case.CaseNumber}</apex:outputLink>
        </apex:repeat>      
        </apex:pageBlock>
    </apex:form>
</apex:page>

-> Class

ublic class NewCaseListController {

    public String getCase() {
        return null;
    }


    public String getCases() {
        return null;
    }

private String sortOrder = 'CaseNumber';
public List<Case> getNewCases() {
    List<Case> results = Database.query(
        'SELECT Id, CaseNumber ' +
        'FROM Case ' +
        'WHERE Status = New ' +
        'ORDER BY ' + sortOrder + ' ASC ' +
    );
    return results;
    }
}
I am having problems adding an image as a background to a VF page.  I only know the basics of HTML and I have been searching for a way to do so with no luck.  I tried following the steps on this page but nothing seemed to happen when I followed the steps and added this code.

https://success.salesforce.com/answers?id=90630000000grroAAA
<apex:stylesheet value="{!URLFOR($Resource.imageStyle, 'customCss.css')}"/>

I want to use the blue background image from this website, and I believe its a simple image that repeats if it helps.  Thanks.
http://www.acmeunited.com/

Thanks.