• Natalya Murphy
  • NEWBIE
  • 5 Points
  • Member since 2017


  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 9
    Replies
Ran into this weirdness when I got inconsistent test results between 2 sandboxes:
-In one sandbox, a test failed because a query failed to retrieve records from OrgWideEmailAddress
-In another sandbox for the same org, the test passed and successfully retrieved the record from OrgWideEmailAddress

In both scenarios, the code being tested was looking for a specific email address which happened to match the logged-in user's real email.  For purposes of this post, let's say the user's email was myemail@myemail.com.   This same email was also listed as a record in OrgWideEmailAddress.   The code being tested specifically looked for this email address* (*I know, I know, bad practice to hard-code stuff like this, but I just inherited the system and was told to keep changes to a minimum).

Anyway, after checking to see that both sandboxes did ineed have an entry for myemail@myemail.com in OrgWideAddress, I digged a little deeper and discovered that:
- in the sandbox where the test succeeded, the logged-in user's email had been corrected from "myemail=myemail.com@example.com" to "myemail@myemail.com"
- in the sandbox where the test failed, the logged-in user's email had not been corrected and still showed Salesforce's sandboxified version of "myemail=myemail.com@example.com"

When I corrected the logged-in user's email in the failing sandbox to be "myemail@myemail.com", the previously-failed test succeeded.

So it appears that some behind-the-scenes magic happens when running tests that (maybe?) uses the logged-in user's email as the supposed OrgWideEmailAddress.

Hopefully this will help resolve a headache for someone else in the future.
Is there any use case where Custom Settings would still be preferred over Custom Metadata?  Or should all future development use Custom Metadata?
When I go to a custom object's definition page in Classic, there's a section titled "Apex Sharing Reasons" right below the Record Types section.  But when I switch to Lightning, I don't see any labels in the left-hand object navigation that would tell me how to access the sharing reasons. Do I need to stick with Classic view to see the reasons for now?  Or is the information hidden somewhere weird in Lightning?
I was at a Lightning Now workshop last week and the presenter mentioned that you can now embed Lightning components outside of Salesforce.  I did some digging and found more information about it at this Lightning Out documentation page.   Has anyone tried to implement this?  I'm especially interested in how this could integrate with a WordPress site to show report charts.
We're in the early stages of planning an app that will run on an Android phone or tablet and would like to know the best option between developing a native Android app, taking a hybrid approach or developing directly in Salesforce1.   There are 2 major considerations for picking the most suitable architecture:
  • Users of the app will be in an area with no wifi and, at best, 3G cellular data.  The cellular network in the area is also liable to go down sporadically.  For this reason, we would need a way to store data from custom objects on the Android device in offline mode until a network connection becomes available again.   Because of the network lack of speed and sporadic availability, we'd also want minimal data volume going between the app and the Salesforce server.
  • Users of the app will be technical newbies, so the user interface will need to be as simple as possible.
Any suggestions on the best approach would be greatly appreciated
I've created a remote hybrid app and have gotten it to work as expected.  The app has the correct name on the mobile device emulator, but in Salesforce it just shows up as "SalesforceMobileSDK Sample App" instead of the name I gave it.  How do I get Salesforce to recognize the app by its actual name and list its actual name in the connection and login history?
This is for the "Subscribe to Platform Events" unit in the "Platform Event Basics" module.  I have: ​
- Created the trigger
- Created a test class
- Verified that the trigger is active
- Set up debug logging on my user ID and on Automated Process
- set up tracing on the trigger
- added system.debug messages in the trigger

When I run the apex test, I see no evidence of the trigger getting fired.   Debug Logs also don't show any evidence of trigger firing.  

The ApexTrigger Event Type log in the Salesforce Event Log File Browser does not show the trigger being fired.

What am I missing?  Code for trigger and test is below.
trigger OrderEventTrigger on Order_Event__e (after insert) {
	System.debug('OrderEventTrigger firing');
    List<Task> allTasks = new List<Task>();
    Task newTask = null;
    System.debug('Order count: ' + Trigger.New.size());
    for( Order_Event__e nextOrder : Trigger.New ){
        System.debug('Shipped: ' + nextOrder.Has_Shipped__c);
        if( nextOrder.Has_Shipped__c == true ){
			System.debug( 'Creating task');
            newTask = (new Task(Subject='Follow up on shipped order' + nextOrder.Order_Number__c,
                                 Priority='Medium', Status='New', OwnerId=Userinfo.getUserId()));
            AllTasks.add(newTask);
            System.debug(newTask);
        }//if
    }//for
    
    insert allTasks;
}
 
