• VarunC
  • NEWBIE
  • 200 Points
  • Member since 2008

  • Chatter
    Feed
  • 7
    Best Answers
  • 9
    Likes Received
  • 0
    Likes Given
  • 173
    Questions
  • 336
    Replies
I've a Custom Object whose NEW and EDIT Standard Buttons/Links have been overridden with a Visualforce Page.

This Custom Object also has couple of Record Types on it.

I've added a Custom URL Button for each RecordType so as to quickly execute the override VF page by skipping the Record Type selection page.

Now, this works fine in Classic, and it has worked fine in Lightning Experience till now. But now, I've noticed that the URL Button is not passing the custom parameters, which I've set in URL Button.

My URL Button code is this:
{!URLFOR('/'+ $ObjectType.Custom_OBject_A__c +'/e' , null, [RecordType=URLENCODE('01290000000c821'), parentid=Parent_Object__c.Id], false)}



And this button has been created on Custom_Object_A__c.

So when this button is called from the Custom Object A's related list on Parent Object Detail View, the Visualforce Page set on the EDIT link as override opens and with custom Apex controller code, I read the parentid querystring parameter and populate the target field in the vf page.

This parentid parameter is getting passed in Classic but not in Lightning Experience.
I've been reviewing the very promising APEX Metadata Namespace in Summer '17 (API v40.0) - Release Notes (Preview)

But I'm unable to find any reference for retrieving ListViews of any Object. I'm interested in reading Columns & Filter settings for List Views. The information is available in Metadata Webservice API, but not in APEX Metadata Namespace (at least I'm unable to find any reference).

If anyone with good knowledge of Metadata api, can point me in the direction of how to get the List View Describe:
  • Without using Metadata Webservice API
  • Without the need for adding External Endpoint in Remote Setting for same org
  • Without REST API

Well I'm kinda only left with 1 option of accessing via APEX, natively, because:
  • I do not want to add Remote Site setting in a managed package
  • I want to support both Classic and Lightning Environment (along with Lightning Components) and REST API is inaccessible in Lightning Components, like we can do in VF pages, and using REST API in APEX class to describe ListViews would require me to configure a Remote Endpoint in Remote Settings, which I do not want in my design.

Any suggestions, please let me know AND/OR if SFDC is watching this, then a humble request, why not include ListViews in APEX Metadata Namespace as well :-)
  • April 24, 2017
  • Like
  • 0
I'm trying to create a Global Action, but the icon for it does not show up when it is launched in slide up panel (shown below).

Is there a way I can make that icon show up, it doesn't look good without the icon and is totally not consistent with a Standard Global Action:

User-added image
  • March 15, 2017
  • Like
  • 0
I'm trying to build a Lightning Component Quick Action for Record Quick Action as well as Global Quick Action.

The component opens in a Modal popup in center of screen when in Record View and it opens in a popup along the bottom of the screen when called from Global Action menu (+) symbol in header.

To close the popup I've added following Event Call:
var dismissActionPanel = $A.get("e.force:closeQuickAction"); 
dismissActionPanel.fire();

This works for Record based Quick Action modal dialog and closes it, but it doesn't do anything when called in Global Quick Action.
Here is my complete code for the Lightning Component:

testGlobalCmp.cmp
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickActionWithoutHeader" access="global" >
    <div class="slds-p-around--medium">
        <h2 class="slds-text-heading--medium" >Test Heading</h2>
    </div>
    <div class="slds-p-around--medium">
        Test content of module
    </div>
    <div class="slds-p-around--medium">
        <ui:button label="Cancel" 
                   class="slds-button slds-button--neutral cuf-publisherCancelButton uiButton"
                   press="{!c.cancelBtn}"/>
        <ui:button label="Save &amp; Close" 
                   class="slds-button slds-button--brand cuf-publisherShareButton uiButton"
                   press="{!c.saveAndCloseBtn}"/>
    </div>
</aura:component>


testGlobalCmpController.js
({
    cancelBtn : function(component, event, helper) {
        // Close the action panel
        var dismissActionPanel = $A.get("e.force:closeQuickAction");
        dismissActionPanel.fire();
    },
    saveAndCloseBtn : function(component, event, helper) {
        // Display the total in a "toast" status message
        var resultsToast = $A.get("e.force:showToast");
        resultsToast.setParams({
            "title": "Save Success!",
            "message": "A test save success toast!"
        });
        resultsToast.fire();
        // Close the action panel
        var dismissActionPanel = $A.get("e.force:closeQuickAction");
        dismissActionPanel.fire();
    }
})


And then I created a Quick Action in a object say Contactand also created a Global Quick Action and updated Publisher Layout to add the newly created quick actions to it.
  • March 10, 2017
  • Like
  • 1
I'm getting multiple system error dialog when trying to execute System Events in Lightning Components (in Console Navigation app).

I've tried a link action and action button, and both return errors. My code is as follows:

Error in using force:navigateToSObject :
On a Link onclick, I'm opening the record's detail view by using force:navigateToSObject event as follows:
var navEvt = $A.get("e.force:navigateToSObject"); 
navEvt.setParams({ "recordId": recordId }); 
navEvt.fire();


And it throw following 2 error dialog, dialog 1 appear first, and then dialog 2 show up after clicking OK on dialog 1:
Error dialog 1:
Uncaught Error in $A.getCallback() [Cannot read property 'setParams' of undefined] throws athttps://pk1-dev-ed.lightning.force.com/auraFW/javascript/h_soHR8Rt2_c3cVcuaSlUA/aura_proddebug.js:18473:9Object.fireEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:159:16 Object.fireTranslatedEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:146:22 Object.fireTranslatedStateEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:177:18 Object.force:navigateToSObject()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:214:18 Object.handleSimpleTranslation()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:135:20


