• Saku Erla
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 27
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi,

I would like to understand the way 'states' are retained across batches while using Database.Stateful.

Example, If I am using 'totalSum'  as variable to be maintained across batches, then I could do one of the following.  Which one of below is more optimal? does the SF makes sure that the 'serialization of execution' is done only when the Line 2 in option 2 used about to be executed?, 
if the serialization is across all the body of execution(), then option-1 and option-2 does not look too different.
 
//Option 1

execute (scope) {
   foreach(myObject__c obj: scope) {
       totalSum += obj.field_to_sum__c; //<== Line 1
   }
}
 
//Option 2

execute (scope) {
   Integer localSum = 0;
   foreach(myObject__c obj: scope) {
       localSum += obj.field_to_sum__c;
   }

 totalSum += localSum;  //<== Line 2
}

 
Hi, I tried to report this bug to salesforce, but was redirected here.
This is very likely internal salesforce issue.
When you try to do any operation with integer received from lightning component (@AuraEnabled), you got 
FATAL_ERROR|Internal Salesforce.com Error
 
public with sharing class TestController2 {
    @AuraEnabled
    public static integer getTestResult(integer pageNumber) {
        return pageNumber + 1;
    }
}


Full log included:
34.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
23:30:39.143 (143052245)|EXECUTION_STARTED
23:30:39.143 (143081946)|CODE_UNIT_STARTED|[EXTERNAL]|01pU0000001YzfB|TestController2.getTestResult
23:30:39.143 (143501666)|METHOD_ENTRY|[1]|01pU0000001YzfB|TestController2.TestController2()
23:30:39.143 (143599706)|SYSTEM_MODE_ENTER|false
23:30:39.143 (143634027)|SYSTEM_MODE_EXIT|false
23:30:39.143 (143644512)|METHOD_EXIT|[1]|TestController2
23:30:39.144 (144047168)|FATAL_ERROR|Internal Salesforce.com Error
23:30:39.144 (144066440)|CUMULATIVE_LIMIT_USAGE
23:30:39.144 (144066440)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

23:30:39.144 (144066440)|LIMIT_USAGE_FOR_NS|Vendavo|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

23:30:39.144 (144066440)|CUMULATIVE_LIMIT_USAGE_END

23:30:39.144 (144134140)|CODE_UNIT_FINISHED|TestController2.getTestResult
23:30:39.147 (147174875)|EXECUTION_FINISHED

Note that system.debug('pageNumber: ' + pageNumber); works. But all other integer operations fail.
Please advise how to circumvent this issue.
How can i make a mass Delete of orders?

The error is that i can't delete an active order, that's ok.

So the question is how can i deactivate multiple orders?
I tryed to change status like Status='a deactivated category status' but it doesn't work.

Thanks all

 
When I apply slds_theme styling in a component, the component styling seems to be overridden when used on a Communities page.  I am using the straight-up sample code from the SLDS.  Other SLDS styling is working just fine.  attached is the code and a screenshot of the component in communities (incorrect) and the same component on a Lighting Experience page (correctly styled)

The class is slds-theme--shade

Am I missing something about styling with SLDS in Communities?

code snipit
User-added image

User-added image
Hi, 

I'm the System Admin and one of the users (under Force.com - App Subscription User license) doesn't have the permission to read some standard objects (e.g. Orders). Can you change the type of user license once the user is created? If yes, how? Thank you.

Tom
  • August 30, 2016
  • Like
  • 1
I have a trigger on Lead after update that is checking for lead conversion status and then updating information from lead related object to Account and Opportunity. And a Test class for code coverage for the trigger.
When I am trying to deploy it to production it is failing with the error FATAL ERROR "Exception encountered while running Apex tests"Error on change set validation

There is no indication of the Exception cause. Anyone has encountered this before and any solution for this?
Hi,

When we try to migrate a trigger / class from sandbox to production, during validation process, the display changes to 'waiting' and then after a few seconds to 'Fatal Error'. Usually all the tests progress one by one, but now that is not happening. Any idea on what should be checked?

Thanks in advance

"Waiting" once we start validation

After a few seconds of waiting
Hi All,

I have a scenario where i have to pass one variable value from parent component to child component controller to perform further execution on the basis of that variable value which we passed from parent.

Please let me know the solution/syntax for the same.

Thanks,
Abhinav Sharma
Hey,

In VisualForce you can specify a HTML5 data attribute by adding a html tag to the front - e.g.
<apex:input html-data-attribute-name="some data"/>

