• Kevlangdo
  • NEWBIE
  • 75 Points
  • Member since 2016
  • Senior CRM Developer
  • Crevier Group


  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 1
    Likes Given
  • 17
    Questions
  • 39
    Replies
I create a custom object and a visualforce page. the data from the custom object is accessed using Visualforce Remoting with sremoteobject. I can see all the data through the visualforce page. However, the end user cannot. The end user can browse the data from a standard tab, can edit the data, etc. However, when he clicks on the visualforce tab and loads the visualforce page, the page is empty.

I gave access to the fields, custom objet, etc
I gave access to the visualforce page

in the profile, he has view all, modify all on the object

Is there some other special permissions for Visualforce Remoting that must be given?
I am using the SLDS framework
Hi

I am building an app external to Salesforce but I want the app to read and write data to a custom object in salesforce via an API. However the app will be available to authenticated users in Salesforce only via a web tab or a Visualforce tab (embedded app). According to the doc I need to docs I need to setup OAuth to allow users to access the Rest APIs:

In the Connected App configuration, we are require to define a callback url. This is the first time I am using OAUth. Do I need to create a web page for the callback? What url to use. Is it to a page in my app or a page in salesforce.

Also, I want the users to access the app and the data through Salesforce without requiring to login each time or have to accept a callback each time. So How can I use SSO with Rest web methods that is transparent to the end users

How to make the external app visible to logged in users from a web tab. I tried different web pages and it is always blank  without needing to use Canvas

Thanks
I am trying for two days to update (upsert) records (over a 1000) from a table to a custom object. From the code below, the first alert correctly shows the initial value and after upsert, the second alert shows the correct updated value but if I physically check the data in the custom object through a standard SOQL query or through a view, the data hasn't changed. 
 
target.retrieve((err, results)=>{
                         results.forEach((r)=>{
                 			alert(`before: ${r.get('q1_target_volume__c')}`);
                			target.set('q1_target_volume__c', r.get('q1_actual_volume__c') * (1+volPercentage.value/100));
                			target.set('q2_target_volume__c', r.get('q2_actual_volume__c') * (1+ volPercentage.value/100));
                			target.set('q3_target_volume__c', r.get('q3_actual_volume__c') * (1+ volPercentage.value/100));
                			target.set('q4_target_volume__c', r.get('q4_actual_volume__c') * (1+ volPercentage.value/100));
                            
							target.set('q1_target_target__c', r.get('q1_actual_volume__c') * (1+ gpPercentage.value/100));
                			target.set('q2_target_target__c', r.get('q2_actual_volume__c') * (1+ gpPercentage.value/100));
                			target.set('q3_target_target__c', r.get('q3_actual_volume__c') * (1+ gpPercentage.value/100));
                			target.set('q4_target_target__c', r.get('q4_actual_volume__c') * (1+ gpPercentage.value/100));
                
                
                
               				target.upsert();
                
                			alert(`after: ${target.get('q1_target_volume__c')}`);
                
                
                         	
                        });            
                    });

 
Hi
In the code below, in the initial alert, I am getting the proper initial value. Example 25.0. After I call the target.upsert and and call the second alert, I get the proper result, 26.25 for the sake of argument. However, the Target__c object isn't actually updated  on the server and I can't figure out what I am doing wrong. I tried update as well. 

What am I doing wrong I've been on this problem for 2 days now.

 
var CalculatePercentage =()=>{
                //alert(gpPercentage.value);
                var gpPercentage = document.getElementById('gp-percentage');
        		var volPercentage = document.getElementById('volume-percentage');
                var ids = [];
                var target = new SObjectModel.Targets__c();
                
                
                     target.retrieve((err, results)=>{
                         results.forEach((r)=>{
                 			alert(`before: ${r.get('q1_target_volume__c')}`);
                			target.set('q1_target_volume__c', r.get('q1_actual_volume__c') * (1+volPercentage.value/100));
                			target.set('q2_target_volume__c', r.get('q2_actual_volume__c') * 1+ (volPercentage.value/100));
                			target.set('q3_target_volume__c', r.get('q3_actual_volume__c') * 1+ (volPercentage.value/100));
                			target.set('q4_target_volume__c', r.get('q4_actual_volume__c') * 1+ (volPercentage.value/100));
                            
							target.set('q1_target_target__c', r.get('q1_actual_volume__c') * 1+ (gpPercentage.value/100));
                			target.set('q2_target_target__c', r.get('q2_actual_volume__c') * 1+ (gpPercentage.value/100));
                			target.set('q3_target_target__c', r.get('q3_actual_volume__c') * 1+ (gpPercentage.value/100));
                			target.set('q4_target_target__c', r.get('q4_actual_volume__c') * 1+ (gpPercentage.value/100));
                
                
                
               				target.upsert();
                
                			alert(`after: ${target.get('q1_target_volume__c')}`);
                
                
                         	
                        });            
                    });
              
           };

 
