• Goku Zeus
  • NEWBIE
  • -5 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 44
    Replies
Hi,

I have a new package and I want to give a discount to an early adopter.  I see the coupon code field in the checkout process but I can't figure out where to manage coupon codes in the partners site.

What am I missing?

Thanks,

Steve 
Hi Everyone,

I'm trying to gain visibility, in Pardot, into external clicks made on a B2B Commerce storefront site. The B2B Commerce features more than 10,000 products and we need to track various clicks (Document Downloads, Request for Quote, etc.) making it unrealistic to create individual custom redirect links for each product.

I'm using Google Tag Manager to target these clicks by their HTML classes and have been able to successfully fire Pardot Campaign Tracking Code on these events. However, these clicks simply appear as another redundant pageview in Pardot since the window's URL doesn't change. 

I found this article explaining exactly what I want to do (https://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAA/Help/EloquaAsynchronousTrackingScripts/Tasks/TrackingCustomURLs.htm), but it is specific to Oracle.

Can anyone help me understand how to do this in Pardot tracking code? I would specific a custom URL name (ex. mywebsite.com/request-for-quote) that would distinguish the click as being unique from the parent pageview.

This is example tracking code for reference:

<script type="text/javascript">
piAId = '191792';
piCId = '20357';
piHostname = 'pi.pardot.com';

(function() {
    function async_load(){
        var s = document.createElement('script'); s.type = 'text/javascript';
        s.src = ('https:' == document.location.protocol ? 'https://pi' : 'http://cdn') + '.pardot.com/pd.js';
        var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
    }
    if(window.attachEvent) { window.attachEvent('onload', async_load); }
    else { window.addEventListener('load', async_load, false); }
})();
</script>


Any help would be greatly appreciated! 
I AM trying to just take my web to lead form and make it a component on a home page. 

I think I am close but keep getting errors. 
Latest Errors are : 
Error: New_Lead_Submit2 line 107, column 3: The element type "br" must be terminated by the matching end-tag "</br>"
Error: The element type "br" must be terminated by the matching end-tag "</br>".



Code so far... 
apex:page>
  <!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
<!--  If necessary, please modify the charset parameter to specify the        -->
<!--  character set of your HTML page.                                        -->
<!--  ----------------------------------------------------------------------  -->

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->

<form action="https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

<input type="hidden" name="oid" value="00DP00000003qyC"/>
<input type="hidden" name="retURL" value="http://"/>

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail"                                  -->
<!--  value="wendy.tanner@rollick.io">                                        -->
<!--  ----------------------------------------------------------------------  -->

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>

<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>

Mobile Phone:<input  id="00NP0000003FU6P" maxlength="40" name="00NP0000003FU6P" onkeydown="formatPhoneOnEnter(this, event);" size="20" type="text" /><br>

<label for="phone">Phone</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>

<label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br>

Trade In?:<select  id="00NP0000003FUzf" name="00NP0000003FUzf" title="Trade In?"><option value="">--None--</option><option value="Yes">Yes</option>
<option value="No">No</option>
</select><br>

Vehicle Year:<select  id="00NP0000003FM3U" name="00NP0000003FM3U" title="Vehicle Year"><option value="">--None--</option><option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
</select><br>

Vehicle Make:<select  id="00NP0000003FM3Z" name="00NP0000003FM3Z" title="Vehicle Make"><option value="">--None--</option><option value="Acura">Acura</option>
<option value="Alfa Romeo">Alfa Romeo</option>
<option value="Aston Martin">Aston Martin</option>
<option value="Audi">Audi</option>
<option value="Bentley">Bentley</option>
<option value="BMW">BMW</option>
<option value="Bugati">Bugati</option>
<option value="Buick">Buick</option>
<option value="Cadillac">Cadillac</option>
<option value="Chevrolet">Chevrolet</option>
<option value="Chrysler">Chrysler</option>
<option value="Dodge">Dodge</option>
<option value="Ferrari">Ferrari</option>
<option value="Fiat">Fiat</option>
<option value="Ford">Ford</option>
<option value="General Motors">General Motors</option>
<option value="GMC">GMC</option>
<option value="Honda">Honda</option>
<option value="Hyundai">Hyundai</option>
<option value="Infiniti">Infiniti</option>
<option value="Jaguar">Jaguar</option>
<option value="Jeep">Jeep</option>
<option value="Kia">Kia</option>
<option value="Lamborghini">Lamborghini</option>
<option value="Land Rover">Land Rover</option>
<option value="Lexus">Lexus</option>
<option value="Maserati">Maserati</option>
<option value="Mazda">Mazda</option>
<option value="McClaren">McClaren</option>
<option value="Mercedes-Benz">Mercedes-Benz</option>
<option value="Mini">Mini</option>
<option value="Porsche">Porsche</option>
<option value="Ram">Ram</option>
<option value="Subaru">Subaru</option>
<option value="Suzuki">Suzuki</option>
<option value="Tesla">Tesla</option>
<option value="Toyota">Toyota</option>
<option value="Volkswagen">Volkswagen</option>
<option value="Volvo">Volvo</option>
</select><br>

Vehicle Model:<input  id="00NP0000003FM3e" maxlength="255" name="00NP0000003FM3e" size="20" type="text" /><br>

Time to Purchase:<select  id="00NP0000003FM3y" name="00NP0000003FM3y" title="Time to Purchase"><option value="">--None--</option><option value="As soon as Possible">As soon as Possible</option>
<option value="1 to 3 months">1 to 3 months</option>
<option value="3_to_6_months">3 to 6 Months</option>
<option value="9 to 12 Months">9 to 12 Months</option>
<option value="Not Sure">Not Sure</option>
</select><br>

<label for="zip">Zip</label><input  id="zip" maxlength="20" name="zip" size="20" type="text" /><br>

Create Opportunity:<input  id="00NP0000003FTk8" name="00NP0000003FTk8" type="checkbox" value="1" /><br>

<input type="submit" name="submit"/>

</form>

</apex:page>
I am struggling with this challenge and have been for quite some time. I am not sure what I am missing so any help would be appreciated. 

I am getting the following error:

Challenge Not yet complete... here's what's wrong: 
We can't find the 'Create Seed Bank' node or required fields, such as 'TempClass', are missing. Check the challenge and confirm the node name and required fields.

Here is my JSON:

{
  "Add Temp Class": {
    "action": "computeExpression",
    "parameters": {
      "source": "Define Temp Range",
      "mergeWithSource": true,
      "computedFields": [
        {
          "defaultValue": "Continental",
          "name": "TempClass",
          "saqlExpression": "case \nwhen LowTemp < 25 and HighTemp < 25 then \"Polar\" \nwhen LowTemp >= 25 and LowTemp <= 50 and HighTemp >= 25 and HighTemp <= 50 then \"Cool\"\nwhen LowTemp >= 51 and LowTemp <= 85 and HighTemp >= 51 and HighTemp <= 85 then \"Continental\"\nwhen LowTemp > 85 and HighTemp > 85 then \"Tropical\"\nwhen LowTemp < 25 and (HighTemp >= 25 and HighTemp <= 50) then \"Polar-Cool\" \nwhen LowTemp < 25 and (HighTemp >= 25 and HighTemp <= 85) then \"Polar-Cool-Continental\" \nwhen LowTemp < 25 and HighTemp > 85 then \"Polar-Cool-Continental-Tropical\" \nwhen (LowTemp >= 25 and LowTemp <= 50) and (HighTemp >= 51 and HighTemp <= 85) then \"Cool-Continental\" \nwhen (LowTemp >= 25 and LowTemp <= 50) and HighTemp >= 85 then \"Cool-Continental-Tropical\" \nwhen (LowTemp >= 51 and LowTemp <= 85) and HighTemp > 85 then \"Continental-Tropical\" \nend",
          "label": "TempClass",
          "type": "Text"
        }
      ]
    }
  },
  "Calculate Acreage": {
    "action": "computeExpression",
    "parameters": {
      "source": "Load Seed Chart",
      "mergeWithSource": true,
      "computedFields": [
        {
          "precision": 18,
          "name": "Acreage",
          "saqlExpression": "(Seeds_Pound*Spacing)/6272640",
          "scale": 6,
          "label": "Acreage",
          "type": "Numeric"
        }
      ]
    }
  },
  "Create Seed Bank": {
    "action": "sfdcRegister",
    "parameters": {
      "name": "Seed Bank",
      "alias": "seed_bank",
      "source": "CleanUp"
    }
  },
  "Load Seed Chart": {
    "action": "edgemart",
    "parameters": {
      "alias": "Seed_Chart"
    }
  },
  "Augment Temp Class": {
    "action": "augment",
    "parameters": {
      "left": "Add Temp Class",
      "right": "Load Temp Class Mapping",
      "relationship": "Climate",
      "operation": "LookupMultiValue",
      "left_key": [
        "TempClass"
      ],
      "right_key": [
        "TempKey"
      ],
      "right_select": [
        "TempKey"
      ]
    }
  },
  "Load Temp Class Mapping": {
    "action": "edgemart",
    "parameters": {
      "alias": "Temperature_Classes_Mapping"
    }
  },
  "CleanUp": {
    "action": "sliceDataset",
    "parameters": {
      "mode": "drop",
      "source": "Augment Temp Class",
      "fields": [
        {
          "name": "LowTemp"
        },
        {
          "name": "HighTemp"
        }
      ]
    }
  },
  "Define Temp Range": {
    "action": "computeExpression",
    "parameters": {
      "source": "Calculate Acreage",
      "mergeWithSource": true,
      "computedFields": [
        {
          "defaultValue": "0",
          "precision": 18,
          "name": "LowTemp",
          "saqlExpression": "string_to_number(substr(Temperature,1,2))",
          "scale": 2,
          "label": "LowTemp",
          "type": "Numeric"
        },
        {
          "defaultValue": "0",
          "precision": 18,
          "name": "HighTemp",
          "saqlExpression": "string_to_number(substr(Temperature,3,3))",
          "scale": 2,
          "label": "HighTemp",
          "type": "Numeric"
        }
      ]
    }
  }
}

Thanks in advance
Hello I am stuck on challenge #3 
please any one can guide me what step to fallow for this challenge.

For several months I've been using the instructions in this blog post to use Workbench to backup the metadata in my org. Last month, the process stopped working. I assumed it was a one-off oddity and didn't think much of it, but I'm seeing the same errors again this month. Generating the XML "package" containing the metadata I want to export works fine and the process appears to succeed. However when I go to click the download link in Workbench I am told the .zip archive no longer exists. I've uploaded screenshots to show that the ZIP file is generated and the error message displayed when I click the download button. 

I have no idea what I'm doing wrong, and don't believe I've changed anything compared to what I was doing previously, when the backup worked. 

What I see before I click "download"

Error Message

I know there are alternative methods for doing this, such as those discussed here https://developer.salesforce.com/forums/?id=906F0000000BIYzIAO but I am interested in understanding why the method I've been using ceased to work. 

Hi.  I have created a flow that shows a number of orders that a person is making.  The first thing the flow does is assign the flow {!$Flow.CurrentDateTime} to a variable called NowVariable.  The next screen the user enters the order.  The final screen the user sees a lightning component table that shows the orders the person made (passing in the contact and NowVariable).  The lightning component controller is an apex class:

     @AuraEnabled
  public static List<ice_Cream_Order__c> getIceCreamOrdersByContactTime(Id contactId, DateTime createdWhen){

      return [  select Id, How_Many__c , Ice_Cream_Flavor__r.Name, Contact__c  ,  Contact__r.Name
                FROM ice_Cream_Order__c 
                 where Contact__c = :contactId AND createdDate >= :createdWhen];
  }  

At issue:  The table shows no data.  I assume it is an issue of the Flow DateTime value of 2018-06-18T15:42:53.986Z does not correspond to the apex sql.    

Would anyone have any suggestions on how to pass the dateTime variable to the apex method?

Thanks,
stuart
Hello all,

I am just getting my feet wet with Apex development. I do have a page built, but am finding some of my H3 and P tag content is duplicating, while others are not: http://giveanhour.force.com/VolunteersRegPage

Here is a bit of the code:
<apex:page controller="GW_Volunteers.VOL_CTRL_VolunteersSignupFS" language="{!strLanguage}" showheader="false" sidebar="false" standardStylesheets="false" cache="false">

    <apex:stylesheet value="{!strURLtoCSSFile}" /> 

    <apex:form id="frm" styleClass="cssForm" >  
        <table columns="2" >
            <!-- first we specify the fields we require for Contact matching -->
            <tr>
            <p>Please complete this application form if you are interested in becoming a Give an Hour volunteer. Once you complete the form, click the submit button at the bottom. (NOTE: Please use personal emails. Do not use .gov or .mil email addresses because many times our communication will not reach your inbox. Thank you.)</p> 
<p>*PLEASE NOTE: If you are a licensed mental health professional carrying malpractice insurance, you will want to visit the Give an Hour Provider page, which has information about serving as a provider in the Give an Hour network. http://www.giveanhour.org/ForProviders.aspx*</p>
            </tr>
            <tr>
            <h3>Name and Address</h3>
                <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.FirstName.Label + '*'}" for="txtFirstName" /></td>
                <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.FirstName}" id="txtFirstName" required="true" styleClass="cssInputFields" /></td>
            </tr>
            <tr>    
                <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.LastName.Label + '*'}" for="txtLastName" /></td>
                <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.LastName}" id="txtLastName" required="true" styleClass="cssInputFields" /></td>
            </tr>
            <tr>            
                <td class="cssLabelsColumn" ><apex:outputLabel value="{!$ObjectType.Contact.Fields.Email.Label + '*'}" for="txtEmail" /></td>
                <td class="cssInputFieldsColumn" ><apex:inputField value="{!contact.Email}" id="txtEmail" required="true" styleClass="cssInputFields" /></td>
            </tr>
            
            <!--  now add optional fields the user can specify -->
            <apex:repeat value="{!$ObjectType.Contact.FieldSets.GW_Volunteers__VolunteersSignupFS}" var="f" >
                <tr>
                    <td class="cssLabelsColumn" ><apex:outputLabel value="{!f.Label + IF(OR(f.DBRequired, f.Required), '*', '')}" /></td>
                    <td class="cssInputFieldsColumn" ><apex:inputField value="{!Contact[f]}" required="{!IF(OR(f.DBRequired, f.Required), 'true', 'false')}"
                        styleClass="{!IF(f.Type == 'Long Text Area', 'cssInputFields cssTextArea', 'cssInputFields')}" /></td>
                </tr>
            </apex:repeat>
            <apex:pageBlock >
            <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            <apex:repeat value="{!$ObjectType.Contact.FieldSets.VolunteerDemographic}" var="f" >
                <tr>
                <h3>Demographic Information</h3>
                <p>Please provide the following information. It is used only to help us get a better idea of the demographic make-up of our volunteers.</p>
                    <td class="cssLabelsColumn" ><apex:outputLabel value="{!f.Label + IF(OR(f.DBRequired, f.Required), '*', '')}" /></td>
                    <td class="cssInputFieldsColumn" ><apex:inputField value="{!Contact[f]}" required="{!IF(OR(f.DBRequired, f.Required), 'true', 'false')}"
                        styleClass="{!IF(f.Type == 'Long Text Area', 'cssInputFields cssTextArea', 'cssInputFields')}" /></td>
                </tr>
            </apex:repeat>
            </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            <apex:repeat value="{!$ObjectType.Contact.FieldSets.VolunteerAvailability}" var="f" >
                <tr>
                <h3>Availability</h3>
                <p>Please indicate the days and times you are usually available to volunteer.</p>
                    <td class="cssLabelsColumn" ><apex:outputLabel value="{!f.Label + IF(OR(f.DBRequired, f.Required), '*', '')}" /></td>
                    <td class="cssInputFieldsColumn" ><apex:inputField value="{!Contact[f]}" required="{!IF(OR(f.DBRequired, f.Required), 'true', 'false')}"
                        styleClass="{!IF(f.Type == 'Long Text Area', 'cssInputFields cssTextArea', 'cssInputFields')}" /></td>
                </tr>
            </apex:repeat>
            </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            <apex:repeat value="{!$ObjectType.Contact.FieldSets.VolunteerEmergencyContact}" var="f" >
                <tr>
                <h3>Emergency Contact</h3>
                <p>We keep this information confidential and is ONLY used if you are volunteering for Give an Hour at an event and there is an emergency.</p>
                    <td class="cssLabelsColumn" ><apex:outputLabel value="{!f.Label + IF(OR(f.DBRequired, f.Required), '*', '')}" /></td>
                    <td class="cssInputFieldsColumn" ><apex:inputField value="{!Contact[f]}" required="{!IF(OR(f.DBRequired, f.Required), 'true', 'false')}"
                        styleClass="{!IF(f.Type == 'Long Text Area', 'cssInputFields cssTextArea', 'cssInputFields')}" /></td>
                </tr>
            </apex:repeat>
            </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            <apex:repeat value="{!$ObjectType.Contact.FieldSets.VolunteerHowHeaer}" var="f" >
                <tr>
                <h3>How did you hear about Give an Hour?</h3>
                    <td class="cssLabelsColumn" ><apex:outputLabel value="{!f.Label + IF(OR(f.DBRequired, f.Required), '*', '')}" /></td>
                    <td class="cssInputFieldsColumn" ><apex:inputField value="{!Contact[f]}" required="{!IF(OR(f.DBRequired, f.Required), 'true', 'false')}"
                        styleClass="{!IF(f.Type == 'Long Text Area', 'cssInputFields cssTextArea', 'cssInputFields')}" /></td>
                </tr>
            </apex:repeat>
            </apex:pageBlockSectionItem>
            </apex:pageBlockSection>

            <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
            <apex:repeat value="{!$ObjectType.Contact.FieldSets.VolunteerPolicies}" var="f" >
                <tr>
                <h3>Volunteer Policies</h3>
                                <p>As a Give an Hour Volunteer, I agree to serve and commit to the following:
<ul>
<li>To perform my volunteer duties to the best of my ability.</li>

<li>To adhere to Give an Hour policy and procedures, including confidentiality of Give an Hour information. In particular, I affirm that all information I learn about Give an Hour is deemed to be strictly confidential. I shall not disclose any confidential information about Give an Hour, its staff, and its volunteers to an individual, organization, or media.</li>

<li>I understand that as a volunteer, I will not receive an monetary payment for my services.</li>

<li>I understand that I must keep a valid, personal email on file (no .mil or .gov emails) and that if I opt out of receiving emails from Give an Hour that I will be removed from the Give an Hour volunteer database.</li>

<li>I understand from time to time photographs will be taken and as a volunteer I understand they will be used on the Web site and for media use.</li>

<li>Continued volunteer service is contingent upon fulfillment of volunteer responsibilities, maintaining professional conduct, and acceptable performance.</li>

<li>Volunteers may be dismissed for good cause or for failure to perform.</li> 
</ul>

Give an Hour(TM) is a 501(c)3 non-profit organization.</p>
                    <td class="cssLabelsColumn" ><apex:outputLabel value="{!f.Label + IF(OR(f.DBRequired, f.Required), '*', '')}" /></td>
                    <td class="cssInputFieldsColumn" ><apex:inputField value="{!Contact[f]}" required="{!IF(OR(f.DBRequired, f.Required), 'true', 'false')}"
                        styleClass="{!IF(f.Type == 'Long Text Area', 'cssInputFields cssTextArea', 'cssInputFields')}" /></td>
                </tr>
            </apex:repeat>
            </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            </apex:pageBlock>