We are looking at trying a lightning implementation, but similar functionality is cruitial if we are to proceed.  Is there a way to append a HTML5 data attribute to a lightning component - e.g.
<ui:inputText data-attribute-name="some data"/>

Cheers!
Hi, I tried to report this bug to salesforce, but was redirected here.
This is very likely internal salesforce issue.
When you try to do any operation with integer received from lightning component (@AuraEnabled), you got 
FATAL_ERROR|Internal Salesforce.com Error
 
public with sharing class TestController2 {
    @AuraEnabled
    public static integer getTestResult(integer pageNumber) {
        return pageNumber + 1;
    }
}


Full log included:
34.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
23:30:39.143 (143052245)|EXECUTION_STARTED
23:30:39.143 (143081946)|CODE_UNIT_STARTED|[EXTERNAL]|01pU0000001YzfB|TestController2.getTestResult
23:30:39.143 (143501666)|METHOD_ENTRY|[1]|01pU0000001YzfB|TestController2.TestController2()
23:30:39.143 (143599706)|SYSTEM_MODE_ENTER|false
23:30:39.143 (143634027)|SYSTEM_MODE_EXIT|false
23:30:39.143 (143644512)|METHOD_EXIT|[1]|TestController2
23:30:39.144 (144047168)|FATAL_ERROR|Internal Salesforce.com Error
23:30:39.144 (144066440)|CUMULATIVE_LIMIT_USAGE
23:30:39.144 (144066440)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

23:30:39.144 (144066440)|LIMIT_USAGE_FOR_NS|Vendavo|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

23:30:39.144 (144066440)|CUMULATIVE_LIMIT_USAGE_END

23:30:39.144 (144134140)|CODE_UNIT_FINISHED|TestController2.getTestResult
23:30:39.147 (147174875)|EXECUTION_FINISHED

Note that system.debug('pageNumber: ' + pageNumber); works. But all other integer operations fail.
Please advise how to circumvent this issue.
Hi,

I am trying to refer to image assets from Static Resources through the standard url format: /resource/<resource name> in lightning components. It works well hosting them in a lightning app, but it's 404 into Community Builder since it doesn't prepend /sfsites/c unlike what <ltng:require> does when loading scripts and styles (context-aware). Is there a workaround for this?

Regards,
Darryl
I have created a custom external Id field [Unique Case Sensitive] in a custom object. I have inserted two records having External Id data as 'abc123' and 'ABC123' .  while querying for 'abc123' I am getting both the records. But I want only 1 record whose external Id is 'abc123' How to over come from this Issue.  

My Query : SELECT * from customObject__c where externalSystemId__c = 'abc123' ;  

note: If I do the same in standard object only 1 record comes. 
  • March 16, 2015
  • Like
  • 1
Hi,

I'm currenty trying to master this use case:
Lets say we have an object and on the page we have the option to delete this object. Now the delete button gets clicked and a bootstrap modal pops up asking if this object really should be deleted. By clicking yes the object gets deleted.

My problem is to remember this clicked object so I know which one has to be deleted by clicking the modal yes button. 
So in a nutshell ... how can I pass the object id to a component parameter when the delete button gets clicked?

Thank you!

While creating a custom object, in object classification, we have this three options(either all enabled/disabled).
I want to know difference between these three.

Here is the image of object classification.
Object Classification

Hello everyone,

I have an Account table with a custom field with data type 'Picklist'.
What I want to do is, for each record in the account table I want the picklist value and also the label for that value.

Due to some limitations I can't execute the simple query ...
SELECT Custom_Field_1__c, toLabel(Custom_Field_1__c) FROM Account"

When I execute that query I get the error ...
INVALID_FIELD:
SELECT UCB_Specialty_1__c, toLabel(UCB_Specialty_1__c) FROM Account
^
ERROR at Row:1:Column:36
duplicate field selected: UCB_Specialty_1__c ].
caused by: AxisFault

If anyone knows a work around or a solution, I'd appreciate to hear about it.
Thank you.

Greetings,

Hamid

I've got a visualforce page the is outputting a data table with a list of accounts in the account hierarchy.  One of the columns displayed is the account record type.  We have translated the record type values in the translation workbench and they display correctly translated on the standard acccount page layout.  However, when we try to render them in a dataTable, they show the English values when a non-English user is logged in.  Anyone have any good workarounds for this?  Here is the code we are using:

 