Error dialog 2:
Access Check Failed! EventService.getEventDef():'markup://force:navigateToState' is not visible to 'markup://pk1:ListContactRecord {3:1967;a}'. Object.fireEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:157:22 Object.fireTranslatedEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:146:22 Object.fireTranslatedStateEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:177:18 Object.force:navigateToSObject()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:214:18 Object.handleSimpleTranslation()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:135:20
Error in using force:editRecord :
On a Link onclick, I'm opening edit dialog for the record by using force:editRecord event as follows:
var editRecordEvent = $A.get("e.force:editRecord"); 
editRecordEvent.setParams({ "recordId": recordId }); 
editRecordEvent.fire();



This results in single error dialog, but it still opens up the Edit Modal dialog as well. Edit Record modal appears behind the System Error modal dialog with following error details:
 
Access Check Failed! AttributeSet.get(): attribute 'editOverriddenKeyPrefixes' of component 'markup://one:consoleLayoutContainer {1:0;p}' is not visible to 'markup://one:consoleLayoutContainer {1:0;p}'. Object.hasEditOverride()@https://pk1-dev-ed.lightning.force.com/libraries/one/centerStageLibrary/Record.js:154:29Object.handler_force_editRecord()@https://pk1-dev-ed.lightning.force.com/libraries/one/centerStageLibrary/Record.js:105:28 eval()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:1921:29Object.handleCenterStageEvent()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:1907:17handleCenterStageEvent()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:194:16



I'm running clueless as both these Edit and Record View actions work fine in Lightning Component, when the Lightning App is using Standard Navigation, and breaks with errors in Lightning Appwith Console Navigation in it.

Is there any other way available for accessing record view or edit? I've already tried following:
  1. Setting a direct URL = #/sObject/<recordId>/view
  2. Setting a direct URL = #/sObject/<recordId>/edit
Though, [1] URL works fine and opens record, but [2] still throws same error which happens on force:editRecord event navigation. Plus, I don't think setting direct URL formatting is ideal way to code, it seems more hackishh kind of way to me. Though I surely need some help if someone has ideas on this.
  • February 14, 2017
  • Like
  • 0
When we place a Visualforce component container in Lightning Page, the current release displays them correctly without extra spacing, thus allows a developer to control the look and feel of the Visualforce Page interface.

But in Spring '17 Pre-release org, the Visualforce Component container has extra padding on left/right/top/bottom, with dark gray background color, thus placing the existing Visualforce Pages to look awkwardly spaced out.

User-added image
 
  • December 29, 2016
  • Like
  • 1
I've created an Apex trigger on CustomObject_A__c, it is working fine when I clone a record in Classic Aloha interface, but the trigger does not return True for isClone() sObject function call, when I try to clone record in Lightning Experience.
 
trigger CustomObjectTrigger on CustomObject_A__c (before insert, before update)
{
    if (trigger.isBefore)
    {
        for (CustomObject_A__c a : trigger.new) {
            system.debug('@@ (isCloned): '+a.isClone());
            system.debug('@@ (clonedFrom): '+a.getCloneSourceId());
        }
    }
}

Debug output in Lightning Experience:

10:01:02.0 (26981116)|USER_DEBUG|[11]|DEBUG|@@ (isCloned): false
10:01:02.0 (27065138)|USER_DEBUG|[12]|DEBUG|@@ (clonedFrom): null

Debug output in Classic Aloha:

10:06:54.0 (7464346)|USER_DEBUG|[11]|DEBUG|@@ (isCloned): true
10:06:54.0 (7542087)|USER_DEBUG|[12]|DEBUG|@@ (clonedFrom): a0b9000000FxSYMAA3

As you can see, the bug validates my cause that trigger was able to identify properly a Cloned record in Classic interface but not in Lightning Experience. Is this a Known Bug/Issue?

I've found that this isClone() function was introduced in Winter '16 - isClone function added to apex code in Release Notes also, when we scroll down to Bottom of these release notes, we can find this Idea mentioned as Delivered - Idea - Detect isClone() within Trigger
 
  • November 08, 2016
  • Like
  • 0
Following up on the provided example from documentation - Create Components for Lightning for Outlook (Beta), I am able to display the selecetd email's data in html form, but when I try to read the same variables in INIT JS controller method, I get undefined/null values.

sampleOutlookComponent.cmp
<aura:component implements="clients:availableForMailAppAppPage,clients:hasItemContext">

    <aura:attribute name="source" type="String" access="global" />
    <aura:attribute name="people" type="Object" access="global" />
    <aura:attribute name="subject" type="String" access="global" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <div id="content">
        <h1><b>Email subject</b></h1>
        <span id="subject">{!v.subject}</span>

        <h1>To:</h1>
        <aura:iteration items="{!v.people.to}" var="to">
            {!to.name} - {!to.email} <br/>
        </aura:iteration>

        <h1>From:</h1>
        {!v.people.from.name} - {!v.people.from.email}

        <h1>CC:</h1>
        <aura:iteration items="{!v.people.cc}" var="cc">
            {!cc.name} - {!cc.email} <br/>
        </aura:iteration>

        <span class="greeting">{!v.greeting}</span>, {!v.subject}!
    </div>
</aura:component>

sampleOutlookComponentController.js
({
    doInit : function(component, event, helper) {
        var sc = component.get('v.source');
        var sb = component.get('v.subject');
        var pp = component.get('v.people');
        console.log('== people [S] == ');
        console.log('Source: '+sc);
        console.log('Subject: '+sb);
        console.log(pp);
        console.log('== people [E] == ');
    }
})

The console output from above code snippet is this:
== people [S] == 
Source: undefined
Subject: undefined
null
== people [E] ==

I am unable to figure out what I'm doing incorrectly to read the selected email's attributes? Though when I launch this component in sidebar I do get the displayed html render the values correctly like this:
 
Email subject
Another Email
To:
Varun C - testing@testing123.onmicrosoft.com
From:
Varun C - testemailfrom@yahoo.com
CC:

, Another Email!


What could be wrong in my doInit method code that I'm getting null values but when I put same attribute values in component html, and it renders the values correctly, could it be a bug or I'm missing something here?



 
  • October 14, 2016
  • Like
  • 0
I've installed an AppExchange package:
Salesforce Communities Management (for Communities with Chatter) - https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B5XHsEAN - The application Provider is "Salesforce".

In this package there is a particular report named as: CH T - Knowledgeable People Per Topic

When I try to read this report using following APEX code:
Reports.ReportDescribeResult descRes        = Reports.ReportManager.describeReport(r.Id);
I get a "Salesforce System Error", and this System error is not being trapped by any try/catch container. There is no issue if I try to read any other report.

Salesforce System Error: 1621110285-498685 (-1627279259) (-1627279259) 
An unexpected error has occurred. Your solution provider has been notified. (reports)



I'm unable to trap the error and this is breaking the full code. Can someone point me to understand why only this particular report cause trouble in Reading it? 

 
  • April 28, 2016
  • Like
  • 0
I've a Lightning Component that works fine in dev org but deployed in a managed package it throws Internal Server Error. I found another developer thread that has expereinced same kind of error with Lightning Component -
http://salesforce.stackexchange.com/questions/100990/an-internal-server-error-has-occurred-error-id-143631613-25605-15667340

I'm looking to find out if my issue is due to same and I've no idea what this Error ID means, no more details are shown.

My error details are:
An internal server error has occurred Error ID: 1288557852-29109 (-898570520)



 
  • December 05, 2015
  • Like
  • 0
I have been trying to read all 'New Notes' (richtext version) via SOQL query in Apex Controller class.

The design specifications for new notes signifies that they are stored in as ContentVersion records just like Files but with FileType='SNOTE'. I queried 'ContentDocumentLink' for 'LinkedEntityId' and retrieved ContentDocumentId to query all new SNotes but when I query 'ContentVersion' object for those IDs, I got only the record Created/Owned by the logged in user, even though the Note is being auto shared because logged in user has Access to it via Parent Record, and I could see them in Notes and Attachments related list but not being able to query them via SOQL.

(test code below):

APEX Class:
public without sharing class NotesBetaController {
        
	public NotesBetaController() {
		Id recId    = (Id) ApexPages.currentPage().getParameters().get('cid');
		this.readNotes( recId );
	}
	
	private void readNotes(Id recId) {
		try {
			set<String> cdIds    = new set<String>();
			for (ContentDocumentLink cdl : [select Id, ContentDocumentId from ContentDocumentLink where LinkedEntityId =: recId and ContentDocument.FileType = 'SNOTE']) 
			{
				cdIds.add( cdl.ContentDocumentId );
			}
			string qry		= 'select Id, Title from ContentVersion where IsLatest=true and ContentDocumentId IN: cdIds and FileType=\'SNOTE\'';
			
			sObject[] obj 	= database.query( qry );
			ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, 'Total Notes: '+obj.size()));
			
			for (sObject s : obj) {
				ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, 's: '+s));
			}
		}
		catch (Exception ex) {
			ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, ex.getMessage()) );
		}
	}
}


Visualforce Page:
<apex:page controller="NotesBetaController">
       <apex:pageMessages />
</apex:page>



Then Enable Notes in Setup:

User-added image


Once enabled, open a Contact record. (using two separate user logins). Create a New Note from Notes & Attachment list. You should be able to see two Notes in the related list like this:

User-added image


BUT in the Visualforce page I get only 1 record when opened from each user login:

User-added image

I tried "with sharing" and "without sharing" APEX class keywords and BOTH return Same result.

Is it a Hard-coded limit on SOQL fetching? The Documentation of Notes (beta) states that Richtext Notes are NOT Private, they are default shared based on Parent Record. It seems to be a bug/issue in api.
 
  • August 18, 2015
  • Like
  • 0
I'm getting following error in a production org.
System.UnexpectedException: SOQL statements cannot query more than 35 different parent types.
I've already contained the code inside a Try/Catch block but still it isn't being catched.

Is there way I can trap this error and act on it?

 
I have a code sample as below:
Database.DMLOptions dmlo    = new Database.DMLOptions();
dmlo.EmailHeader.triggerUserEmail = true;
database.insert( this.myNewEventsWithEmail, dmlo );
system.debug('@@ Create Events (With EMAIL) : ['+myNewEventsWithEmail.size() + '] ( '+dmlo+' )');
where 
myNewEventsWithEmail
is list of Event object records.

My debug log says that this code was executed and with correct EmailHeader option:
02:49:32.033 (1033993374)|USER_DEBUG|[430]|DEBUG|@@ Create Events (With EMAIL) : [2] ( DMLOptions:[AllowFieldTruncation=null, AssignmentRuleHeader=AssignmentRuleHeader:[AssignmentRuleId=null, UseDefaultRule=null], DuplicateRuleHeader=DuplicateRuleHeader:[AllowSave=null], EmailHeader=EmailHeader:[TriggerAutoResponseEmail=null, TriggerOtherEmail=null, TriggerUserEmail=true], LocaleOptions=null, LocalizeErrors=null, OptAllOrNone=null] )
I have verified that triggerUserEmail is set to True but still No Email is being sent to the user who is assigned the Event.

Weird thing is, same code works just fine with list of Task object records.
  • April 13, 2015
  • Like
  • 0
As we all know with Summer 15, salesforce will be removing supportf or HTMl Area home page components.

So my concern is how can we efficiently replace Home Page HTML Area components with Visualforce components in a Managed Package for subscribers?

I've packaged couple of HTML Area components in my app, and it is a managed package and has been installed in customer orgs. I have created new Home Page Components as Visualforce components but I'm not known of a way on how to make them replace existing subscribers.

Can anyone suggest how we can replace the old components with the new ones?
  • February 12, 2015
  • Like
  • 0