I am trying to use Remote Objects on Big Object but I am getting a malformed error on retrieve operation field id cannot be sorted in query call. First I am not using the Id field in query. Second, is Remoting Objects supported with Big Object
ThanksUser-added image
Hi

I just recently started working with Big Objects. I sucessfully added my first BigObject to the sandbox, but as is most oftent the case in development, I need to modify one of the index fields.

the first error meesage I am getting is we change length of a text field in an index.
So I decided to leave the original text field as is and I add a new one with the required length. Now I am getting an error message saying that we can't modify an index. 

We are in development.... change is constant. If we cant modify an object regardless of type, then what is the object is the first place
I am doing the following trailhead on big objects and I need to be able to upload zip file from Workbench into this playgound. However, when I login into sandbox, the url is test.salesforce.com. If I try to use my playground username it says that it doesn't exists. If I try to change the url to my playground, it generates and error. So How can I complete this trealhead.
https://trailhead.salesforce.com/modules/big_objects/units/big_objects_define_custom_big_objects
Hello,
I defined by BigObject as per the instructions. 
I created the following files:
package.xml
SalesTargets__b.object
SalesTargets__BigObject.permissionset

I created a zip file and uploaded through the workbench using the Deploy interface in my sandbox. 

I am getting a success statusWorkbench Status for SalesTargets__b

But the BigObject is not in my sandbox. Is there something I am missing
 
I was merging large amount of Account records in a 24 hour period. This morning I started getting CPU limit exceeded errors. Now the Apex merge code is no longer working.
Hello

I am trying to parse the data from OpenActivties SOQL query in javascript
 
