• SScholtz
  • NEWBIE
  • 190 Points
  • Member since 2011

  • Chatter
    Feed
  • 5
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 45
    Replies
pop up when adding a visualforce page in lightning I'm dragging the Visualforce Page Component to the Home page layout in Community Builder and I get this pop up box. I can't find any documentation to tell me what to do with this recordId. I would love to pass values to the VF page, but I'm not sure how. 
Hi all, 

This is kind of urgent. I'm using a Aura component and trying to pass an ID to a apex code. However, without using the aura, in classic, my code works like a charm. When I try to pass the value via aura, it does not. 

Below is my Aura Controller which is setting the URL. 
myAction : function(component, event, helper) {
        debugger;
		var action = component.get("c.getOpportunity");
        action.setParams({"OppId": component.get("v.recordId")});
        action.setCallback(this, function(response){
            var state = response.getState();
            if(component.isValid() && state == "SUCCESS"){
                var elem = response.getReturnValue();
                var redirectURL = "/apex/SubmitForApproval?id=" + elem.id;
                redirectURL += "&lock=0";
                
                var urlEvent = $A.get("e.force:navigateToURL");
                urlEvent.setParams({
                  "url": redirectURL
                });
                urlEvent.fire();
            } else {
                component.set("v.hasErrors", true);
                
            }
        });
        $A.enqueueAction(action);
	},

Below is my existing Apex code trying to modify:
public without sharing class SubmitForApprovalExtension {
    public Id objId { get; set; }
    public String doLock { get; set; }
    public SubmitForApprovalExtension(){

//below line is where I'm getting the error for objId
        objId = ApexPages.currentPage().getParameters().get('id');
        doLock = Apexpages.currentPage().getParameters().get('lock');
    }
    
-
-
-
-
-

//enabling the Aura controller

@AuraEnabled
    public static Opportunity getOpportunity(String OppId){
        Opportunity opp = [select Id from opportunity where Id =: OppId limit 1];
        return opp;
    }
}

I'm getting error message saying System.StringException: Invalid id: undefined. I have no idea what it means Undefined. When I put in the actualy Id of the record, it works fine.. Just the ApexPages.currentPage() will not work. Please help!!! 
 
What is the proper way to refer to fields on an sobject in your JS controller?  Assuming I have an attribute "salesCall" of type "Sales_Call__c", is it....
 
var salesCall = component.get('v.salesCall');
console.log(salesCall.myField);

or
 
console.log( component.get('v.salesCall.myField') );

The former seems intuitive - console.log() the salesCall var and you get a JSON object - but is giving me radically wonky and inconsistent results.  Sometimes I get a value, sometimes I get undefined, even though the JSON object has it.  And forget about trying to actually set a value on it.

The latter method seems to perform more consistently and I'm getting much better results with that.

But is there a technical reason why the former won't work?  Some thing to do with Aura's data binding?
Hi there,