Thanks in advance for your help!
Hi, I'd like to include a coupon code with my automated emails and I'm not sure how to set that up. Any help would be greatly appreciated! 

Thank you!
Are you suffering from the issues of damaged or inaccessible .mdb or .accdb database files? In order to fix these issues, Access File Recovery is compatible software that successfully repairs and recovers both ACCDB and MDB files without data loss. This software is very intelligible recovery utility for repairing corrupt or inaccessible MS Access ACCDB or MDB data files and helps in restoration of all the objects.
Find more details here:- http://www.accessrecoverytool.org/
An unexpected error has occurred. 691196293-2511 (528326319) for deploymentId=1dr24000000P28FAAS If this persists, please contact customer support.

Above message i am getting while saving code in lighting component's controller...
Hi,

I am running below code from sandbox execute anonymous window. I am not getting any mail after execution.
Account a = new Account(name='Acme Plumbing');

insert a;

Contact c = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber', accountid=a.id);

insert c;

Database.DMLOptions dlo = new Database.DMLOptions();

dlo.EmailHeader.triggerAutoResponseEmail = true;

Case ca = new Case(subject='Plumbing Problems', contactid=c.id);

database.insert(ca, dlo);
This is exmaple from Salesforce documentation. Do I have to any setting? Could I request a help?