Assuming I've 2 users in my org: [User A] & [User B]

Assuming I've a Managed Package CustomObject: [abc__XYZ__c]

IMPORTANT:
  • [User A] - has been assigned a License of this Managed Package.
  • [User B] - DO NOT have a User License to this Managed Package.

Consider these 3 Visualforce Pages & respective Apex Classes:
  • Test1
  • Test2 / Test2Controller
  • Test3 / Test3Controller

Code for the Pages/Classes is as follows:

Test1 VF Page:
<apex:page standardController="abc__XYZ__c">
    <apex:pageBlock>
        <apex:pageBlockSection columns="1">
            <apex:outputField value="{!abc__XYZ__c.Name}" />
            <apex:outputField value="{!abc__XYZ__c.abc__TotalAmount__c}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Test2 VF Page:
<apex:page controller="Test2Controller">
    <apex:pageBlock>
        <apex:pageBlockSection columns="1">
            <apex:outputText value="{!mysObjVar['Name']}" />
        <apex:outputText value="{!mysObjVar['abc__TotalAmount__c']}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Test2Controller APEX Class:
public with sharing class Test2Controller {
    public abc__XYZ__c mysObjVar { get;set; }

    public Test2Controller() {
        mysObjVar = new abc__XYZ__c();
        abc__XYZ__c[] b = [select Id, name, abc__totalamount__c from abc__XYZ__c where id =: ApexPages.currentPage().getParameters().get('id')];
        if (b.size() > 0)
            mysObjVar = b[0];
    }
}



Test3 VF Page:
<apex:page controller="Test3Controller">
    <apex:pageBlock>
        <apex:pageBlockSection columns="1" title="via sObject">
            <apex:outputText value="{!mysObjVar['Name']}" />
            <apex:outputText value="{!mysObjVar['abc__TotalAmount__c']}" />
        </apex:pageBlockSection>
        <apex:pageBlockSection columns="1" title="via Custom">
            Name: <apex:outputText value="{!sName}" />
            Total: <apex:outputText value="{!sTotal}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Test3Controller APEX Class:
public with sharing class Test3Controller {
    public sObject mysObjVar { get;set; }
    public string sName { get;set; }
    public decimal sTotal { get;set; }

    public Test3Controller() {
        mysObjVar = Schema.getGlobalDescribe().get('abc__XYZ__c').newSObject();
        string recordid = ApexPages.currentPage().getParameters().get('id');
        sObject[] b = database.query('select Id, name, abc__TotalAmount__c from abc__XYZ__c where id =: recordid');
        if (b.size() > 0) {
            mysObjVar = b[0];
            sName = (string) b[0].get('Name');
            sTotal = (decimal) b[0].get('abc__TotalAmount__c');
        }
    }
}



Now:
  • If I access, via [User A]: Test1, Test2, and Test3 VF pages in browser with a valid Record Id, I get ALL these 3 VF pages show me Values for the fields I have shown.
  • If I access, via [User B]:
    • Test1 VF page show "Insufficient Privileges" error.
    • Test2 VF page show me Empty Page.
    • Test3 VF Page show me Empty Section when access via sObject[fieldName] BUT show me Actual Values in field in a section when I use String Property to fetch the field values (image attached)
User-added image


And so my question, how can a User who does not have a License to the Package be able to Fetch Data, and be able to display it to user via a Custom Property, but not via an sObject instance variable or direct object instance variable?

To me it seems like a big Bug in platform! Ideally I don't think it should every allow reading of Data to any User who does not have access to the Managed Package via Licenses and Describe() Calls should respect that, shouldn't they?
  • February 05, 2015
  • Like
  • 2
I have an Edit Link Override to a VF page on Event object, but I want to bypass it in Salesforce1 using "nooverride=1" parameter. Now the parameters works fine for desktop users, but on Salesforce1 mobile, the app gets stuck in a redirect Loop.

 
  • January 02, 2015
  • Like
  • 0
How do we surpass an issue when a package install fails by highlighting an error in an SOQL, citing an unknown Relationship used?

I've used following query:
Select Id, (Select Id From advpm__R00NR0000000VZZ8MAO__r) From Contact a where Id in : trigger.new


And it has failed to one of a client citing following error:
 
1. Didn't understand relationship 'advpm__R00NR0000000VZZ8MAO__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
ContactTrigger: Didn't understand relationship 'advpm__R00NR0000000VZZ8MAO__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

The Relationship, and Field and Object are all part of the managed released package. It installs fine to any other customer but just this one.

May be if someone else here has seen this kind of error on package install and has a workaround, then please share with me here, highly appreciated.
  • December 19, 2014
  • Like
  • 0
I have, in past, released a Managed Package with an App with a custom Logo file (which is a Document record part of the managed package) . Today I've been trying to update the Logo in my Package Development org, and I was able to replace the Document image with newer Logo image. But when I install it in user org, the Old Logo still shows up.

Is there no way I can update Logo of my Packaged App to newer Logo image file and for all subscribers who have installed the app? Can someone share some knowledge on this?
  • December 18, 2014
  • Like
  • 0
I am receiving this error message as response to my JS Remoting Call:
action: "Unknown"
data: ""
message: "Remoting request invalid for your session.  Refresh page and re-submit request"
method: "Unknown"
ref: false
statusCode: 402
type: "exception"
vfDbg: true
vfTx: true
where: ""

I couldn't understand why would this error come, can anyone suggest how to resolve this error? Strangest thing is, it comes in most of the time ai load my VF tab first time, if I press 2-3 times F5 keey and then the JS remoting call works fine.



  • August 02, 2014
  • Like
  • 0
Suddenly lots of subscribers, to an app I developed, are facing issue of 'Insufficient Privileges' error.

The error comes in at any kind of PostBack action I am doing or an AJAX action like rerender a pageblock. The weirdest of all, it is happening on a button click on which I've no custom APEX code.