@isTest
public class OrderEventTriggerTest {
    @isTest static void test1(){
        Order_Event__e orderEvent = new Order_Event__e(Has_Shipped__c=true, 
                                                       Order_Number__c='333');
        
        Test.startTest();
        System.debug('Sending event:' + orderEvent);
        Database.SaveResult sr = EventBus.publish( orderEvent );
        Test.stopTest();
        List<Task> tasks = [SELECT Id from Task];
        System.assertEquals(1, tasks.size());
    }
}

 
This is for the trailhead unit "Apex Web Services."  When I call the service from the workbench using an account ID, I get the expected response back.   But when I call the same service from within a test class with that same account ID, I get an exception that says "List has no rows for assignment to SObject", meaning no data is returned from the query.  Any ideas?  All code is shown below.
 
@RestResource(urlMapping='/Accounts/*/contacts')

global with sharing class AccountManager {

    @HttpGet 
    global static Account getAccount(){
        RestRequest request = RestContext.request;
        System.debug('request: ' + request.requestURI);
        String[] splitURI = request.requestURI.split('/');
        System.debug(splitURI);
        String acctId = splitURI[splitURI.size() - 2];
        System.debug( 'id: ' + acctId);
        Account acct = null;

         acct =
            [SELECT Id, Name,
             (SELECT Id, Name FROM Contacts)
            FROM Account
            WHERE Id =: acctId];
        
        if( acct != null ) {System.debug(acct);}
        return acct;
    }
}
 
@isTest

public class AccountManagerTest {

    @isTest static void testGetAccountById(){
    // Set up a test request
RestRequest request = new RestRequest();

// Set request properties
String testAcctId = '0014600000KcFRn';
request.requestUri =
    URL.getSalesforceBaseUrl().toExternalForm() + '/services/apexrest/Accounts/' + testAcctId + '/contacts';
request.httpMethod = 'GET';
        System.debug('URI: ' + request.requestURI);
RestContext.request = request;
        sObject testAcct = null;

        testAcct = AccountManager.getAccount();

        System.assert(testAcct != null);
        if( testAcct != null ) { System.assertEquals(testAcctId, testAcct.Id); }

    }
}

 
Is there a way to send user authentication information as part of the request URL to a VisualForce page?  The page I'm developing has a report chart on it, so I can't just rely on the Guest User profile since it doesn't allow running of reports.   I'd like to create a user with a very restricted profile and access to a small number of reports, and then be able to render the Visualforce page as if that user was logged in.  I don't want the site visitor to have to provide login credentials.     
Is it possible to have a custom web service send back a report chart in its response?   If so, would love at least some high-level steps on how to accomplish this.
The quick question:  how do I display a chart from my SF org on a public website without allowing the site visitor to drill down into the data?   Is there a way to do this through VisualForce pages or do I need make some API calls to get the chart?  Ideally I'd like the chart to literally be just a picture so there's no risk of a user attempting to drill down into the data.   If someone could provide at least a high-level process for how to accomplish this, I'd appreciate it.   The different API options available are making my head swim.

 
We're in the early stages of planning an app that will run on an Android phone or tablet and would like to know the best option between developing a native Android app, taking a hybrid approach or developing directly in Salesforce1.   There are 2 major considerations for picking the most suitable architecture:
  • Users of the app will be in an area with no wifi and, at best, 3G cellular data.  The cellular network in the area is also liable to go down sporadically.  For this reason, we would need a way to store data from custom objects on the Android device in offline mode until a network connection becomes available again.   Because of the network lack of speed and sporadic availability, we'd also want minimal data volume going between the app and the Salesforce server.
  • Users of the app will be technical newbies, so the user interface will need to be as simple as possible.
Any suggestions on the best approach would be greatly appreciated
I've created a remote hybrid app and have gotten it to work as expected.  The app has the correct name on the mobile device emulator, but in Salesforce it just shows up as "SalesforceMobileSDK Sample App" instead of the name I gave it.  How do I get Salesforce to recognize the app by its actual name and list its actual name in the connection and login history?
Is it possible to have a custom web service send back a report chart in its response?   If so, would love at least some high-level steps on how to accomplish this.
I am following trailhead https://trailhead.salesforce.com/en/modules/knowledge_essentials/units/knowledge_essentials_enable
However after enabling the knowledge in service cloud, I am not able to see the article types in setup. 

