• Jaap Scheper
  • NEWBIE
  • 43 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 22
    Replies
Hi there,
I am using a Lightning:Maps component to plot a series of markers. When we have a lot of markers, we see in the Javascript's console log window "mapsloader?resource=primitiveMap&version=220:151 Error: Geocoding <Address removed for privacy reasons> failed. Google geocoder status is OVER_QUERY_LIMIT"

I can reduce the amount of requests a little, but I don't expect it to be enough. Does anyone have had the same issue?
I think of this solutions:
  • Pay Google for less limitations -> Is that even possible, as lightning:map uses a Salesforce-owned Google Api key?
  • Reduce the amount of requests -> What exact are the limitations? I searched on Google Documentation, but didn't find hard numbers
  • Build a custom lightning map -> Anyone who did this before?
  • Use a solution from Github -> Any recommendations, anyone experience with https://github.com/zyzbroker/LightningMap ?
Any suggestions, answers, ideas are much appreciated!
Hi all,

I am trying to test a Schedulable class that invokes an @future(Callout=true) method called runWarehouseEquipmentSync.
After Test.StopTest() I check whether the Schedulable already has been triggered (I expect so). It has not been triggered yet.

Can you explain why the Schedulable class not have been triggered after Test.StopTest()?
How do I test the Schedulable class in a correct manner?
 
@IsTest
public with sharing class WarehouseSyncScheduleTest {
    public static String CRON_EXP = '0 0 0 15 3 ? 2022';

    @IsTest
    public static void testScheduledJob() {
        WarehouseCalloutServiceMock mock = new WarehouseCalloutServiceMock();
        Test.setMock(HttpCalloutMock.class, mock);

        // 1. Create data
        List<Product2> equipmentsBefore = [SELECT Id FROM Product2];
        System.AssertEquals(0, equipmentsBefore.size());

        // 2. Schedule a job and run it
        Test.StartTest();
            String jobId = System.Schedule('ScheduledApexTest',
                CRON_EXP,
                new WarehouseSyncSchedule());
            System.Debug('Scheduler JobId: ' + jobId);

            CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobId];
            System.assertEquals(CRON_EXP, ct.CronExpression);
            System.assertEquals(0, ct.TimesTriggered);
            System.assertEquals('2022-03-15 00:00:00', String.valueOf(ct.NextFireTime));
        Test.StopTest();

        ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobId];
        System.assertEquals(CRON_EXP, ct.CronExpression);
        System.assertEquals(1, ct.TimesTriggered); //Test fails here: ct.TimesTriggered is still 0!
        System.assertEquals('2022-03-15 00:00:00', String.valueOf(ct.NextFireTime));

        // 3. Get data and verify that it has changed due to the scheduler
        List<Product2> equipmentsAfter = [SELECT Id FROM Product2];
        System.AssertEquals(2, equipmentsAfter.size());
    }
}

This is the WarehouseSyncSchedule method:
global class WarehouseSyncSchedule implements Schedulable {
  global void execute(SchedulableContext sc) {
      System.Debug('I am here at WarehouseSyncSchedule!'); //I see this code in the output log: so far so good.
      WarehouseCalloutService.runWarehouseEquipmentSync();
  }
}
This is the runWarehouseEquipmentSync():
@future(Callout=true)
    public static void runWarehouseEquipmentSync(){
        //Implementation - removed for readability
        //I do not see any debug statement in the output/log window for this method
    }


 
Hi all,

I am trying to test a Schedulable class that invokes an @future(Callout=true) method called runWarehouseEquipmentSync.
After Test.StopTest() I check whether the Schedulable already has been triggered (I expect so). It has not been triggered yet.

Can you explain why the Schedulable class not have been triggered after Test.StopTest()?
How do I test the Schedulable class in a correct manner?
 
@IsTest
public with sharing class WarehouseSyncScheduleTest {
    public static String CRON_EXP = '0 0 0 15 3 ? 2022';

    @IsTest
    public static void testScheduledJob() {
        WarehouseCalloutServiceMock mock = new WarehouseCalloutServiceMock();
        Test.setMock(HttpCalloutMock.class, mock);

        // 1. Create data
        List<Product2> equipmentsBefore = [SELECT Id FROM Product2];
        System.AssertEquals(0, equipmentsBefore.size());

        // 2. Schedule a job and run it
        Test.StartTest();
            String jobId = System.Schedule('ScheduledApexTest',
                CRON_EXP,
                new WarehouseSyncSchedule());
            System.Debug('Scheduler JobId: ' + jobId);

            CronTrigger ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobId];
            System.assertEquals(CRON_EXP, ct.CronExpression);
            System.assertEquals(0, ct.TimesTriggered);
            System.assertEquals('2022-03-15 00:00:00', String.valueOf(ct.NextFireTime));
        Test.StopTest();

        ct = [SELECT Id, CronExpression, TimesTriggered, NextFireTime FROM CronTrigger WHERE Id = :jobId];
        System.assertEquals(CRON_EXP, ct.CronExpression);
        System.assertEquals(1, ct.TimesTriggered); //Test fails here: ct.TimesTriggered is still 0!
        System.assertEquals('2022-03-15 00:00:00', String.valueOf(ct.NextFireTime));

        // 3. Get data and verify that it has changed due to the scheduler
        List<Product2> equipmentsAfter = [SELECT Id FROM Product2];
        System.AssertEquals(2, equipmentsAfter.size());
    }
}