Say, I've a page with following button, using a "StandardController" pointing to a customobject, like this:

<apex:commandButton action="{!cancel}" value="Cancel" />

This button should call to StandardController object's cancel method and yet, the current page it is called upon is postbacked, the URL remains the same as before, and all other content of page is gone and this deadly error is shown:

"Insufficient Privileges
You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary."

The strangest thing is, I can reproduce this issue in number of orgs like right now, and the app is like 3 years old, nothing modified in recent months on the app, suddenly it just went dead like this, all of the VF pages are throwing this error on any postback.

Can anyone suggest what could be the reason for this?

I've verified that, even System Administrator is getting same error, Org-Wide Sharing rules are correct, no permissions configured that restrict access, Every user has rights to access to others owned data, and also profiles have modify and view all permissions, but still getting same error.


I'm trying to build a Lightning Component Quick Action for Record Quick Action as well as Global Quick Action.

The component opens in a Modal popup in center of screen when in Record View and it opens in a popup along the bottom of the screen when called from Global Action menu (+) symbol in header.

To close the popup I've added following Event Call:
var dismissActionPanel = $A.get("e.force:closeQuickAction"); 
dismissActionPanel.fire();

This works for Record based Quick Action modal dialog and closes it, but it doesn't do anything when called in Global Quick Action.
Here is my complete code for the Lightning Component:

testGlobalCmp.cmp
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickActionWithoutHeader" access="global" >
    <div class="slds-p-around--medium">
        <h2 class="slds-text-heading--medium" >Test Heading</h2>
    </div>
    <div class="slds-p-around--medium">
        Test content of module
    </div>
    <div class="slds-p-around--medium">
        <ui:button label="Cancel" 
                   class="slds-button slds-button--neutral cuf-publisherCancelButton uiButton"
                   press="{!c.cancelBtn}"/>
        <ui:button label="Save &amp; Close" 
                   class="slds-button slds-button--brand cuf-publisherShareButton uiButton"
                   press="{!c.saveAndCloseBtn}"/>
    </div>
</aura:component>


testGlobalCmpController.js
({
    cancelBtn : function(component, event, helper) {
        // Close the action panel
        var dismissActionPanel = $A.get("e.force:closeQuickAction");
        dismissActionPanel.fire();
    },
    saveAndCloseBtn : function(component, event, helper) {
        // Display the total in a "toast" status message
        var resultsToast = $A.get("e.force:showToast");
        resultsToast.setParams({
            "title": "Save Success!",
            "message": "A test save success toast!"
        });
        resultsToast.fire();
        // Close the action panel
        var dismissActionPanel = $A.get("e.force:closeQuickAction");
        dismissActionPanel.fire();
    }
})


And then I created a Quick Action in a object say Contactand also created a Global Quick Action and updated Publisher Layout to add the newly created quick actions to it.
  • March 10, 2017
  • Like
  • 1
When we place a Visualforce component container in Lightning Page, the current release displays them correctly without extra spacing, thus allows a developer to control the look and feel of the Visualforce Page interface.

But in Spring '17 Pre-release org, the Visualforce Component container has extra padding on left/right/top/bottom, with dark gray background color, thus placing the existing Visualforce Pages to look awkwardly spaced out.

User-added image
 
  • December 29, 2016
  • Like
  • 1
Assuming I've 2 users in my org: [User A] & [User B]

Assuming I've a Managed Package CustomObject: [abc__XYZ__c]

IMPORTANT:
  • [User A] - has been assigned a License of this Managed Package.
  • [User B] - DO NOT have a User License to this Managed Package.

Consider these 3 Visualforce Pages & respective Apex Classes:
  • Test1
  • Test2 / Test2Controller
  • Test3 / Test3Controller

Code for the Pages/Classes is as follows:

Test1 VF Page:
<apex:page standardController="abc__XYZ__c">
    <apex:pageBlock>
        <apex:pageBlockSection columns="1">
            <apex:outputField value="{!abc__XYZ__c.Name}" />
            <apex:outputField value="{!abc__XYZ__c.abc__TotalAmount__c}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Test2 VF Page:
<apex:page controller="Test2Controller">
    <apex:pageBlock>
        <apex:pageBlockSection columns="1">
            <apex:outputText value="{!mysObjVar['Name']}" />
        <apex:outputText value="{!mysObjVar['abc__TotalAmount__c']}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Test2Controller APEX Class:
public with sharing class Test2Controller {
    public abc__XYZ__c mysObjVar { get;set; }

    public Test2Controller() {
        mysObjVar = new abc__XYZ__c();
        abc__XYZ__c[] b = [select Id, name, abc__totalamount__c from abc__XYZ__c where id =: ApexPages.currentPage().getParameters().get('id')];
        if (b.size() > 0)
            mysObjVar = b[0];
    }
}



Test3 VF Page:
<apex:page controller="Test3Controller">
    <apex:pageBlock>
        <apex:pageBlockSection columns="1" title="via sObject">
            <apex:outputText value="{!mysObjVar['Name']}" />
            <apex:outputText value="{!mysObjVar['abc__TotalAmount__c']}" />
        </apex:pageBlockSection>
        <apex:pageBlockSection columns="1" title="via Custom">
            Name: <apex:outputText value="{!sName}" />
            Total: <apex:outputText value="{!sTotal}" />
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Test3Controller APEX Class:
public with sharing class Test3Controller {
    public sObject mysObjVar { get;set; }
    public string sName { get;set; }
    public decimal sTotal { get;set; }

    public Test3Controller() {
        mysObjVar = Schema.getGlobalDescribe().get('abc__XYZ__c').newSObject();
        string recordid = ApexPages.currentPage().getParameters().get('id');
        sObject[] b = database.query('select Id, name, abc__TotalAmount__c from abc__XYZ__c where id =: recordid');
        if (b.size() > 0) {
            mysObjVar = b[0];
            sName = (string) b[0].get('Name');
            sTotal = (decimal) b[0].get('abc__TotalAmount__c');
        }
    }
}