Thanks,


Hi,

 

I do have a doubt regarding Salesforce.com.

 

Can we develope Games in the Salesforce.com platform?

  • August 07, 2013
  • Like
  • 0

my code is :

trigger createUser on Student__c (after insert) {
Profile p = [select id from Profile where name='Standard Platform'];
for(Student__c stud: Trigger.new)
{
User u = new User(alias = 'student', email=stud.Email_ID__c, emailencodingkey='UTF-8', firstName=stud.First_Name__c, lastname=stud.Last_Name__c, languagelocalekey='en_US', localesidkey='en_US', profileid = p.id, timezonesidkey='Europe/London', username=stud.Enrollment_No__c+'@user.com');
insert u;
stud.User__c=u.ID;
}
}

 

whenever i am creating student record it should create user and associate user with student

but its i s giving an error..

  • February 08, 2013
  • Like
  • 0

I'm a quick learner. I'd just like help this one time, and I'll pick up on the material pretty quickly.

 

Here's the business logic, I'd like:

 

  1. Check whether a date on a field on the Inventory Object is equal to or greater than today().
  2. If its equal to or greater than today(), create a record in an unrelated custom object (Tasks Object), and insert a whole bunch of pre-populated fields
  3. Upon creation of this new record in the Tasks Object, if I set the status field to "Done", I'd like another trigger to first increment a number field in the Inventory Object.
  4. Delete the Tasks Object that was created, after the increment to the Inventory Object is completed.