Any suggestions?klo,
I properly installed CLI. In a command window, I enter:

sfdx force:auth:web:login -d -a DevHub

in order to log in to the trial Dev Hub that I created. The aforementioned command opens the Salesforce login page in the web browser, so I log in using my Developer Hub Trial Org credentials and click Allow. After that, web browser show me an error: "This site can't be reached. localhost took too long to respond".

This is the URL that Salesforce use after I authenticate in the browser: http://localhost:1717/OauthRedirect?code=aPrxbOND3gL_2LbSR7rKPdvD0XBVk2YpErl3pphY2f3xvZ1wf5SSPJByDleRLPMtzCQWnNGAdg%3D%3D&state=f2f8254fac23

I don't know what happen.

User-added image

User-added image

User-added image
Did anyone have this issue with challenge 6.

Challenge Not yet complete... here's what's wrong: 
Didn't find a Lightning page named Key Sales Data. This page must include: 1. List of new Accounts this week, 2. Recent items showing an "Opportunity", "Lead" and "Contact", 3. Log A Call and New Opportunity actions. Don't use the CreateOppty custom Lightning component for this challenge.

My Key Sales Data Lightning page screenshots:
User-added image

User-added image
Hello sfdx gurus,
In Windows 7, I get the following error when I attampt to authorize the developer hub org. The login windows to DevHub opens up that lead to next error after I put my DevHub credential.
It works fine in Mac. 

Appreciate any input.


C:\Users\raip\sfdx\sfdx-dreamhouse>sfdx force:auth:web:login -d -a DevHub
ERROR running force:auth:web:login:  Command failed with response.
 - CylancePROTECT Script Control has blocked access to this PowerShell script.
.
Try this:
Determine why this command failed to get an encryption key for user raip: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -File C:\Users\raip\AppData\Local\sfdx\plug
ins\node_modules\salesforce-alm\CredMan.ps1 -GetCred -Target sfdx -User local].
 
This is for the "Subscribe to Platform Events" unit in the "Platform Event Basics" module.  I have: ​
- Created the trigger
- Created a test class
- Verified that the trigger is active
- Set up debug logging on my user ID and on Automated Process
- set up tracing on the trigger
- added system.debug messages in the trigger

When I run the apex test, I see no evidence of the trigger getting fired.   Debug Logs also don't show any evidence of trigger firing.  

The ApexTrigger Event Type log in the Salesforce Event Log File Browser does not show the trigger being fired.

What am I missing?  Code for trigger and test is below.
trigger OrderEventTrigger on Order_Event__e (after insert) {
	System.debug('OrderEventTrigger firing');
    List<Task> allTasks = new List<Task>();
    Task newTask = null;
    System.debug('Order count: ' + Trigger.New.size());
    for( Order_Event__e nextOrder : Trigger.New ){
        System.debug('Shipped: ' + nextOrder.Has_Shipped__c);
        if( nextOrder.Has_Shipped__c == true ){
			System.debug( 'Creating task');
            newTask = (new Task(Subject='Follow up on shipped order' + nextOrder.Order_Number__c,
                                 Priority='Medium', Status='New', OwnerId=Userinfo.getUserId()));
            AllTasks.add(newTask);
            System.debug(newTask);
        }//if
    }//for
    
    insert allTasks;
}
 
@isTest
public class OrderEventTriggerTest {
    @isTest static void test1(){
        Order_Event__e orderEvent = new Order_Event__e(Has_Shipped__c=true, 
                                                       Order_Number__c='333');
        
        Test.startTest();
        System.debug('Sending event:' + orderEvent);
        Database.SaveResult sr = EventBus.publish( orderEvent );
        Test.stopTest();
        List<Task> tasks = [SELECT Id from Task];
        System.assertEquals(1, tasks.size());
    }
}

 
This is for the trailhead unit "Apex Web Services."  When I call the service from the workbench using an account ID, I get the expected response back.   But when I call the same service from within a test class with that same account ID, I get an exception that says "List has no rows for assignment to SObject", meaning no data is returned from the query.  Any ideas?  All code is shown below.
 