Now:
  • If I access, via [User A]: Test1, Test2, and Test3 VF pages in browser with a valid Record Id, I get ALL these 3 VF pages show me Values for the fields I have shown.
  • If I access, via [User B]:
    • Test1 VF page show "Insufficient Privileges" error.
    • Test2 VF page show me Empty Page.
    • Test3 VF Page show me Empty Section when access via sObject[fieldName] BUT show me Actual Values in field in a section when I use String Property to fetch the field values (image attached)
User-added image


And so my question, how can a User who does not have a License to the Package be able to Fetch Data, and be able to display it to user via a Custom Property, but not via an sObject instance variable or direct object instance variable?

To me it seems like a big Bug in platform! Ideally I don't think it should every allow reading of Data to any User who does not have access to the Managed Package via Licenses and Describe() Calls should respect that, shouldn't they?
  • February 05, 2015
  • Like
  • 2
I've a Custom Object, and it has 3 RecordTypes. In my app, I've added an override for the "New" action link with a Visualforce Page.

Now in app (from desktop browser) the New button redirects and open RecordType wizard first, and then when clicked COntinue on screen, it opens my VF page.

In Salesforce1 app, when New button is clicked, it opens RecordType selection wizard page, but when clicked Continue, it opens my VF page "without" passing any RecordType selection value in the URL.

How do we tackle this in Salesforce1? I read the documentations, it says Link Overrides does not work in Salesforce1, but then why does it open our override when we clicked New button? I though since overrides are not supported in Salesforce1, it will simply detect and open Standard New interface part of Salesforce1 interface automatically.

Can anyone here suggest how to I make my New button work efficiently in both environments?
  • April 23, 2014
  • Like
  • 1
for (ContentVersion cv : trigger.new)
{
	if (cv.Contact__c != null && cv.Hold__c == true)
	{
		cv.TagCsv = 'Hold';
	}
	system.debug('@@ cv.TagCsv : ' + cv.TagCsv);
}

This code has been put on ContentVersion, Before Update trigger. And this debug line: system.debug('@@ cv.TagCsv : ' + cv.TagCsv);, also shows that TagCsv field has been put value into it successfully, but when I go into the Content record, the Tags field is coming in Empty.

 

Is this some kind of Bug ?

  • August 14, 2012
  • Like
  • 1

Every time I try to run this query i get only 2 results:

 

Attachments[] records = [Select Name, ParentId, OwnerId, Id, Body, ContentType, Description, IsPrivate From Attachment Where Parent.Type IN ('File__c') AND Owner.IsActive = true];

 

I know including "Body" field will limit number of records returned in Eclipse to only 1, BUT I'm using this query in APEX class and in Debug Log as well but I'm only able to read 2 record everytime, but the total count of Attachment record returned from this query Should be 4152 records which it is not giving.

 

Is it some Bug?

  • March 03, 2012
  • Like
  • 1
Hi,

I'm looking for a way to get All Columns present in a Custom View. I've implemented Custom Views on a List View Page of Records. I was able to display and filter records based on the View selected from the Dropdown, but since it is a VF page, I've static Columns defined in pageDatatable. So now, I need to know how can I create a pageBlockTable with n-Number of columns dynamically, based on the View Selected.

Any idea to any one, in which direction I should proceed further?

Thanks.
  • December 01, 2008
  • Like
  • 1
Hi,

I'm trying to show or hide a PageBlock on click of a commandbutton.

here is what i'm trying to do:

Button Code:
Code:
<apex:commandButton action="{!processSelected}" value="Process Selected" reRender="pageBlock, pageBlockProcessed" status="AjaxStatus"></apex:commandButton>

 
My Page Code:
Code:
<apex:pageBlock title="Selected Records" id="pageBlockProcessed">
    <apex:pageMessages ></apex:pageMessages>
    <apex:pageBlockTable value="{!selectedContacts}" var="l" rendered="{!NOT(ISNULL(selectedContacts))}">
        <apex:column value="{!l.Name}"></apex:column>
        <apex:column value="{!l.Email}"></apex:column>
        <apex:column value="{!l.Phone}"></apex:column>
    </apex:pageBlockTable>