This is the WarehouseSyncSchedule method:
global class WarehouseSyncSchedule implements Schedulable {
  global void execute(SchedulableContext sc) {
      System.Debug('I am here at WarehouseSyncSchedule!'); //I see this code in the output log: so far so good.
      WarehouseCalloutService.runWarehouseEquipmentSync();
  }
}
This is the runWarehouseEquipmentSync():
@future(Callout=true)
    public static void runWarehouseEquipmentSync(){
        //Implementation - removed for readability
        //I do not see any debug statement in the output/log window for this method
    }


 
At step 6 to create an encrypted version of the key using the specified command - 'travis encrypt-file assets/server.key assets/server.key.enc --add', I get the error:

repository not known to https://api.travis-ci.org/: mohsinwadee/sfdx-travisci

mohsinwadee being my username of-course. Any ideas?
Hi all,

I'm getting an error while verifying step 7:
  • Challenge Not yet complete... here's what's wrong:  Ensure that you implement all the pagination methods using the corresponding StandardSetController methods.
I implemented the class using the StandardSetController methods but it doesn't work.

Any advice or suggestion?
Thank you.

I'm building a Lightning Component that includes a ui:scrollerWrapper, containing an aura:iteration. I want the scroller to default scrollTo the bottom. 

I found this documentation: https://developer.salesforce.com/docs/atlas.en-us.208.0.lightning.meta/lightning/aura_compref_ui_scrollerWrapper.htm? that lists the Methods, including scrollTo(destination) where destination is a string with options "top", "bottom", "left" and "right".  But I can't figure out where to put that method.

My component markup:
 

<ui:scrollerWrapper class="scrollerSize" aura:Id="scroller">

        <aura:iteration items="{!v.messages}" var="message">
            <c:MessageTile message="{!message}" inits="{!v.conversation.GroupInits__c}"/>
        </aura:iteration>

    </ui:scrollerWrapper>
My css:
.THIS.scrollerSize {
    height: 400px;
}
I tried this in the doInit handler:
var scroller = component.find("scroller");
scroller.scrollTo('bottom');
But it doesn't work.