I started a module quite a while ago - Lightning Components (https://trailhead.salesforce.com/module/lightning_components) and never finished.  I came back to try and knock it off but it looks like the module has been discontinued or replaced, as when I click the "continue module" button from my profile, I get a 404.

I'm guessing it's been superceded by "Lightning Components Basics" or similar, but can't say for sure as the content looks updated and expanded.

Is there any way to terminate the outdated, incomplete module and remove it from my profile?  Or a way to link it up with its updated version so I can complete it?
I'm trying to rendering a VF page as an excel file and css classes are not being applied when you have something referencing multiple css classes.

Example:
 
<apex:page
        showHeader="false"
        sidebar="false"
        standardStylesheets="false"
        applyBodyTag="false"
        applyHtmlTag="false"
        contentType="application/vnd.ms-excel#test.xls"
    >
    <html>
    <head>
    <style>
        .oneStyle {
            background-color: #f00;
        }  

        .anotherStyle {
            color: #0f0;
        }
    </style>
    </head>
    <body>
    <table>
    <tr>
        <td class="oneStyle">Works</td>
        <td class="anotherStyle">Works</td>
        <td class="oneStyle anotherStyle">Doesn't work at all, no styles</td>
    </tr>
    </table>
    </body>
    </html>
    
    </apex:page>



I can get around this by by doing inline styling or doing something weird like creating lots of combo styles (ex. oneStyle-anotherStyle) but that's all pretty ridiculous.

Has anyone run into this before?  Known issue?  I don't expect the Excel rendering engine in Salesforce to be super robust, but this seems like pretty basic CSS support.

Using Summer '15, API v34
Hi there,

My client has been using the Apex Data Loader for over 2 years now to extract some data from SF, and lately SF has started to time out when we attempt to extract data.  The first timeouts started happening in October 2014, and have been intermittent since then.  The table we're extracting from has grown in size (approx 19,000 records).

I've requested they make some changes to their process-conf.xml file to make sure the data loader retries if it fails, setting values for process.enableRetries, process.maxRetries and process.minRetrySleepSecs.

They want to be able to _test_ the timeout scenario though. :(  I've tried mucking with sfdc.connectionTimeoutSecs and sfdc.timeoutSecs, setting them to really low values (1 sec, 2 sec...), but I can't seem to force the data loader to throw a time out.

Does anyone know...
1. What do these settings *actually* control?  They don't seem to have the desired effect from the docs (https://help.salesforce.com/apex/HTViewHelpDoc?id=loader_params.htm).
2. Does anyone know how it might be possible to *force* the simulation of a time out from Salesforce with the data loader, outside of mucking with process-conf.xml settings?

Thanks!

We just noticed an issue today with some links we had on our Force.com site where some links to download some PDFs (stored as Documents in SF) were broken in our test environment (Winter '14) but not on production (still Summer '13)

The code looks something like this:

 

<apex:outputLink value="/mySite/servlet/servlet.FileDownload?file={!formPDFId}&oid={!$Organization.Id}"
styleClass="standard-blue-button" target="_blank">
{!$Label.lnk_PrintConsentForm}
</apex:outputLink>

 

 

In production, the link is fine, but in our staging environments, it seems like Winter '14 is automatically adding in the site prefix, even though I didn't ask it to, so I end up with /mySite/mySite/servlet/....

 

Anybody else experiencing this? Didn't find anything in the release notes related to outputLink or site prefix.

We have a Force.com site that uses a lot of workflow email alerts to dispatch notifications to our public users. (that is, customers with an "Autheticated Website" license)

 

Workflow emails have a daily limit of 1000 per day * # of standard SF licenses. (https://help.salesforce.com/apex/HTViewHelpDoc?id=workflow_email_limits.htm&language=en_US) We suspected we would hit that limit sometime in the future, so we were looking for work arounds.

 

Sending email with Apex has this note: "You can send an unlimited amount of email to your organization’s internal users, which includes portal users." (https://help.salesforce.com/HTViewHelpDoc?id=email.htm&language=en_US)

 

I thought I had found my answer! Migrate some of the workflow emails to Apex triggers. But now I'm doubting, because I don't think Autheticated Website users count as Portal users.

 

Does anyone know?

Hi there,

 

I seem to be having troubling finding some details around limits in Force.com

 

Yes, there's the gov limits PDF and I found this feature comparison chart for "light" and "enterprise", but neither list things like the limit to the # of cusom fields you can have on your objects. "Enterprise" for Salesforce.com has a limit of 500 (see the gov limits pdf), is Force.com similar?  Is there a limit to the total # of custom objects?  SF.com enterprise is 200, but Force.com is only 10 objects per app?  There's documentation on limits for the # of mass emails you can send in SF.com (1000/day to external addresses), but I haven't seen anything specific to Force.com.

 

I've mostly worked with the SF.com side of things and not with Force.com as a custom app platform, and I'm finding documentation on some specifics and differences between the two product offerings a little thin and/or confusing.

 

Thanks for your help!

Hi there,

 

I was doing some end of project clean up and was bumping up the API versions on some of my classes when a test class started failing.

 

The reason was because once the API version was set to anything above 23.0, the getOrgDefaults() function would return an empty object, even though we had default values defined for the hierarchial custom setting we were referring to.  If the API version was set to 23.0 or lower, the values would be returned as expected.  I tried this with out other custom setting objects and got the same results.

 

Running a getOrgDefaults() in execute anonymous doesn't produce the same results, the object is returned as expected.

 

Anybody else experiencing something similar?  We can leave the API version for this class alone for now, but it's still disconcerting and may prove problematic as time goes on.

Hi there,

 

Question: Does Salesforce allow you to go over the heap size limit, so long as you don't stay over it for too long?  That seems to be our experience, but I'm not sure if that's "official" or if we're just getting lucky.

 

Background: We've been working on a Visual Force page which accepts a CSV from the user in order to parse it, run business logic and do some inserts.

 

Salesforce started complaining about Heap Limits after working just fine for a few weeks.  For one, the files had gotten larger, but as it turned out we were going over the Heap Limit even with the smaller files, Salesforce just wasn't alerting us.

 

In the code, we have a loop that goes through the Blog file (after converting it to a string) to do a row count.  Looking at how much heap we were using, we blew out the limits well before we got to the loop and had been doing so for a while, but Salesforce didn't start complaining until recently, and it only cacked out once we got part way into the loop.

 

We found another way to do the row counting that didn't require a loop (the new string.countMatches() function) and Salesforce stopped complaining about heap size, even though during some tests, we could go way way over. (nearly 4 times as much as the 6 mb's we're allowed)

 

The key was that we were always doing clean up, nulling out large variables and objects that were no longer needed very quickly after we were done with them.

 

It looks like whatever Salesforce does to watch for limit breaking either has a lot more give and take, or it only checks for limit breaking at certain junctures.  Anybody else have a similar experience?

Scenario: I have a decimal field defined with 4 decimal points of precision.  When entering data through the UI, if you enter additional decimal points, Salesforce will round the number to 4 decimal points and save this value to the database.

Entered in UI: 0.20006
Presented after saving: 0.2001
Saved in the database (using Eclipse to query): 0.2001

When using the Apex data loader, Salesforce does not enforce decimal precision.

CSV file: 1.283265
In the UI: 1.2833
Saved in the database: 1.283265

Attempting a quick edit of the record in the UI will show the rounded version, and formulas use the rounded version, but Apex code will use the value from the database.

The extended decimal value will stay this way until the record is re-saved through the UI. (even a quick edit on an unrelated field will cause the rounded version to be saved to the database)  An update via Apex DML statement will NOT change the value unless it's explicitly modified with Apex.

----

I realize I can prevent the data loader from importing such extended values by using a validation rule, or enforce a rounded value using a BeforeUpdate/BeforeInsert trigger, but why is Salesforce not rounding the values as they come in via the Data Loader?

The behaviour seems inconsistent to me.

Is this a "bug" or a "feature"?

Hi there,

 

I have some classes that are testing some trigger code.  During the testing, a number of dependant records need to be created before the test can begin, at least 7 or so DML inserts, putting in anywhere from 1 to 20 records at a time.  All of these objects have their own triggers that also do some inserts and record creation. (my project involves keeping a pseudo-change log of records and specific fields)

 

What I'm finding is that the first layer of DML inserts (those inside the test class) seem to fire alright, but DMLs further down the chain (inside the triggers that belong to the objects I'm creating) are slow to execute, or perhaps more correctly, execute asynchronously from the perspective of the test class's flow.

 

My test class is dependent on the operations that happen in those triggers, and since the test class seems to "race" ahead, parts of the code I'm testing never get covered because those child triggers haven't finished doing what they need to do.

 

Is there any way to impose some kind of delay, some kind of "wait until this other execution stack is finished running" before moving forward with the test, or some kind of "commit all" that forces SF to execute all pending transactions before continuing?

 

This same problem has also caused some confusion for me it terms of governor limits.  Using things like Limit.getQueries() to check improvements to optimization has been confusing, as the test class races ahead to completion before counting up any SOQL queries executed in child triggers.

 

Watching debug statements in the system log while doing things manually through the browser and UI tells a much more accurate story about what's happening, something I may have missed if I only relied on test classes.

 

Any ideas?

 

Cheers, and Happy Holidays!

Hi there,

 

I'm working on making a web service for a client and I'm running into a few issues around some classes I have defined not showing up in the WSDL.

 

I have an element, Entity, which can be many things (Artist, Company, Contract...).  The client wants to receive and send Entity objects, but objects will have different properties depending on whath they're sending.

 

I came up with the following...

 

    global virtual class Entity {

    }
    
    global class Assignment extends Entity {
        webservice String integrationID;
        webservice Date startDate;
        webservice Date endDate;
....
 } global class Artist extends Entity { webservice String integrationID; webservice String salutation; webservice String lastName; webservice String firstName; .... } global class GetUpdatedEntitiesResponse { webservice List<SynchOperation> synchOperation; } global class SynchOperation { webservice String synchID; webservice Entity entity; webservice Entity oldEntity; } webservice static GetUpdatedEntitiesResponse GetUpdatedEntities(Integer maxItems) { // Generate a List<SynchOperation> which include entity and oldEntity values;
// Since Artist and Assignment extend Entity, they can be created and safely assigned
// to SynchOperation.entity and SynchOperation.oldEntity
.... }

 

Everything above shows up defined in the WSDL except for Assignment and Artist.  Naturally, the client is looking for definitions of these.

 

I've been Googling around but haven't had much luck.  I'm not a SOAP guru, but the client needs it.  I understand that there is a concept of inheritance/extension in SOAP, but have no idea what it actually looks like in a WSDL, or if SF accomdates for this.

 

It seems like SF's web service implementation values simplicity over complexity, so my guess is no?

 

Am I doing something wrong above, or does SF just not accomadate for this scenario?

 

I have a couple of solutions in mind, either make Entity this massive class which holds all the properties of all the objects it's supposed to represent, or get rid of SynchOpertaion.entity and oldEntity, and replace it with a series of hard coded nodes, ex. SynchOperation.artist, SynchOperation.oldArtist, SynchOperation.assignment, SynchOperation,oldAssignment, etc.

 

Thoughts?

 

Thanks for your help!

 

 

I'm trying to rendering a VF page as an excel file and css classes are not being applied when you have something referencing multiple css classes.

Example:
 
<apex:page
        showHeader="false"
        sidebar="false"
        standardStylesheets="false"
        applyBodyTag="false"
        applyHtmlTag="false"
        contentType="application/vnd.ms-excel#test.xls"
    >
    <html>
    <head>
    <style>
        .oneStyle {
            background-color: #f00;
        }  

        .anotherStyle {
            color: #0f0;
        }
    </style>
    </head>
    <body>
    <table>
    <tr>
        <td class="oneStyle">Works</td>
        <td class="anotherStyle">Works</td>
        <td class="oneStyle anotherStyle">Doesn't work at all, no styles</td>
    </tr>
    </table>
    </body>
    </html>
    
    </apex:page>



I can get around this by by doing inline styling or doing something weird like creating lots of combo styles (ex. oneStyle-anotherStyle) but that's all pretty ridiculous.

Has anyone run into this before?  Known issue?  I don't expect the Excel rendering engine in Salesforce to be super robust, but this seems like pretty basic CSS support.

Using Summer '15, API v34
pop up when adding a visualforce page in lightning I'm dragging the Visualforce Page Component to the Home page layout in Community Builder and I get this pop up box. I can't find any documentation to tell me what to do with this recordId. I would love to pass values to the VF page, but I'm not sure how. 
Hi all, 

This is kind of urgent. I'm using a Aura component and trying to pass an ID to a apex code. However, without using the aura, in classic, my code works like a charm. When I try to pass the value via aura, it does not. 

Below is my Aura Controller which is setting the URL. 
myAction : function(component, event, helper) {
        debugger;
		var action = component.get("c.getOpportunity");
        action.setParams({"OppId": component.get("v.recordId")});
        action.setCallback(this, function(response){
            var state = response.getState();
            if(component.isValid() && state == "SUCCESS"){
                var elem = response.getReturnValue();
                var redirectURL = "/apex/SubmitForApproval?id=" + elem.id;
                redirectURL += "&lock=0";
                
                var urlEvent = $A.get("e.force:navigateToURL");
                urlEvent.setParams({
                  "url": redirectURL
                });
                urlEvent.fire();
            } else {
                component.set("v.hasErrors", true);
                
            }
        });
        $A.enqueueAction(action);
	},

Below is my existing Apex code trying to modify:
public without sharing class SubmitForApprovalExtension {
    public Id objId { get; set; }
    public String doLock { get; set; }
    public SubmitForApprovalExtension(){

//below line is where I'm getting the error for objId
        objId = ApexPages.currentPage().getParameters().get('id');
        doLock = Apexpages.currentPage().getParameters().get('lock');
    }
    
-
-
-
-
-

//enabling the Aura controller

@AuraEnabled
    public static Opportunity getOpportunity(String OppId){
        Opportunity opp = [select Id from opportunity where Id =: OppId limit 1];
        return opp;
    }
}

I'm getting error message saying System.StringException: Invalid id: undefined. I have no idea what it means Undefined. When I put in the actualy Id of the record, it works fine.. Just the ApexPages.currentPage() will not work. Please help!!! 
 
Hi All,
I have a situtation, i want to render a vf page whcih is consisiting of few components , these component have dedicated controller by whom i am applying some stylesheet using apex class of these conponents. The issue is when i am trying to render them as pdf then the stylesheet is not working only inline style sheet is working. But when i removed render as pdf then everything is good w.r.t stylesheet.

Any help would be appreciated! PLz suggest what can i do to achieve the desired result.

Hi, 

I'm trying to build a query to returns a list of Opportunity IDs where the Opportunity Owner doesn't match the Account Owner. 

I've tried this : 
SELECT Id FROM Opportunity WHERE OwnerId != Opportunity.Account.OwnerId. 
But it doesn't work.

Any Idea ? 

Our developer console in our Enterprise org has been acting up when you scroll it with the mousewheel the last few weeks, and support refuses to help with the issue becuase we don't pay them enough money I guess. 
When we try to scroll on the dev console using the mousewheel, it will keep fighting you, trying to scroll back the opposite of the direction you were trying to scroll in. This causes the window's scroll position to jerk around and makes it very hard to keep your place in large code files.
Has anyone else faced this issue? It is in Chrome
What is the proper way to refer to fields on an sobject in your JS controller?  Assuming I have an attribute "salesCall" of type "Sales_Call__c", is it....
 
var salesCall = component.get('v.salesCall');
console.log(salesCall.myField);

or
 
console.log( component.get('v.salesCall.myField') );

The former seems intuitive - console.log() the salesCall var and you get a JSON object - but is giving me radically wonky and inconsistent results.  Sometimes I get a value, sometimes I get undefined, even though the JSON object has it.  And forget about trying to actually set a value on it.

The latter method seems to perform more consistently and I'm getting much better results with that.

But is there a technical reason why the former won't work?  Some thing to do with Aura's data binding?
Hi All,

My client wants to have lightning them on salesforce classic visual force page. Is there any library/css file which we can use to style the page in lightning theme without using slds? 

Many thanks in advance. 

Regards,
Mayank
Hi there,

I started a module quite a while ago - Lightning Components (https://trailhead.salesforce.com/module/lightning_components) and never finished.  I came back to try and knock it off but it looks like the module has been discontinued or replaced, as when I click the "continue module" button from my profile, I get a 404.

I'm guessing it's been superceded by "Lightning Components Basics" or similar, but can't say for sure as the content looks updated and expanded.

Is there any way to terminate the outdated, incomplete module and remove it from my profile?  Or a way to link it up with its updated version so I can complete it?
<!--campingListItem.cmp-->
<aura:component >
	<aura:attribute name="item" type="Camping_Item__c" required="true"/>

	<ui:outputText value="{!v.item.Name}" />
	<ui:outputCheckbox value="{!v.item.Packed__c}" />
	<ui:outputCurrency value="{!v.item.Price__c}" />
	<ui:outputNumber value="{!v.item.Quantity__c}" />
	<ui:button label="Packed!" press="{!c.packItem}"/>
	
</aura:component>
<!--campingListController.js-->
({
	packItem : function(component, event, helper) {
		var button = event.getSource().get("v.disabled");
		component.set("v.item.Packed__c", "true");
		component.set(button, "true");
	}
})
What am I doing wrong?

 
Hi,

Please any one can explain me about apex:repeat component in salesforce? where we can use?

regards,
Sain
  • August 11, 2015
  • Like
  • 0
Jquery in visualforce page without where clause is working fine. But when i add a where clause to select closed Case's is not working.

Code that Call getall cases:

            var Case = new SObjectData();
            Case.errorHandler = displayError;
              $j(document).ready(function() {
                regBtnClickHandlers();
                getAllCase('Closed');
            });


Below is my code for Jquery:
 
            function getAllCase(sreas) {
                
Case.fetch('soql','SELECT Id, AccountId, CaseNumber, OwnerId, Reason, Status, Subject, Description, ContactId, Priority, Origin from Case WHERE Status = '+sreas+' Order by CaseNumber asc ',function() {
                    showCase(Case.data());
                });
            }

Please let me know what is wrong in this query

  • August 21, 2014
  • Like
  • 0

We just noticed an issue today with some links we had on our Force.com site where some links to download some PDFs (stored as Documents in SF) were broken in our test environment (Winter '14) but not on production (still Summer '13)

The code looks something like this:

 

<apex:outputLink value="/mySite/servlet/servlet.FileDownload?file={!formPDFId}&oid={!$Organization.Id}"
styleClass="standard-blue-button" target="_blank">
{!$Label.lnk_PrintConsentForm}
</apex:outputLink>

 

 

In production, the link is fine, but in our staging environments, it seems like Winter '14 is automatically adding in the site prefix, even though I didn't ask it to, so I end up with /mySite/mySite/servlet/....

 

Anybody else experiencing this? Didn't find anything in the release notes related to outputLink or site prefix.

Hi,

 

I have a Developer org account. It's showing summer 13 version.How can i update to Winter 14 or future(new) releses (Or) Does Saleforce.com automatically updates the Developer org?

 

Thanks.........

Hi All,

 

I have created the visulforce page. It contains the text field, in this text field we will give the apex class API name. On click of "Add" button this class should add in outbound change set. If we click "Delete" it should delete from the outbound change set.

 

Also apex class Add and Delete should be specific to one change set.

 

Please let me know the possibilities

 

Regards,

Shravan Boddula

  • September 26, 2013
  • Like
  • 0

So, I want to generate an email when Site.changePassword (old, new, confirm) is successful. As far as I can tell, on error (bad password or whatever), it returns null (and adds to the pagemessage queue). On success it returns my Site's top-level page.

 

My code works fine in regular use, I just say

 

PageReference retVal = Site.changePassword(newPassword, verifyNewPassword, oldpassword);

if (retVal != null) {

// send emails

}

return retVal;

 

The problem is that within the IsTest stuff, Site.changePassword seems to return Null, even if the password change is nominally a success. You can see my test code (run as SeeAllData=True) below - I create a contact in the appropriate account group, create a user from that contact, insert data, set the password on the user, and then try calling Site.changePassword with something that *should* work. 

 

Site.changePassword (according to my debug logs) runs and doesn't add anything to the ApexPages PageMessage queue. (parenthetically, it's really, really, really frustrating that errors in this method are handled that way instead of a sane way like throwing an exception).

 

So either I'm really missing something fundamental in how to do runAs in a test method, or Site.changePassword returns null on success when called inside a test environment. 

 

Any help is appreciated.

 

 

 

 

Contact c = new Contact(lastname = 'test',

                        firstname = 'test',

                      email = 'test@example.com',

                      accountId = '001e0000005PfVe');

insert(c);

Profile applicantProfile = [Select Id, Name from Profile where Name = 'Applicant Profile'];

User testUser = new User(lastname = 'test',

                        firstname = 'test',

                      email = 'test@example.com',

                      username= 'test@example.com, 

                      profileId= applicantProfile.id, 

                      contactId= c.id,

                      alias = 'test',

                      emailencodingkey='UTF-8',

                      languagelocalekey='en_US',

                      localesidkey='en_US',

                      timezonesidkey='America/Los_Angeles');

insert(testUser);

System.setPassword(testUser.Id, 'abc123456');

ChangePasswordController controller = new ChangePasswordController();

controller.oldPassword = 'abc123456';

controller.newPassword = 'qwerty1234'; 

controller.verifyNewPassword = 'qwerty1234';                

PageReference retVal = null;

System.runAs(testUser) {

retVal = controller.changePassword();

System.debug(retVal);

System.debug('RETURN URL '+Site.getOriginalURL());

System.assertNotEquals(retVal, null);

}

  • April 27, 2013
  • Like
  • 0