</apex:pageBlock>

 "selectedContacts" is populated with Selected Contacts on CommandButton click. But the Page Block (pageBlockProcessed) does not show or hide when i populate and hide data in "selectedContacts" :(.


My Full page layout is something like this:
Code:
<apex:page controller="Contacts">
<apex:sectionHeader title="Contact List"></apex:sectionHeader>
<apex:form >
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock title="" id="pageBlockFilter">
... Some VF Code ...
<apex:commandButton action="{!processSelected}" value="Process Selected" reRender="pageBlock, pageBlockProcessed" status="AjaxStatus"></apex:commandButton>
</apex:pageBlock>
<br/>
<div style="width:100%;display:{!IF(ISNULL(selectedContacts),'block','none')}">
<apex:pageBlock title="Selected Records" id="pageBlockProcessed">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockTable value="{!selectedContacts}" var="l" rendered="{!NOT(ISNULL(selectedContacts))}">
<apex:column value="{!l.Name}"></apex:column>
<apex:column value="{!l.Email}"></apex:column>
<apex:column value="{!l.Phone}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</div>
<apex:pageBlock title="" id="pageBlock">
<apex:pageBlockTable value="{!contacts}" var="c" rendered="{!NOT(ISNULL(contacts))}" rows="{!pageSize}">
... Some VF Code ...
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 
The code in RED above needs to Be Shown and Hidden on click of "Process Selected" button.

CAN ANYONE help me here ? ... plz ...

At this point the page BLOCK is displaying At All times, selectedContacts is able to only hide the pageBlockTable, as and when there is data in the list. But i want FULL page block to Show and Hide with presence of data in selectedContacts.

- Varun
  • November 21, 2008
  • Like
  • 1
I have a lightning component that implements lightning:actionOverride how do I get the recordId of the parent when the action is triggered from a related list?
Javascript exception is happening when we are using 3 dependant picklists (One Main picklist, One Picklist dependant on the Main Pick List and One more dependant on the Second Pick List) in a Visual Force Page with standard controller extension. This issue is happening only in Chrome browser. The Issue we are getting is "picklist4.js:21 Uncaught TypeError: Cannot read property 'length' of undefined
    at HTMLSelectElement.picklist.onControllerChange (picklist4.js:21)". Because of this error, the dependant picklists are not getting enabled on selection of items in the Main Pick List.
I'm getting multiple system error dialog when trying to execute System Events in Lightning Components (in Console Navigation app).

I've tried a link action and action button, and both return errors. My code is as follows:

Error in using force:navigateToSObject :
On a Link onclick, I'm opening the record's detail view by using force:navigateToSObject event as follows:
var navEvt = $A.get("e.force:navigateToSObject"); 
navEvt.setParams({ "recordId": recordId }); 
navEvt.fire();


And it throw following 2 error dialog, dialog 1 appear first, and then dialog 2 show up after clicking OK on dialog 1:
Error dialog 1:
Uncaught Error in $A.getCallback() [Cannot read property 'setParams' of undefined] throws athttps://pk1-dev-ed.lightning.force.com/auraFW/javascript/h_soHR8Rt2_c3cVcuaSlUA/aura_proddebug.js:18473:9Object.fireEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:159:16 Object.fireTranslatedEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:146:22 Object.fireTranslatedStateEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:177:18 Object.force:navigateToSObject()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:214:18 Object.handleSimpleTranslation()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:135:20


Error dialog 2:
Access Check Failed! EventService.getEventDef():'markup://force:navigateToState' is not visible to 'markup://pk1:ListContactRecord {3:1967;a}'. Object.fireEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:157:22 Object.fireTranslatedEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:146:22 Object.fireTranslatedStateEvent()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:177:18 Object.force:navigateToSObject()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:214:18 Object.handleSimpleTranslation()@https://pk1-dev-ed.lightning.force.com/components/force/navEventManager.js:135:20
Error in using force:editRecord :
On a Link onclick, I'm opening edit dialog for the record by using force:editRecord event as follows:
var editRecordEvent = $A.get("e.force:editRecord"); 
editRecordEvent.setParams({ "recordId": recordId }); 
editRecordEvent.fire();



This results in single error dialog, but it still opens up the Edit Modal dialog as well. Edit Record modal appears behind the System Error modal dialog with following error details:
 
Access Check Failed! AttributeSet.get(): attribute 'editOverriddenKeyPrefixes' of component 'markup://one:consoleLayoutContainer {1:0;p}' is not visible to 'markup://one:consoleLayoutContainer {1:0;p}'. Object.hasEditOverride()@https://pk1-dev-ed.lightning.force.com/libraries/one/centerStageLibrary/Record.js:154:29Object.handler_force_editRecord()@https://pk1-dev-ed.lightning.force.com/libraries/one/centerStageLibrary/Record.js:105:28 eval()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:1921:29Object.handleCenterStageEvent()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:1907:17handleCenterStageEvent()@https://pk1-dev-ed.lightning.force.com/components/one/consoleLayoutContainer.js:194:16



I'm running clueless as both these Edit and Record View actions work fine in Lightning Component, when the Lightning App is using Standard Navigation, and breaks with errors in Lightning Appwith Console Navigation in it.

Is there any other way available for accessing record view or edit? I've already tried following:
  1. Setting a direct URL = #/sObject/<recordId>/view
  2. Setting a direct URL = #/sObject/<recordId>/edit
Though, [1] URL works fine and opens record, but [2] still throws same error which happens on force:editRecord event navigation. Plus, I don't think setting direct URL formatting is ideal way to code, it seems more hackishh kind of way to me. Though I surely need some help if someone has ideas on this.
  • February 14, 2017
  • Like
  • 0
We have created a custom Lightning app together Lightning Component Tab. As the tab was only visible in Lightning Experience and we need it to be visible in Classic, we created a custom VisualForce page that referenced our Lightning app. After adding the VF page tab to the menu, it appears correctly in Classic. However, now in Lightning Experience it shows up twice! Once for the VF Page Tab and once for Lightning Component Tab.

This is obviously wrong. I have unchecked ''Available for Salesforce mobile apps and Lightning Pages" tickbox on Visualforce Page.
User-added image

How to hide VF Tab from Lightning so it's not being duplicated in Lightning but still shows in Classic?

PS. We don't really want to remove the Lightning Component Tab as it loads faster.

Thanks,

Chris
I've created an Apex trigger on CustomObject_A__c, it is working fine when I clone a record in Classic Aloha interface, but the trigger does not return True for isClone() sObject function call, when I try to clone record in Lightning Experience.
 
trigger CustomObjectTrigger on CustomObject_A__c (before insert, before update)
{
    if (trigger.isBefore)
    {
        for (CustomObject_A__c a : trigger.new) {
            system.debug('@@ (isCloned): '+a.isClone());
            system.debug('@@ (clonedFrom): '+a.getCloneSourceId());
        }
    }
}

Debug output in Lightning Experience:

10:01:02.0 (26981116)|USER_DEBUG|[11]|DEBUG|@@ (isCloned): false
10:01:02.0 (27065138)|USER_DEBUG|[12]|DEBUG|@@ (clonedFrom): null

Debug output in Classic Aloha:

10:06:54.0 (7464346)|USER_DEBUG|[11]|DEBUG|@@ (isCloned): true
10:06:54.0 (7542087)|USER_DEBUG|[12]|DEBUG|@@ (clonedFrom): a0b9000000FxSYMAA3

As you can see, the bug validates my cause that trigger was able to identify properly a Cloned record in Classic interface but not in Lightning Experience. Is this a Known Bug/Issue?

I've found that this isClone() function was introduced in Winter '16 - isClone function added to apex code in Release Notes also, when we scroll down to Bottom of these release notes, we can find this Idea mentioned as Delivered - Idea - Detect isClone() within Trigger
 
  • November 08, 2016
  • Like
  • 0
Following up on the provided example from documentation - Create Components for Lightning for Outlook (Beta), I am able to display the selecetd email's data in html form, but when I try to read the same variables in INIT JS controller method, I get undefined/null values.

sampleOutlookComponent.cmp
<aura:component implements="clients:availableForMailAppAppPage,clients:hasItemContext">

    <aura:attribute name="source" type="String" access="global" />
    <aura:attribute name="people" type="Object" access="global" />
    <aura:attribute name="subject" type="String" access="global" />

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <div id="content">
        <h1><b>Email subject</b></h1>
        <span id="subject">{!v.subject}</span>

        <h1>To:</h1>
        <aura:iteration items="{!v.people.to}" var="to">
            {!to.name} - {!to.email} <br/>
        </aura:iteration>

        <h1>From:</h1>
        {!v.people.from.name} - {!v.people.from.email}

        <h1>CC:</h1>
        <aura:iteration items="{!v.people.cc}" var="cc">
            {!cc.name} - {!cc.email} <br/>
        </aura:iteration>

        <span class="greeting">{!v.greeting}</span>, {!v.subject}!
    </div>
</aura:component>

sampleOutlookComponentController.js
({
    doInit : function(component, event, helper) {
        var sc = component.get('v.source');
        var sb = component.get('v.subject');
        var pp = component.get('v.people');
        console.log('== people [S] == ');
        console.log('Source: '+sc);
        console.log('Subject: '+sb);
        console.log(pp);
        console.log('== people [E] == ');
    }
})

The console output from above code snippet is this:
== people [S] == 
Source: undefined
Subject: undefined
null
== people [E] ==

I am unable to figure out what I'm doing incorrectly to read the selected email's attributes? Though when I launch this component in sidebar I do get the displayed html render the values correctly like this:
 
Email subject
Another Email
To:
Varun C - testing@testing123.onmicrosoft.com
From:
Varun C - testemailfrom@yahoo.com
CC:

, Another Email!


What could be wrong in my doInit method code that I'm getting null values but when I put same attribute values in component html, and it renders the values correctly, could it be a bug or I'm missing something here?



 
  • October 14, 2016
  • Like
  • 0
I've installed an AppExchange package:
Salesforce Communities Management (for Communities with Chatter) - https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B5XHsEAN - The application Provider is "Salesforce".

In this package there is a particular report named as: CH T - Knowledgeable People Per Topic

When I try to read this report using following APEX code:
Reports.ReportDescribeResult descRes        = Reports.ReportManager.describeReport(r.Id);
I get a "Salesforce System Error", and this System error is not being trapped by any try/catch container. There is no issue if I try to read any other report.

Salesforce System Error: 1621110285-498685 (-1627279259) (-1627279259) 
An unexpected error has occurred. Your solution provider has been notified. (reports)



I'm unable to trap the error and this is breaking the full code. Can someone point me to understand why only this particular report cause trouble in Reading it? 

 
  • April 28, 2016
  • Like
  • 0
I've a Lightning Component that works fine in dev org but deployed in a managed package it throws Internal Server Error. I found another developer thread that has expereinced same kind of error with Lightning Component -
http://salesforce.stackexchange.com/questions/100990/an-internal-server-error-has-occurred-error-id-143631613-25605-15667340

I'm looking to find out if my issue is due to same and I've no idea what this Error ID means, no more details are shown.

My error details are:
An internal server error has occurred Error ID: 1288557852-29109 (-898570520)



 
  • December 05, 2015
  • Like
  • 0
Hi,

We are developing and supporting a managed package in AppExchange, which works with ContentVersion objects. Last 3 weeks we started to get strange notifications from the client organizations (at the same time it's interesting to note that we didn't get any complaints from them). And we've never got such notifications previously.

The issue looks like a compilation error in the codebase. We don't believe that it's possible because of our implementation, because our package is managed and, of course,it is compiled every time when we upload a new version. Also our current codebase in the development instance is still compilable and we didn't reproduce any compilation errors in test environments where we installed the same version as our customers have.

Moreover, there is a strange first line in the stack trace, which is included in the notification:
System.test: line 32, column 17: Invalid type: Component.Apex.Page
It references to the System class, not to one of our classes. This fact makes us think that the problem is somehow related with the system changes.

We know that last 3 weeks Salesforce was delivering a new Winter 16 Release, and, maybe, the problem is somehow related with this fact, but we are not sure.

Here is full text of the typical notification:
Apex script unhandled trigger exception by user/organization: UserId/OrgId

TriggerForContentDocuments: execution of AfterUpdate

caused by: line 11, column 3: trigger body is invalid and failed recompilation: Dependent class is invalid and needs recompilation:
(package_name)
(package_name)
(package_name)
(package_name)
package_name.OneOfOurClasses: line 18, column 8: Dependent class is invalid and needs recompilation:
System.test: line 32, column 17: Invalid type: Component.Apex.Page

Maybe, someone of you met similar problems before or have any ideas what this issue may mean. Any help is appreciated. Thank you.

Hello,

We can add a datasource onto the attribute in the design resource, like this:
<design:attribute name="Name" datasource="value1,value2,value3" />

How can I use a dynamic datasource instead of hardcoding the values.

Thanks,

Devendra 

Hi All

I am getting Error Please select a choice while run the flow with Dynamic choice screen

User-added image