Advice?

 
There seems to be an issue in this trailhead module when running it on Windows. Unencrypting the encrypted server key on the Travis server doesn't work.
This seems to be a known issue (https://github.com/travis-ci/travis-ci/issues/4746) and this alternative (https://docs.travis-ci.com/user/encrypting-files/#Using-OpenSSL) didn't work for me as well.
My code development environment conists of Apple MBP, Google Chrome browser and Salesforces native Developer Console tool. With the Google Chrome v56 update, scrolling up/down in developer console becomes extremely jumpy and it makes my experience extremely painful. I have to go on Safari and develop there as a workaround.

Is anyone else here experiencing this issue? Here's the related StackExchange topic. I would like to hear any solutions to this problem if there's any.

Hi,
I'm stuck at the first challenge where it always returns me:
Could not find an entry in the ServiceCredentials custom setting named 'BillingServiceCredential' with the specified username and password. Ensure the you have entered the data correctly into the custom settings record.
I think that I did everything right. The unmanaged package came with a custom setting called ServiceCredentials:

User-added image
I clicked manage and added the BillingServiceCredential

User-added image

With following details
User-added image

Still giving me above error!
Any ideas?

Regs,
Pieter

Developing a site in muliple langauges using visualforce and I am using Custom Labels. If there is a better way to manage lanugage translations do divulge the secret...

So I have created a custom label under setup > custom labels

{!$Label.idiots}

You must fill out the form correctly <b>stupid customer</b>!

This is the label. I need the customer to know how silly they are by putting it in bold. Any ideas?
 
  • August 04, 2016
  • Like
  • 0
Hi,

I have passed a single value to my server side apex controller using the following code

action.setParams({ "searchKey" : elemVal });

Now i want to pass one more argument along with elemVal. I tried the following code but i am getting null.

action.setParams({ "searchKey" : elemVal },{"temp" : t}):

Please help
  • June 24, 2016
  • Like
  • 0
Hi, 
can i get all the values of a picklist field in a list some how?

I have picklist type custom field in the product. having some options.
In my apex class i want to use these options. can I get them some how throught code? 
Hi All- 

I have a visualforce page with images that I need to render as a PDF. The images come from a formula field and display fine if I remove renderAs="pdf". However when I put it back, the PDF shows broken images. The VF page code is below. Note that the image field is actually a formula field that creates the entire html img element with src.
 
<apex:page standardController="Opportunity" recordSetVar="SelectedOpportunities"> 
    <apex:variable var="number" value="{!0}"/> 
    <apex:repeat value="{!selected}" var="SelectedOpportunity">
     <apex:outputText rendered="{!MOD(number,8)==0}"><p align="center" style="{!IF(number!=0,'page-break-before: always;','')}"></p></apex:outputText>
    <apex:variable var="number" value="{!number + 1}"/> 
    <apex:outputText rendered="{!MOD(number,2)==1}"><div style="width:350px; float:left; border:1px solid black">
<table><tr><td width="200px" height="200px"><apex:outputtext value="{!SelectedOpportunity.Student_Image__c}" escape="false" /></td>
    <td width="150px" height="200px"><span style="font-weight: bold"> {!SelectedOpportunity.Full_Name__c} </span> <br /> 
    {!SelectedOpportunity.City__c}, {!SelectedOpportunity.State__c}  {!SelectedOpportunity.Country__c}<br />
    {!SelectedOpportunity.Voyage_Code__c}</td></tr></table></div></apex:outputText>
    <apex:outputText rendered="{!MOD(number,2)==0}"><div style="width:350px; float:right; border:1px solid black">
<table><tr><td width="200px" height="200px"><apex:outputText value="{!SelectedOpportunity.Student_Image__c}" escape="false"/></td>
     <td width="150px" height="200px"><span style="font-weight: bold"> {!SelectedOpportunity.Full_Name__c} </span> <br /> 
    {!SelectedOpportunity.City__c},{!SelectedOpportunity.State__c}  {!SelectedOpportunity.Country__c}<br />
    {!SelectedOpportunity.Voyage_Code__c}</td></tr></table></div></apex:outputText>
</apex:repeat>
</apex:page>

Anyone have any ideas how to fix this? I've disabled the security checking for remote sites and that does not work either.
 
Hi all,

I have the following visualforce code (simplified a little for clarity):

<apex:page standardController="NCQ__c">
  <apex:tabPanel id="tabPanel" switchType="client" selectedTab="BusinessAssessmentTab">
    <apex:tab id="BusinessAssessmentTab" label="Business Assessment" name="BusinessAssessmentTab">
      <apex:form>
        <apex:pageBlock>
          <apex:pageBlockSection title="Business Type">
            <apex:inputField value="{!NCQ__c.Business_Type__c}">
              <apex:actionSupport event="onchange" rerender="McQuestions" immediate="true"/>
            </apex:inputField>
          </apex:pageBlockSection>
          <apex:pageBlockSection id="BusinessAssessmentBlock" title="Business Assessment">
            <apex:outputPanel id="GeneralQuestions">
              <apex:outputField value="{!NCQ__c.BA_1_Question__c}" rendered="true"/>
              <apex:inputField value="{!NCQ__c.BA_1_Answer__c}" style="width: 100%"/>
              <p/>
            </apex:outputPanel>
            <apex:outputPanel id="McQuestions">
              <apex:outputField value="{!NCQ__c.BA_MC_1_Question__c}" rendered="true"/>
              <apex:inputField value="{!NCQ__c.BA_MC_1_Answer__c}" style="width: 100%"/>
              <p/>
            </apex:outputPanel>
          </apex:pageBlock>
        </apex:form>
      </apex:tab>
    </apex:tabPanel>
  </apex:page>

I'd like to eventually hide or show the McQuestions panel based on the value of NCQ__c.Business_Type__c. Has a first step, I just had the McQuestions panel rerender on any change to Business_Type__c. For some reason, rerendering the panel causes the outputFields values to disappear from McQuestions. I have no clue what is going on! I'm hoping someone has some ideas? I've attached two images (before and after) to illustrate what is going on.

Please let me know if you need any further details!

-Chris 

User-added image
User-added image

Hi,

I have a VFpage where in I am using the <apex:repeat> component which will repeat the code depending on number of items in the object. Inside the <apex:repeat> component, I have <apex: inputField> components; this are the fields that are being repeated. currently, in the <apex:inputField>, I gave them a regular id="test1", but the problem that I am facing is if there are 3 records in the object then the repeat component will put three sections in the VF page. In this case, all three inputFields are having the same id. 

I want to give them all the unique id's no matter how many records we have in the other object.

 

Please throw out any ideas you have for this problem. I would really appreciate it.

 

Thanks-in-Advance,

Justin~sfdc

Requirement: To get Account details from SAP and store it in Salesforce during the first week of every month.

 

To implement this, I can use HTTP Callouts to the SAP webservices.  The callouts call the SAP services, pass the account Id and gets all the other information and stores in Salesforce.  This logic I can do it in my Apex classes and schedule it to run on 1st of every month.

 

What I want to know is how to setup the connection between SAP and Salesforce? Can anyone brief the steps ?

- Does SAP allow creation of web services for Salesforce to call? 

- Do we need any third party tools ? 

- Can I use outbound messaging services in Salesforce? 

- How is the hosting of SAP web service taken care?

 

Please help.  Thanks!

Let's say I got 50,000 records in a table where there is a field named OwnerID.  Let's say I just want to grab a set of the distinct OwnerIDs and not be charged 50,000 query rows for my governor limits.  What ya'll have to say about 'dat?

 

 

~Tyler

Hello.  I have a metadata .object file and I'm trying to use ant to create the custom object in my sandbox.  If I limit the package.xml file to a single field, then it works, but if I try to create all the fields, I get errors "not in package.xml" even though I do have the fields there.

 

I've searched the documentation but there is no good example on how to deploy a complete custom object.  Any ideas as to where I'm going wrong?

 

BTW - this is a Custom Settings object.

 

Here's a portion of my xml file:

 

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>GWpkg</fullName>
    <types>
        <members>OppRollupSettings__c</members>
        <name>CustomObject</name>
    </types>
    <types>
        <members>OppRollupSettings__c.Assume_Fiscal_Year_Starts_January__c</members>
        <name>CustomField</name>
    </types>
    <types>
        <members>OppRollupSettings__c.Enable_Opp_Rollup_Triggers__c</members>
        <name>CustomField</name>
    </types>
    <version>20.0</version>
</Package>

 

 

 

Here's my build.properties file:

 

"antlib:com.salesforce">

    <property file="build.properties"/>
    <property environment="env"/>

    <!-- Test out deploy and retrieve verbs for package 'GWpkg' -->
    <target name="deploy">
      <!-- Upload the contents of the "GWpkg" package -->
      <sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" deployRoot="GWpkg"/>
    </target>
</project>

 

 

 

 

Hi All,

 

Writing my first test class here and fallen at the first hurdle!

 

To be able to test my class I need to instantiate a load of test objects first of all, so I have written a little class to do that which works fine.

 

The class I want to test is a (will be a) shopping cart that does nothing but instantiate so far.

 

I've started writing the test class to go alongside for my TDD. First I've instantiated all the test objects and written my first test method. However, Force.com IDE complains that objects are not available in my class. So when I try to save  

 

 

@isTest
private class TMDR_ShoppingCartTest {



	testBuildObjects tbo = new testBuildObjects();
	Account a = tbo.createAccount();
	Contact c = tbo.createContact(a.id);
	Opportunity o = tbo.createOpportunity(a.id,c.id);
	OpportunityContactRole ocr = tbo.createOpportunityContactRole(c.id,o.id);
	OpportunityLineItem oli = tbo.createOpportunityLineItem(o.id);
	OpportunityLineItem oli2 = tbo.createOpportunityLineItem(o.id);
	OpportunityLineItem oli3 = tbo.createOpportunityLineItem(o.id);
		
	static testMethod void testInstantiate() {
			
			System.Debug('########Starting Shopping cart tests###########');
			TMDR_ShoppingCart cart = new TMDR_ShoppingCart(o.id);
		
	}

}

 

 

 

 Force.com complains that o.id does not exist!

 

This must be a simple one. Can you help?

 

TIA

 

 

 

 

I have some code that sends out an email. If I run that code from inside salesforce it works fine. However, if I run that code as the public sites user I get the following SendEmailResult error.

 

SendEmail failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []

 

However, all the mailing objects ID's (who, what, template and orgwide) are exactly the same when I send it from inside salesforce and from the website so I don't understand how it could be giving an error in one case but not the other.

 

 Here's the code that sends the email:

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); 

mail.setTemplateId(template);

mail.setwhatId(what);

mail.setTargetObjectId(who);

mail.setSaveAsActivity(true);

mail.setOrgWideEmailAddressId(orgwide);

Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail});

 

for(Messaging.SendEmailResult res : r){

if(res.isSuccess() == false)

System.debug(res.geterrors().get(0).getMessage());

}

 

 Am I misunderstanding the error or is there some other ID field that could be screwing up the email?

 

 

Message Edited by grigri9 on 11-17-2009 09:08 PM