If you could help, that'd be great.

Currently I have a visualforce page that takes a Date as user input and returns a table of records. Each column of the table represents a list of Shifts, the first list being the list of shifts that occurs on the date the user input - and then each column after incrementing that date by one.

 

Here's a quick visual of what I described without the actual records showing (confidential information):

 

 

Below each day, the records are output in an HTML Table. Each day is currently a seperate query that looks like this:

 

 

    public List<Shift__c> getTheList2() {
        Date NewDate = IncrementDayDate(1);
        If (Positions == 'Tech'){
            List<Shift__c> TheList2 = [SELECT Shift_Cancelled__c, Notes__c, ID, BGCOLOR__c, Shift_Summary__c, Shift_Summary_2__c, Shift_Summary_3__c, Day_of_week__c, Date__c FROM Shift__c WHERE Date__c = :NewDate AND (Position__C = 'Tech' OR Position__C = 'Pharmacy Support' OR Position__C = 'Material Handler')  ORDER BY Shift_Summary__c, Shift_Summary_2__c];
            return TheList2;
        } else {
            List<Shift__c> TheList2 = [SELECT Shift_Cancelled__c, Notes__c, ID, BGCOLOR__c, Shift_Summary__c, Shift_Summary_2__c, Shift_Summary_3__c, Day_of_week__c, Date__c FROM Shift__c WHERE Date__c = :NewDate AND Position__C = 'RPh'  ORDER BY Shift_Summary__c, Shift_Summary_2__c];
            return TheList2;
        }
    }

 

 

