Hello I am trying to make a Lightning component common to Community and SF1 . This component has been added as quick action on one of the object detail page.

Now when i am using the toast event, it gives me error as

Something has gone wrong. [TypeError: Cannot read property 'setParams' of undefined] . Please try again.

Code for same -

action.setCallback(this, function(response) {
            var state = response.getState();
            console.log('state--->1', state);
            if (state === 'SUCCESS') {
                jobApplicantId = response.getReturnValue();
                fromPos = toPos;
                console.log('fileContents.length -->', fileContents.length);
                toPos = Math.min(fileContents.length, fromPos + CHUNK_SIZE);
                console.log('fromPos -->' , fromPos);
                console.log('toPos -->' , toPos);

                if (fromPos < toPos) {
                    this.uploadChunk(component, file, fileContents, fromPos, toPos, attachId);  
                } else if (fromPos == toPos) {
                    //alert('Job Application Successful');
                    var toastEvent = $A.get("e.force:showToast");
                    console.log('toastEvent -->', toastEvent);
                        "title": "Success!",
                        "message": "The record has been updated successfully."
                    component.find("comments").set("v.value", "");
                    component.find("file").getElement().value = "";
            } else {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        alert("Error message: " + 
                } else {
                    console.log("Unknown error");


Snapshot - enter image description here This whole thing is in a helper class? can this be the issue?

  • Is this inside SF1 app or community builder? – Mohith Shrivastava Jun 21 '16 at 11:23
  • I am trying this in SF1 – Kaushik Ray Jun 21 '16 at 11:27
  • What type of org it is ?Summer 16 or spring org with locker enabled ? – Mohith Shrivastava Jun 21 '16 at 11:29
  • @MohithShrivastava I checked something else. It looks like $A related metehods are not working in SF1 which is working in Community lightning component. Is there any restrcition around that? I tried $A.util.addClass() method and it seems to be failing – Kaushik Ray Jun 21 '16 at 11:30
  • Summer 16 but Locker not enabled – Kaushik Ray Jun 21 '16 at 11:31

From the description and image ,I see that you are using Lightning components inside the Visualforce page . Having lightning components inside the visualforce ,you will loose certain events as documented in the guide .The events that are not supported are as below







Official Documentation On Toast event

I think you should open an Idea on Idea Exchange to support lightning components directly from publisher actions .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.