<apex:column >
    <apex:facet name="header">{!$ObjectType.Account.Fields.Type.Label</apex:facet>
    <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value="{!pos.account.RecordType.Name}" />
</apex:column>

 

Hi,

 

How to sort the list  as case insensitive. I am used the method as

 

listname.sort();

 

It will sort the records. But it will display the records in sort order which are having caps lock as first letter. After that display's the records in sort order which are having small letters as first letter. Please help me how sort the list as case insensitivly.

 

Thanks,

Lakshmi.

Hello Everyone,

 

I am facing problem with translation. The issue, I have picklist with values. I have added translations for pick list values based on the language. The problem when i try to query or when i try invoke in formula field i getting actual value instead of traslation value.Can anybody help on this.

 

Regards,

Insane

Recently, I was writing some classes that needed to detect if the org they were in was a sandbox or not and determine which endpoint to call accordingly. Since there isn's an isSandbox method in Apex, I had to create my own. This will work in visualforce controllers/extensions and from standard classes. You can read the full details at http://www.ericsantiago.com/eric_santiago/2011/12/determining-salesforce-server-pod-and-if-sandbox-via-apex.html

 

Code as follows

 

public String currentPod { 
            String server;
            
            if (ApexPages.currentPage() != null){ //called from VF page
            		server = ApexPages.currentPage().getHeaders().get('X-Salesforce-Forwarded-To');
            } else { //called via standard class
            		server = URL.getSalesforceBaseUrl().getHost();
            }
            
            if ( server != null && server.length() > 0){
                server = server.substring(0 ,server.indexOf('.'));
                
            }
            return server ; 
   }

   public Boolean isSandbox {
            String pod = currentPod();
            if (pod != null && pod.length() > 0 && pod.toUpperCase().startsWith('C')){
                return true;
            }
            return false;
   }

 

Hi All,

 

I am trying to pull in the Account Owner's Name to a custom object using a formula. However just see an option for the Account Owner ID.

 

TIA

 

David

Hello All, 

Newbie here.  My question relates to insuring referential integrity among some custom objects.  I have created custom objects:

 

OrderItem //a detail on an Order (participates as such in a Master/Detail relationship to Order.)  OrderItem refers to a Product, and a quantity ordered for some requestedDate.  Ultimately, upon fulfillment it will be updated to reflect date fulfilled, quantity variances and the like.

 

Authorization //an independently persistent object that refers to an Account and a Product and contains a StartDate (and optionally an EndDate).  AProduct is said to be authorized at anAccount on aDate IFF there exists an Authorization referring to that Account and Product with a StartDate <=  aDate <= EndDate.

 

When constructing an Order (for some Account), one writes some number of OrderItems - each relating to some Product.

The referential integrity issue is that to be valid, an OrderItem should only refer to a Product which is Authorized for the Account on the OrderItem.requestedDate.

 

Now the easy way to make this work would be to Filter the list of Products shown to the user at OrderItem creation time.  But the filter functionality doesn't seem to be available for lookup items, only master/detail lookups.  Maybe this is due to the Beta status of the functionality, or maybe it has to do with my level of account - Not sure.

 

If someone can tell me how to get the filter working so that only valid choices are offered, that would be great.

 

But failing the capacity to filter, then I'd like to Validate the OrderItem against the Authorizations for the Account.  

For extra credit, there's also the fact that the set of Authorizations for an Account is actually the transitive closure of all Authorizations for that Account and it's Parent (recursively to it's highest level Parent).  

So - if someone has any words of wisdom (or even better) example code, I'd be grateful.  Especially if there's some way to make this work without getting into APEX and so on.  I'm a business level user.

Thoughts?

 

Thanks all,

SandwichMaven

 

So I just burned a couple of hours trying to figure out what was breaking in my code. I figured it out but I still don't understand what is happening. You can paste the code below into the system log and execute.

 

 

Boolean someNullBoolean;
Contact c = new Contact(LastName = 'lname');
c.HasOptedOutOfEmail = someNullBoolean;
//c.HasOptedOutOfEmail should be null as it was contructed as null and we are also assigning the value of null, right? WRONG!

system.debug(c);
//cool, the value of HasOptedOutOfEmail is displaying as null, that makes sense
system.debug('HasOptedOutOfEmail; ' + c.HasOptedOutOfEmail);
//wait, what?!? HasOptedOutOfEmail is now false? I thought we set it to null

//eh, none of this should matter right? let's try to insert this contact
insert c;

//aw snap,
//System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Email Opt Out: value not of required type: {0}: [HasOptedOutOfEmail]

Is this a bug, some expected behvior with booleans I don't understand, or am I in the matrix?

 

Thanks,

Jason

 

 

Message Edited by TehNrd on 08-18-2009 03:47 PM
  • August 18, 2009
  • Like
  • 1