This ends up meaning 7 queries to the server for the lists, although the only difference in the filter is the Date. Ideally I'd only pull this list once and then seperate out each of the 7 days. Any ideas on how to do this?

 

Can you build a list, from a list? If Master_List exists as a List of all of the records for each day, could I pull each individual list from it like this? I want to avoid making 7 calls to the server to improve performance and code efficiency.

 

 

            List<Shift__c> TheList2 = [SELECT Shift_Cancelled__c, Notes__c, ID, BGCOLOR__c, Shift_Summary__c, Shift_Summary_2__c, Shift_Summary_3__c, Day_of_week__c, Date__c FROM :Master_List WHERE Date__c = :NewDate AND Position__C = 'RPh'  ORDER BY Shift_Summary__c, Shift_Summary_2__c];
return TheList2;
}
}

 It would be even better if I could pull the Master List, and use something in my Visualforce code to spit out each day. The shorter my Apex code becomes - the easier future modification comes. I'm getting close to reaching governor limits on this page due to other queries, so I wanted to find room to improve the code.

 

Thanks for your help!

 

In Sweden and some other parts of Europe the week numbering is often using the ISO 8601 standard that says that the first week of the year is the first week with at least 4 days in the new year. Some consequences of this is that the final dates of one year can be week 52, 53 or even week 1( in the following year). The same goes for the first dates of a year.

 