SELECT id, CreatedDate, (SELECT Subject, WhoId, IsTask, ActivityDate, Status, Priority, OwnerId, raison_dap__c, description 
FROM OpenActivities) OpenActivities FROM Account
The OpenActivities is returned as json, but when I use JSON.stringify I get back the json data in string format. However, when I parse the data I can't retrieve any values
conn.query(query, function(err, result) {
        if (err) { return console.error(err); }
        console.log("total : " + result.totalSize);
        console.log("fetched : " + result.records.length);
        for (var i=0; i<result.records.length; i++) {
          var record = result.records[i];
          var activity = result.records[i].OpenActivities;
          console.log("Name: " + record.Id);
          console.log("Created Date: " + record.CreatedDate);
          
          console.log("Activity data: " + JSON.stringify(record.OpenActivities));

          JSON.parse(record.OpenActivities, (key,value)=>{

            
             console.log(key);
             console.log(value);
         });

         //or
         var data =  JSON.parse(record.OpenActivities);

         console.log("size: " + data.totalSize); //nothing returned
sample data
Activity data: {"totalSize":2,
				"done":true,
					"records":[
						{"attributes":
							{
							"type":"OpenActivity",
							"url":"/services/data/v39.0/sobjects/OpenActivity/00T0B0zzzzzzzixxxxxxxxx"},
							"Subject":"call",
							"WhoId":null,
							"IsTask":true,
							"ActivityDate":null,
							"Status":"In Progress",
							"Priority":"High",
							"OwnerId":"005000000000",							
							"Description":null},
						{"attributes":
							{
							"type":"OpenActivity",
							......}]}

 
Can someone tell me why I am getting an unknown property accounts.SFDC_Account_Name__c when I pass this field as a parameter to the JS function

Save error: Unknown property 'DataIntegrityList.accounts'    
I am completely baffled as there are many examples in the forum and the web depicting this same pattern.

 
<apex:form >
		   <apex:pageBlock title="Account Data Integrity Issues List">
		      <apex:pageBlockTable value="{!accountProblemsList}" var="accounts" onRowClick="rowSelected('{!accounts.SFDC_Account_Name__c}')">
		      	
		         <apex:column value="{!accounts.PW_Account_Number_SFDC__c}"/>
		         <apex:column value="{!accounts.PW_Account_Number__c}"/>
		        
		         <apex:column value="{!accounts.SFDC_Account_Name__c}"/>
		         <apex:column value="{!accounts.SFDC_ID_PW__c}"/>        
		         <apex:column value="{!accounts.PW_Rep__c}"/>   
		         <apex:column value="{!accounts.SFDC_rep__c}"/>
		         <apex:column value="{!accounts.SFDC_repid__c}"/>
		         <apex:column value="{!accounts.PW_Acct_Status__c}"/>         
		      </apex:pageBlockTable>
		   </apex:pageBlock>
   	</apex:form>

 
How can I set the field level security for all custom fields in each of the profiles through the metadata in the profile files in Force IDE. Everything I try generates compile errors.

Am I in the right xml file?

Example:
 
<?xml version="1.0" encoding="UTF-8"?>
<Profile xmlns="http://soap.sforce.com/2006/04/metadata">
    <custom>true</custom>
    <userLicense>Salesforce</userLicense>
    <userPermissions>
        <enabled>true</enabled>
        <name>ApiEnabled</name>
    </userPermissions>
    <userPermissions>
        <enabled>true</enabled>
        <name>AssignTopics</name>
    </userPermissions>
    <userPermissions>
        <enabled>true</enabled>
        <name>ChatterEditOwnPost</name>
    </userPermissions>

 
I have a simple trigger with 100% code coverage. In Sandbox all tests are Success. However deploying to prod, I am getting a No Cod eCoverage Error "The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
UpdateOwnerCompany
"

I can see where my error is....what is missing

Here is Trigger Code:
 
trigger UpdateOwnerCompany on Opportunity (before update) {
    for(Opportunity o :Trigger.new){
        User op_owner = [Select u.id, u.CompanyName, u.Company_Code__c from User u where Id =: o.OwnerId];
       
        o.OwnerCompany__c = op_owner.CompanyName;
      
    }
}
Here is the Unit test
 
@IsTest(seeAllData=false)
public class UpdateOwnerCompanyTest {
    public static Opportunity opt;
    public static testMethod void testOwner(){
   
        test.startTest();
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard Ontario User']; 
        User testuser = new User(
        Alias = 'cowner', Email='ontariouser@testorg.com', 
            EmailEncodingKey='UTF-8', LastName='Cowner', LanguageLocaleKey='en_US', 
            LocaleSidKey='en_US', 
            ProfileId = p.Id, 
            CompanyName = 'TestOntario',
            TimeZoneSidKey='America/New York', UserName='ontariouser@testorg.com'
        );
        insert testuser;
         Account testAcct = new Account (Name = 'Test Account');
        Date testCloseDate = Date.newInstance(2016, 4, 17);
        insert testAcct;
        opt = new Opportunity(
            Name = 'BuzzCo',
            AccountId = testAcct.ID,
            Opportunity_Type__c = 'Existing - SOW',
            LeadSource = 'Partner',
            Product_Family__c = 'Test',
            opportunitie_brands__c = 'Test',
            StageName = 'Qualification',
            CloseDate = testCloseDate ,
            Expected_First_Sale_Date__c = testCloseDate.addDays(7),
            next_step_date__c = testCloseDate
        );    
        insert opt;
              
       
        List<Opportunity> insertedOpps = [SELECT OwnerCompany__c FROM Opportunity WHERE name = 'BuzzCo'];
        for(Opportunity ops : insertedOpps){
             User op_owner = [Select u.id, u.CompanyName, u.Company_Code__c from User u where Id =: testuser.Id];
       
        	ops.OwnerCompany__c = op_owner.CompanyName;
            system.debug(ops.OwnerCompany__c);
          System.assertEquals(ops.OwnerCompany__c, 'TestOntario');
        }
        test.stopTest();
    }
   
}


 
https://crevier--transform--c.cs44.visual.force.com/apex/unsubscribe

I read the docs and turorials and related blog posts but I haven't found the answer

I need to give our customers public access to unsubscribe to newsletters, etc. (sample page above) however my test users keep getting the salesforce login page when clicking on link.

Other than the visualforce page, they would need to update their contact information via a web service. I have included access to the visualforce, contact (read/write) and apex classes through the Guest user profile, but we keep getting the login page.

What do I need to do
"INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session"

I tested some code with the partner wsdl and I was able create an Contact with no issues

I am trying into create > 4000 sales records using Enterprise wsdl.
I am using stdClass
I checked my session id at start of session and at create
 
public function __construct(){
        require_once('SforceEnterpriseClient.php');
        require_once('SforceHeaderOptions.php');
        require_once('userAuth.php');
       // session_start();
        $this->testSforceConnection = new SforceEnterpriseClient();
        $this->testSoapClient = $this->testSforceConnection ->createConnection($this->wsdl);
        $this->testSFDClogin = $this->testSforceConnection ->login($this->USERNAME, $this->PASSWORD.$this->Token);


        $_SESSION['location']=$this->testSforceConnection ->getLocation();
        $_SESSION['sessionId']=$this->testSforceConnection ->getSessionId();
        $_SESSION['wsdl']=$this->wsdl;

    }



But I am getting the invalid sesison id. I need to use enterprise because I am inserting into custom object.
I users has Sys Admin access

What to do?
I have created a permission set and enabled the "Lightning Experience User" and assigned the permission set to a user. However that user still sees the classic salesforce when he logs in. Does the user have to manually switch to Lightning from Setup or do I need to perform another step to automatically swift a user to lightning. I do want users manually switching to Lightning, I need to be able to automcatically switch the user.
Currently the HasOptedOutOfEmail (Leads) is unchecked b y default and it is up the user the checked it. I would like to set the default value to "Checked" and leave it the user to unckeck it if necessary. I cannot change the default in the field properties and my attempts to set the value through a secondary field formula doesn't work.

Is there a way to set the default value on this field to checked
I am doing the following trailhead on big objects and I need to be able to upload zip file from Workbench into this playgound. However, when I login into sandbox, the url is test.salesforce.com. If I try to use my playground username it says that it doesn't exists. If I try to change the url to my playground, it generates and error. So How can I complete this trealhead.
https://trailhead.salesforce.com/modules/big_objects/units/big_objects_define_custom_big_objects
Hello,
I defined by BigObject as per the instructions. 
I created the following files:
package.xml
SalesTargets__b.object
SalesTargets__BigObject.permissionset

I created a zip file and uploaded through the workbench using the Deploy interface in my sandbox. 

I am getting a success statusWorkbench Status for SalesTargets__b

But the BigObject is not in my sandbox. Is there something I am missing
 
Hi

I am building an app external to Salesforce but I want the app to read and write data to a custom object in salesforce via an API. However the app will be available to authenticated users in Salesforce only via a web tab or a Visualforce tab (embedded app). According to the doc I need to docs I need to setup OAuth to allow users to access the Rest APIs:

In the Connected App configuration, we are require to define a callback url. This is the first time I am using OAUth. Do I need to create a web page for the callback? What url to use. Is it to a page in my app or a page in salesforce.

Also, I want the users to access the app and the data through Salesforce without requiring to login each time or have to accept a callback each time. So How can I use SSO with Rest web methods that is transparent to the end users

How to make the external app visible to logged in users from a web tab. I tried different web pages and it is always blank  without needing to use Canvas

Thanks
I am trying for two days to update (upsert) records (over a 1000) from a table to a custom object. From the code below, the first alert correctly shows the initial value and after upsert, the second alert shows the correct updated value but if I physically check the data in the custom object through a standard SOQL query or through a view, the data hasn't changed. 
 
target.retrieve((err, results)=>{
                         results.forEach((r)=>{
                 			alert(`before: ${r.get('q1_target_volume__c')}`);
                			target.set('q1_target_volume__c', r.get('q1_actual_volume__c') * (1+volPercentage.value/100));
                			target.set('q2_target_volume__c', r.get('q2_actual_volume__c') * (1+ volPercentage.value/100));
                			target.set('q3_target_volume__c', r.get('q3_actual_volume__c') * (1+ volPercentage.value/100));
                			target.set('q4_target_volume__c', r.get('q4_actual_volume__c') * (1+ volPercentage.value/100));
                            
							target.set('q1_target_target__c', r.get('q1_actual_volume__c') * (1+ gpPercentage.value/100));
                			target.set('q2_target_target__c', r.get('q2_actual_volume__c') * (1+ gpPercentage.value/100));
                			target.set('q3_target_target__c', r.get('q3_actual_volume__c') * (1+ gpPercentage.value/100));
                			target.set('q4_target_target__c', r.get('q4_actual_volume__c') * (1+ gpPercentage.value/100));
                
                
                
               				target.upsert();
                
                			alert(`after: ${target.get('q1_target_volume__c')}`);
                
                
                         	
                        });            
                    });

 
Hi All
I am trying to extract the Salesforce schema from the IDE but having little success.
I've seen posts that say you can export as an archive. I have tried this but all I get is a file with the words "place holder" in it.
I can see in the IDE all of the information I want to get at..... xml format is fine.
If the IDE can pull all the info togther to display it there must be a way to either extract it or run a query to get the same information.
All help gratefully recieved
Thanks in advance
User-added image
Im trying to write a test class for the below code. Ive written test classes before for things but for the life of me I cannot figure out how to get this to work with it. I feel like im missing something obvious. My apex class is below. The public list is passing the rest isnt.
public with sharing class CAengineerInvoices {

  List<Service_Booking__c> CAengineerInvoices;
      Service_Booking__c NetTotal;
      Service_Booking__c GrossTotal;
    
    public List <Service_Booking__c> getCAengineerInvoices(){
      CAengineerInvoices = [SELECT   Eng_Qty__c, CA_Gross_Amount__c, CA_Gross_Total_VF__c, Description_Of_Work__c, Description_of_Additional_work__c,Service_Company_Name__c, Company_Name__c, Registration_s__c, Name, Booking_Date_Time__c, CA_Eng_Net_Price__c, KM_Over__c, CA_Tax_Amount__c,Gross_Amount__c, Booking_Date_Time_Fomrula__c
                     FROM Service_Booking__c
                     WHERE Booking_Confirmed__c = True AND Service_Company__c = :ApexPages.currentPage().getParameters().get('Id')];
      return CAengineerInvoices;
    }

	public Service_Booking__c getNetTotal() {
       NetTotal = new Service_Booking__c(CA_Eng_Net_Price__c = 0);
       
       for(Service_Booking__c CAI : getCAengineerInvoices()){
           NetTotal.CA_Eng_Net_Price__c += CAI.CA_Eng_Net_Price__c;
           }
           return NetTotal;
      }


	public Service_Booking__c getGrossTotal() {
       GrossTotal = new Service_Booking__c(CA_Gross_Total_VF__c = 0);
       
       for(Service_Booking__c GT : getCAengineerInvoices()){
           GrossTotal.CA_Gross_Total_VF__c += GT.CA_Gross_Total_VF__c;
           }
           return GrossTotal;
      }
	public Account getAccount() {
        return [SELECT Id, Name FROM Account
                WHERE Id = :ApexPages.currentPage().getParameters().get('Id')];
    }
}

 
Hi

I just recently started working with Big Objects. I sucessfully added my first BigObject to the sandbox, but as is most oftent the case in development, I need to modify one of the index fields.

the first error meesage I am getting is we change length of a text field in an index.
So I decided to leave the original text field as is and I add a new one with the required length. Now I am getting an error message saying that we can't modify an index. 

We are in development.... change is constant. If we cant modify an object regardless of type, then what is the object is the first place
Hello,

I'm beginner with Salesforce. I have this message error when trying to check a challenge : 
"Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: BLTGPVFI" 

Could you help me, please ? 

Regards,
M'henni
If anyone gets this error message: "The dashboard configuration that allows users to see only their own data is incorrect"...
error message

The solution is to check The Dashboard Viewer radio button in the dashboard settings--in the "View Dashboard As" section.
I am doing the following trailhead on big objects and I need to be able to upload zip file from Workbench into this playgound. However, when I login into sandbox, the url is test.salesforce.com. If I try to use my playground username it says that it doesn't exists. If I try to change the url to my playground, it generates and error. So How can I complete this trealhead.
https://trailhead.salesforce.com/modules/big_objects/units/big_objects_define_custom_big_objects
Hello,
I defined by BigObject as per the instructions. 
I created the following files:
package.xml
SalesTargets__b.object
SalesTargets__BigObject.permissionset

I created a zip file and uploaded through the workbench using the Deploy interface in my sandbox. 

I am getting a success statusWorkbench Status for SalesTargets__b

But the BigObject is not in my sandbox. Is there something I am missing
 

Hello,

 

I'm currently attempting to create/deploy a new Home Page Component (and eventually a new Home Page Layout) via the Force.com IDE.  This home page will simply consist of a custom splash image that we will present to users logging into our Customer Portal.  

 

The steps I'm trying to perform are:

 

1) Create a new Document (image file) via the Force.com IDE

2) Reference that image file in a new Home Page Component

3) Reference that Home Page Component in a new Home Page Layout

 

However, I am stuck on step 1.  I can't figure out how to upload a new Document with the Force.com IDE.  

 

I did find this thread from 2008 which says "Documents are a bit esoteric in the Metadata API.  We will post a How To on developer.force.com early next week, plus we've got some exciting ideas planned for our next major release which will simplify this.  Stay tuned."  However, I was unable to find any How-Tos on the subject.  

 

Is it possible to upload a Document via the Force.com IDE?

 

If not - would it be possible to reference a Static Resource from a Home Page Component instead?  Or perhaps someone could recommend a better solution for automated deployment of Home Pages?

 

Thanks,

Greg 

 

  • January 12, 2010
  • Like
  • 1
Best Practice : When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.

User-added image


      That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it. 

Thanks #Copy_Steve Molis