@RestResource(urlMapping='/Accounts/*/contacts')

global with sharing class AccountManager {

    @HttpGet 
    global static Account getAccount(){
        RestRequest request = RestContext.request;
        System.debug('request: ' + request.requestURI);
        String[] splitURI = request.requestURI.split('/');
        System.debug(splitURI);
        String acctId = splitURI[splitURI.size() - 2];
        System.debug( 'id: ' + acctId);
        Account acct = null;

         acct =
            [SELECT Id, Name,
             (SELECT Id, Name FROM Contacts)
            FROM Account
            WHERE Id =: acctId];
        
        if( acct != null ) {System.debug(acct);}
        return acct;
    }
}
 
@isTest

public class AccountManagerTest {

    @isTest static void testGetAccountById(){
    // Set up a test request
RestRequest request = new RestRequest();

// Set request properties
String testAcctId = '0014600000KcFRn';
request.requestUri =
    URL.getSalesforceBaseUrl().toExternalForm() + '/services/apexrest/Accounts/' + testAcctId + '/contacts';
request.httpMethod = 'GET';
        System.debug('URI: ' + request.requestURI);
RestContext.request = request;
        sObject testAcct = null;

        testAcct = AccountManager.getAccount();

        System.assert(testAcct != null);
        if( testAcct != null ) { System.assertEquals(testAcctId, testAcct.Id); }

    }
}

 
Hello ,

We are doing an integration with Sales-Force that should allow sales force to be embeded inside HTML iFrame tag and to pass customer id as URL parameter to look up for customer information and display the information.
I have researched and found that we can embed salesforce by creating a site and configure the setting for clickjack security .
But can we pass a parameter to the salesforce URL to open a view and search for the customer based on the URL parameter.
If that is double ? Can you show us an example for our POC to the customer.
And is there any limitation for Framing sales force or passing the paramters.

Regards,
Abdurrahman 
Hi!

I'm currently trying to work my way through the Trailhead "Get Started with Hybrid Development", but am having problems when I attempt to "forcedroid create".

When it gets to "Installing "cordova-plugin-whitelist" for android" it fails with:
 
Failed to install 'cordova-plugin-whitelist':TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:466:7)
at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\lib\check_reqs.js:177:42
at _fulfilled (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:796:13)
at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:857:14
at runSingle (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: TypeError: Path must be a string. Received undefined



This error is not imediately fatal, but after a time I see:
 
Installing "cordova-plugin-whitelist" for android
Failed to install 'cordova-plugin-whitelist':TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:466:7)
at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\lib\check_reqs.js:177:42
at _fulfilled (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:796:13)
at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:857:14
at runSingle (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
Failed to install 'com.salesforce':TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:466:7)
at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\lib\check_reqs.js:177:42
at _fulfilled (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:796:13)
at D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:857:14
at runSingle (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:137:13)
at flush (D:\tutorials\AndroidStudioProjects\THA\platforms\android\cordova\node_modules\q\q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
D:\tutorials\AndroidStudioProjects
forcedroid create failed

Command failed: cordova plugin add https://github.com/forcedotcom/SalesforceMobileSDK-CordovaPlugin#v5.0.0 --force
Error: Path must be a string. Received undefined



Whereas, this last bit is fatal.

FWIW,
OS: Windows XP SP3
Java: 1.8.0_121
Node: 5.12.0
Npm: 4.2.0
Cordovoa: 6.5.0

ANDROID_HOME: C:\devtools\Android\sdk
ANDROID_SDK_HOME: C:\devtools\Android\sdk
JAVA_HOME: C:\devtools\Java\jdk1.8.0_121
JDK_HOME: %JAVA_HOME%
JRE_HOME: %JAVA_HOME%\jre
CLASSPATH: .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
User PATH: %JAVA_HOME%\bin;C:\Documents and Settings\Brian Kessler\Application Data\npm
System PATH: C:\Documents and Settings\All Users\Application Data\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Pinnacle\Shared Files\InstantCDDVD\;C:\WINXPSP3\system32\WindowsPowerShell\v1.0;C:\Program Files\Skype\Phone\;C:\Program Files\Kensington\TrackballWorks;C:\devtools\Git\cmd;C:\devtools\Git\GitExtensions\;C:\devtools\nodejs\;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools

Any ideas what is wrong or how to fix this?