To be able to do weekly comparison report Year-to-Year with this weeknumbering it is necessary to create custom fields for the opportunity that calculates the Year and Week number for a given close date. Here is one solution using three custom formula fields.

 

Field: Global Sales Report Weekday

Description:  Day 1 = Sunday, 2 = Monday....., 7=Saturday

Formula:  MOD( CloseDate  - DATE(1900, 1, 7), 7)+1

 

Field: Global Sales Report Week Year

Formula: YEAR(CloseDate + (MOD(8- Global_Sales_Report_Weekday__c ,7)-3))

 

Field: Global Sales Report Week

Formula:

FLOOR((CloseDate - DATE( Global_Sales_Report_Week_Year__c ,1,1) +
MOD(
(MOD( DATE(Global_Sales_Report_Week_Year__c,1,1) - DATE(1900, 1, 7), 7)+1)
+1,7)-3) / 7 + 1)

 

Hope this can be of use for anyone else

 

Peter Baeza

InfoAction AB, Sweden

 

  • March 15, 2010
  • Like
  • 3

Hello Salesforce community,

 

I have a general question concerning the development of Salesforce customisations.

 

Our Salesforce setup has different custom objects. Very often the user wishes to display some data from object "A" on a layout of object "B". In the simple cases, we could achieve this using formula fields that just reference to the content of directly related objects, via "mergefields" functionality. There are, however, cases where the data is not directly related, or the relationsship is so complex that mergefields don't offer "paths" to the desired data.

 

We tried to work around this by building triggers that copy some of the data between objects, but this led to  lots of overhead and data redundancy what is just wrong from a technical point of view, and also not feasible for long-term maintainability of the software.

 

What we basically would like to have is kind of a formula field on a layout but with real (apex) code behind to retrieve / calculate the field content).  What would be the "official" solution for a problem like this? Are there any examples? Would it also be possible to use such a "generated" field content in regular object validations, or forumulas of the object again, as if it was a normal field?

 

Any help / hints are highly appreciated!

 

 

 

 

 

Message Edited by mfe on 11-18-2009 12:44 AM
  • November 18, 2009
  • Like
  • 0
Hi Folks,
 
I'm working on a project which is considering trying to use SFDC purely as a database -- nobody cares about its CRM abilities, or user interface.
 
The intention is to use (as yet undetermined) generic forms engines and generic reporting tools as the front end to this SFDC database.
 
A casual look at DBAmp (as a Linked Server in SQL Server) suggests that it could be used to glue these front end tools to SFDC, but a closer reading of the documentation suggests that this will incur large performance issues as the database grows in size -- because of the way that SQL Server will first pull down the entire content of the table being queried or updated.
 
I recognise that the solution to this is to rewrite the query to use the SQL Server's 'OPENQUERY' syntax, but it seems (to me) highly unlikely that an off-the-shelf forms engine or reporting tool would be capable of generating SQL with this 'OPENQUERY' syntax.
 
Have you encountered this sort of use of SFDC before? Is there something that I'm missing?
 
If there isn't any obvious solution to the issue above, I guess our options are:
 
- Using DBAmp to replicate data down to SQL Server, and just using the 'generic' tools against SQL Server
- Finding SFDC / DBAmp 'aware' tools for the forms and reporting engines (any pointers?)
- Not use SFDC like this
 
Has anybody been down this path before? Any suggestions?
 
Thanks,
Kerry