• 3 Creeks
  • NEWBIE
  • 435 Points
  • Member since 2015

  • Chatter
    Feed
  • 12
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 82
    Replies

I'm loading 25 records from an excel file to the Opportunity object. There are fields with currency and fields with formulas for the fields with currency as well as fields with percentages. I seem to be having errors (for every single record) and most of them are because of the currency/formula/percentage fields. When inserting currency, is dataloader picky? Like there shouldn't be a dollar sign or commas, etc.?
 

I posted an image of an example of issues.

User-added image

 

Hello All,
map<id, account> am= new map<id,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am)
 i have executed this code script , its working fine , but i tryied to executed bellow code i am getting error , please help me
what is the issue
map<name, account> am= new map<name,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am);

Kindly help me with my doubt

Thanks :)
HI all,

Does anyone know if there is a way that when someone replies to an email related to an opportunity, that reply is then inputted into the opportunity as a note in salesforce?

We currently use google, and not outlook.

Thanks
I have followed all the directions, like this:  

https://help.salesforce.com/apex/HTViewSolution?id=000004931&language=en_US
https://developer.salesforce.com/forums/?id=906F00000008kFmIAI

... you get my point.  

When I change the Server Host to https://test.salesforce.com then go to the OAuth sign in and click sandbox I get the following error message:  error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

Therefore I tried the "Password Authentication" and put in my username/password (it still says https://test.salesforce.com in the Salesforce Login URL:)  

Thoughts? I've tried googling this issue and haven't seen anyone else encounter it.  If it means anything when I go back into settings, it will say "https://login.salesforce.com" if I do the exact process I outlined before.

Thanks - Sean
 
Good afternoon! I am new here and have little development experience. I am just looking for some direction on how to approach this issue.

I have a client that has purchased a marketing list. The list has 3100 leads and each lead has a unique code associated to it. We will be loading the list (and code) to Salesforce for the client. Once this is loaded, he is looking to do the following:

- The lead (person) is sent a mailing with the unique code (this is done automatically through another app). The lead would be directed to go to a web form to enter the code on the mailing. Once the code is entered /  submitted the lead information (name, address, etc.) from Salesforce will populate the form.

- Once the form is populated the lead will be able to either confirm (submit) the form or edit it and then submit it.

- If the lead does not have his or her code they should be able to enter their information manually

- Once submitted Salesforce will create a task for the lead owner to follow up with the lead.

- Once the lead submits the information on the webform the lead in Salesforce should flip to an prospect

I posted this question to the success community and it sounds like Web-to-lead will not fit all of the requirements for this request. Can someone point me in the correct direction to start on this project? Since web-to-lead isn't an option I was pretty sure this would be done with visualforce / apex. However, there is a whole lot of information covered in a general visualforce / apex book. What should I start with in order to create this?

Thanks so much!
Hi, 
I am new to apex and I am trying to query a dynamic field but I cannot get it to work.

I have a field named "relationship lead" on a custom object named "Prospects".

I want to be able to query the records based on the relationship lead. Is that possible?
 
public class ClientRelationshipController {
 Public List<Prospect__c> getProspects() {
        List<Prospect__c> Prospects=[Select Name,Property__c,Property_Name__c,Phone__c,Mobile__c,Prospect_Score__c,Email__c,Relationship_Lead__c
                                     From Prospect__c 
                                     Where Created_Date__c = Yesterday 
                                     And RecordType__c = 'Prospect'
                                     And Relationship_Lead__c = 'Dynamic Field'];
        return Prospects;
      }

 }


 
Hello,

Anyone can explain me about the  VF page tag: Action roller?
I know little bit about this tag but what is the main use in real time scenarios.


Thanks.....

 
  • April 18, 2016
  • Like
  • 0

Thanks to Mahesh D I was able to create a trigger that successfully performed the desired operation, however I have an additional question to the Community.

The code Mahesh helped me with is the following:

01//
02// Trigger on Task to populate the Subject.
03//
04trigger TaskTrigger on Task (before insert, before update) {
05    for(Task ta: Trigger.new) {
06        if(ta.Task_Results__c != null) {
07            ta.Subject += ' ('+ta.Task_Results__c + ')';
08        }
09    }
10}

What this code is doing is adding whatever a user selects in the picklist "Task Results" to the end of the Task Subject inside of parenthesis. The issue is I only want this trigger if the Subject is not equal to null. I tried adding code that said && ta.Subject != null on the "if" clause but that didn't work successfully. I have code written in my org that says if Subject = null then Subject = Task Result. What this is doing now with the code written above is duplicating the Subject if it's left blank.

Subject = Null
Task Result = Inbound Call

Hit Save, then 

Subject = Inbound Call (Inbound Call)

^ I do not want the duplicate value.

I've created a conf xml file, done the encrypting of the password, and I'm ready to run process.bat 

However, when I run it using the command: "C:\users\JJ\AppData\Local\salesforce.com\Data Loader\samples\conf\" auto_account_process-conf

I get the following:
C:\Users\JJ\AppData\Local\salesforce.com\Data Loader\bin>process.bat "C:\Users\JJ\AppData\Local\salesforce.com\Data Loader\samples\conf\" auto_accoun
_process-conf
Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -client       to select the "client" VM
    -server       to select the "server" VM
                  The default VM is client.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
C:\Users\JJ\AppData\Local\salesforce.com\Data Loader\bin>
 
Gurus, 
I encountered a very strange problem. Below is my simple trigger.  It looks for a lookup field custom field "Pelco_Account_Name__c " on quote object and if it null then populated the value of AccountId
trigger updateOpptyAccount on Quote (before insert) {
    for (Quote QuoteInLoop : Trigger.new){
       // if(QuoteInLoop.Opportunity.name != '.'){
        Boolean sMainAccount=QuoteInLoop.Main_Account__c;
        String sMainAccountId=QuoteInLoop.AccountId;
        String sQuoteAccountId=QuoteInLoop.Pelco_Account_Name__c;
        String sQuotePriceBook=QuoteInLoop.PriceBook2Id;
        String sQuoteId=QuoteInLoop.Id;
        String sOptyId=QuoteInLoop.OpportunityId;
        //checking if price book is attached to the quote
        //if no price book exist than defaulting the standard price book
        if(sQuotePriceBook == null)
        {
            QuoteInLoop.Pricebook2Id =[SELECT Id FROM Pricebook2 Limit 1].Id;
        }
       
        //if pelco quote account is null
        if (sQuoteAccountId == null)
        {
            QuoteInLoop.Pelco_Account_Name__c=QuoteInLoop.AccountId;
            sQuoteAccountId=QuoteInLoop.AccountId;
        }
        
     }//closing forLoop
 }//closing trigger updateOpptyAccount
This trigger does not work if I remove AccountName field from the quote page layout. As soon as I put the field back it works.  I disable all the workflow rules and approval, still the problem persist.

Any comments/suggestions?

Thanks, 
Gaurav
Hello,

I am looking for tool, probably one which is similar to data loader do achieve below use case.

> I want to export or save rows of few tables from  salesforce
> I the data should be save once in every week for example every sunday at midnight
> As the size of data will be around 1GB each time
> I want to save only lasterst 5 or 10 csv file.

Also when the data loader is uesd, where is the data stored.
 
  • August 24, 2015
  • Like
  • 0
I'm writting a unit test on apex snippet that restricts contact by name or last name to be specific. I'm getting error "Invalid type: database.InsertResults" on line 18. Thanks in advance.
 
@isTest
public class TestRestrictContactByName {
 	
    @isTest static void TestInvalidName() {
        // Test data setup
        // Create empty list for contacts
        List<Contact> contacts = new List<Contact>{};
        
        //Iterate over each contact
        for(Integer i=0; i<200; i++){
            Contact ct = new Contact(LastName='INVALIDNAME' + i);
            contacts.add(ct);
        }
        
        // Perform test
        Test.startTest();
        insert contacts;
       	Database.InsertResults result = Database.insert(contacts, false);
        Test.stopTest();

        System.assert(!result.isSuccess());
        System.assert(result.getErrors().size() == 200);
        System.assertEquals('The Last Name "'+contacts.LastName+'" is not allowed for DML',
                             result.getErrors()[0].getMessage());
    }	
}

 
I have noticed that there is some strange behavior where standard SF modal dialogs do not display after a LWC component is used that uses the lightning design system modal and a custom CSS via lightning/platformResourceLoader.

I have a LWC component that comes up in the Lightning Design System's modal (https://www.lightningdesignsystem.com/components/modals/#site-main-content). The LWC component loads a css file from static resources:
 
import { loadStyle } from 'lightning/platformResourceLoader';
...
 import STAT_RES from '@salesforce/resourceUrl/StaticResources';
...

renderedCallback(){ 
        loadStyle(this, STAT_RES + '/styles.css').then(()=>{
            console.log("Styles loaded");
        }).catch(error=>{ 
            console.error("Error in loading styles");
        });
    }
This modal works fine, but when the users closes the modal, the CSS from static resources seems to interfer with standard SF modal dialogs.

For example, if my LWC component is used on the Lead screen, once it is closed, the standard modal dialog that should come up when the Convert button is pressed does not display.  Instead, the bowser window gets shaded (as it should when a modal is on the screen) but the actual modal dialog box does not appear.

To fix it, the user has to hit the refresh button.

I always know that the screen is in the strange state because I will see caret characters (^) in certain spots on the screen:

Carets chars

I ue Chrome browser primarily but I have also seen this in Firefox.  Anyone else experience this?  

Thanks
 
Any one know why I cannot save a new currency locale?  I am logged in as a system admin with customize application rights, when I change the currency locale to a new value and click save nothing happens...no error message, no indication that the save was successful, no feed back at all.  Note that I am not trying to enable multi currency, just change the org wide currency locale to test some code changes.
Working with the Metadata Class introduced with ver 40, is there a way to dynamically build a list of Object names to be used in Metadata.Operations.retrieve?  The full names formatted in the way that Metadata.Operations.retrieve wants them are not found in the results of a Schema.getGlobalDescribe() so I am wondering if there is some where else to get this.

A use case would be displaying a list object names to the user of the objects that a custom button can be added to.

Thanks
I am using a html-data- attribute to get the field name when looping through a fieldset:
<apex:repeat value="{!$ObjectType.My_Object__c.FieldSets.Header}" var="f">
   <apex:outputField value="{!showFieldSet[f]}" html-data-FieldName="{!f}"/>
</apex:repeat>
Which gives me the following HTML for most fields:
<span data-fieldname="MyField__c">Something Important</span>
But in other cases, the data-fieldname seems to be just ignored and is not there.  The ones that are ignored, as far as I can tell, seemed to be fields that are either of type currency or percentage...so fields that are auto formatted by visualforce when displayed.   Has anyone else come across this and know of a fix or work around?

Thanks



 
I am having an issue with this version of Eclipse after the force.com plugin is installed....when ever I make a change to a file and click the save icon, I immediately get a "File only saved locally message...".   Looking at the Force.com IDE Log Viewer within Eclipse, each time I open up a file from the project to edit, 2 messages are logged:

User-added image

Both Force.com => Save to Server and Force.com => Refresh from Server on an individual project file work.

Does anyone have any ideas on what is going on and how to fix it?  Thanks
I am seeing some issue with Process Builder and I just spent a lot of time testing it for a project that I am working on.  I am making this post for a couple reasons. First someone else my benefit from the time I spent testing and second, someone may have figured out what I have not been able to.  The project involves using information from a Contact associated with a Case to use as input to an invocable Apex method when the Case's Status is changed to 'Closed.'  Although this specific example deals with a parent record of the case object, I assume that the issues that I am seeing would be the same with any parent child relationship.

The Process Builder flow will consist of a simple set of criteria to determine if the case status has been changed and if the new status is closed.  If that criteria is met, the flow action will then use information from the associated contact record.

The issue does not seem to be with my Apex classes or invocable methods as I have been able to replicate the issue even when not calling any Apex.  To test Process Builder, I created a simple process that copies the associated Contact's email address to the Description field on the Case when the case status is changed to Closed.

The first thing that seems odd to me about Process Builder is that there are two ways to reference fields of associated parent records:

The first gives you a reference like this [Case].ContactEmail.  
User-added image

The second give your a reference like this [Case].Contact.Email.
User-added image

I tested both of these ways of referencing the parent field and neither one of them seems to work completely.  

My testing scenarios tested with three types of cases:
Scenario 1: Cases where there was a contact associated with it and the email field of the contact had an email address in it.
Scenario 2: Cases where there was a contact associated with it but the email field on the contact was blank
Scenario 3: Case that had no contact associted with them

With the Process Builder flow activated and for each of the above three scanrios, I test to see if the following worked correctly.
1. Can you successfully save a new scenario 1, 2 and 3 case with no flow errors.
2. When manually changing that status of a single case to 'Closed', will the flow trigger when it should and not trigger when it should not without any flow errors
3. When performing a bulk change (I used Data Loader) to change case statuses to Closed, will the flow trigger when it should and not trigger when it should not without any flow errors.

The Process Builder criteria was as follows:

Field                                                                     Operator             Type             Value
(One of the two ways to reference Contact email)     IS NULL             BOOLEAN     FALSE     AND
[Case].Status                                                        IS CHANGED     BOOLEAN     TRUE      AND
[Case].Status                                                        EQUALS             PICKLIST     CLOSED

Here are the results of my testing:

Process Builder Criteria = [Case].Contact.Email AND Flow Action using [Case].Contact.Email    
    Scenario 1: Contact is associated with Case and contact email address is filled in:
        Can save new Case? Yes
        Single manual status change: Success - Contact's email address copied to case description field
        Bulk status change: Success - Contact's email address copied to case description field
    Scenario 2: Contact is associated with Case, but email address is null:
        Can save new Case? Yes
        Single manual status change: Failed - Flow error received
        Bulk status change: Failed - Flow error received
    Scenario 3: No Contact associated with case:
        Can save new Case? No - Flow error received
        Single manual status change: Failed - Flow error received
        Bulk status change: Failed - Flow error received 

Process Builder Criteria = [Case].ContactEmail AND Flow Action using [Case].ContactEmail
    Scenario 1: Contact is associated with Case and contact email address is filled in:
        Can save new Case? Yes
        Single manual status change:  Success - Contact's email address copied to case description field
        Bulk status change: Failed - Workflow did not fire. Email NOT copied to Case Description field, but no flow error
    Scenario 2: Contact is associated with Case, but email address is null:
        Can save new Case? Yes
        Single manual status change: No Flow Error Message
        Bulk status change:  No Flow Error Message
    Scenario 3: No Contact associated with case:
        Can save new Case? Yes
        Single manual status change: No Flow Error Message    
        Bulk status change: No Flow Error Message

I also tested the criteria where there was an additional criteria line that tested if [Case].contactId was not null but got flow errors and tested criteria with the following formula criteria:

NOT(ISNULL([Case].Contact.Id)) && 
NOT(ISNULL([Case].ContactEmail)) &&
ISPICKVAL([Case].Status, 'Closed')  &&
PRIORVALUE([Case].Status)  <> 'Closed'

and that did not work either.

So, based on my testing, you cannot ever use  [Case].Contact.Email because the user will get flow errors.  Using  [Case].ContactEmail works, but users must know that bulk updates will not trigger flows.  Has anyone else come up with a completely working set of criteria for this type of scenario?

I checked known issues for process builder and did not see anything that matched the situation.

Thanks
Does anyone know if I create a Salesforce Site and associate a VF page with it, can I retrieve the site's public URL given the VF page name using SOQL? Thanks
I posted this a week or two ago and got no response so posting again in case anyone has any insight or maybe someone from Salesforce can take a look:

I am encrypting and decrypting a string and using a portion of the current user's Id as the seed:
 
public static String encrypt(String s) {
   system.debug( 'In encrypt, user id = ' + UserInfo.getUserId() );
    blob eKey = Blob.valueOf(  String.valueOf(UserInfo.getUserId()).left(16) );
    return EncodingUtil.base64Encode( Crypto.encrypt('AES128', eKey, eKey, blob.valueof(s)) );
}
 
....
 
public static String decrypt(String s) {
   system.debug( 'In decrypt, user id = ' + UserInfo.getUserId() );
    blob eKey = Blob.valueOf(  String.valueOf(UserInfo.getUserId()).left(16) );
    return Crypto.decrypt('AES128', eKey, eKey, EncodingUtil.base64decode(s)).toString();
}
Then I have a test that will call these methods as two different users:
 
static testMethod void myTest() {
   String s1 = 'important Information';
   String s1Encrypt = encrypt( s1 );
   String s1Decrypt = decrypt( s1Encrypt );
 
   system.runAs( TestDataFactory.aDifferentUser()  ) {
      String s2 = 'more important Information';
      String s2Encrypt = encrypt( s2 );
      String s2Decrypt = decrypt( s2Encrypt );
   }
}

And gives me this output:
 
DEBUG|In encrypt, user id = 00536000000g6InAAI
DEBUG|In decrypt, user id = 00536000000g6InAAI
....

DEBUG|In encrypt, user id = 00536000001sJvCAAU
DEBUG|In decrypt, user id = 00536000001sJvCAAU

But also errors out with "System.SecurityException: Given final block not properly padded" on line 9 in the middle box: String s2Decrypt = decrypt( s2Encrypt )  which usually means that the seed used to encrypt and decrypt where not the same key.   From the debug statement, it looks like they are so I am wondering if something is not respecting the user id given by system.runAs().

For the now I got around the issue by adding an if statement that looks at Test.isRunningTest() and if so just uses a static string as the key, but I would like to see if anyone has seen this before.

Thanks
I am encrypting and decrypting a string and using a portion of the current user's Id as the seed:
public static String encrypt(String s) {
   system.debug( 'In encrypt, user id = ' + UserInfo.getUserId() );
	blob eKey = Blob.valueOf(  String.valueOf(UserInfo.getUserId()).left(16) );
	return EncodingUtil.base64Encode( Crypto.encrypt('AES128', eKey, eKey, blob.valueof(s)) );
}

....

public static String decrypt(String s) {
   system.debug( 'In decrypt, user id = ' + UserInfo.getUserId() );
	blob eKey = Blob.valueOf(  String.valueOf(UserInfo.getUserId()).left(16) );
	return Crypto.decrypt('AES128', eKey, eKey, EncodingUtil.base64decode(s)).toString();
}
Then I have a test that will call these methods as two different users:
static testMethod void myTest() {
   String s1 = 'important Information';
   String s1Encrypt = encrypt( s1 );
   String s1Decrypt = decrypt( s1Encrypt );

   system.runAs( TestDataFactory.aDifferentUser()  ) {
      String s2 = 'more important Information';
      String s2Encrypt = encrypt( s2 );
      String s2Decrypt = decrypt( s2Encrypt );
   }
}
And gives me this output:
DEBUG|In encrypt, user id = 00536000000g6InAAI
DEBUG|In decrypt, user id = 00536000000g6InAAI

....

DEBUG|In encrypt, user id = 00536000001sJvCAAU
DEBUG|In decrypt, user id = 00536000001sJvCAAU

But also errors out with "System.SecurityException: Given final block not properly padded"   which usually means that the seed used to encrypt and decrypt where not the same key.   From the debug statement, it looks like they are so I am wondering if something is not respecting the user id given by system.runAs().

For the now I got around the issue by adding an if statement that looks at Test.isRunningTest() and if so just uses a static string as the key, but I would like to see if anyone has seen this before.

Thanks
Is this the expected behavior of the function containsOnly()?
String foo = 'garbage';		
foo.containsOnly('junk');     //This returns false

String foo = '';		
foo.containsOnly('junk');      //This returns true

system.assertEquals(foo, 'junk');   //This will fail
Seems like a bug but maybe I am missing something.
 
Hi -

I am wondering what the best practices are when trying to determine all objects that reference another object, including those objects that are reference it generically.   My scenario is that I am trying to determine all objects, whether standard or custom, that have a child relationship with the Case object. I have a method that does a getGlobalDescribe() to retrieve all sObjects and then loops through them to determine which objects have a childRelationship with Case.  Here is the method:
 
public static Map<String, String> getCaseRelationships() {
		Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
		Schema.SObjectType c = Case.sObjectType;	
		Map<String, String> rObjs = new Map<String, String>();
		
		for (String s : gd.keySet()) {
			if ( gd.get(s).getDescribe().isAccessible() && gd.get(s).getDescribe().isQueryable() && !gd.get(s).getDescribe().isDeprecatedAndHidden() ) {
				for (Schema.ChildRelationship sC : gd.get(s).getDescribe().getChildRelationships()) {
					if (sC.getChildSObject() == c) {
						rObjs.put( String.valueOf(sC.getField()), String.valueOf(gd.get(s).getDescribe().getLocalName()) );
					}
				}
			}			
		}
		return 	rObjs;
	}


Works fine except for sObjects like RecordType.   If there are case record types, RecordTypeId, shows up on the case object with Type = "Reference", but will not be returned as an object with a child relationship to case by getChildRelationship().  I assume this is because RecordType is used to hold the record type references for all sObjects, so instead of having a CaseId field, it has a sObjectType field that indicates if the recordType is associated with Case.

My question is, what is the best practices for dynamically finding ALL sObject that have child relationships with Case, including those like RecordType?

Thanks
 
Hi -

I am wondering what the best practices are when trying to determine all objects that reference another object, including those objects that are reference it generically.   My scenario is that I am trying to determine all objects, whether standard or custom, that have a child relationship with the Case object. I have a method that does a getGlobalDescribe() to retrieve all sObjects and then loops through them to determine which objects have a childRelationship with Case.  Here is the method:
 
public static Map<String, String> getCaseRelationships() {
		Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
		Schema.SObjectType c = Case.sObjectType;	
		Map<String, String> rObjs = new Map<String, String>();
		
		for (String s : gd.keySet()) {
			if ( gd.get(s).getDescribe().isAccessible() && gd.get(s).getDescribe().isQueryable() && !gd.get(s).getDescribe().isDeprecatedAndHidden() ) {
				for (Schema.ChildRelationship sC : gd.get(s).getDescribe().getChildRelationships()) {
					if (sC.getChildSObject() == c) {
						rObjs.put( String.valueOf(sC.getField()), String.valueOf(gd.get(s).getDescribe().getLocalName()) );
					}
				}
			}			
		}
		return 	rObjs;
	}
Works fine except for sObjects like RecordType.   If there are case record types, RecordTypeId, shows up on the case object with Type = "Reference", but will not be returned as an object with a child relationship to case by getChildRelationship().  I assume this is because RecordType is used to hold the record type references for all sObjects, so instead of having a CaseId field, it has a sObjectType field that indicates if the recordType is associated with Case.

My question is, what is the best practices for dynamically finding ALL sObject that have child relationships with Case, including those like RecordType?

Thanks
 
I have a managed packaged that is installed in an unlimited edition sandbox.  When a user with a system admin profile accesses the application, they receive a Insufficient Privileges error when the code makes a call to Schema.describeSObjects(). 

The user is using the standard System Admin profile, not one cloned from the standard System Admin profile.

I have not been able to replicate the issue in my own environments.

Does anyone have any idea of what might be going on?

Thanks
Seems to be a bug here since Winter 16 release.  Click on the Change Log Level menu item of Debug drop down menu and the Change log level come window comes up with a perpetual "Loading" message....

Anyone else experiencing this?

User-added image
Hello -

We have a new AppExchange tool that helps companies that use Case Queues manage them more effectively.  The tool will be released in the coming weeks and is currently fully functional and tested.  It has also already passed the Salesforce security review.  We are looking for one or two Salesforce orgs to help pilot the tool. 

The tool has a number of features, including:
- Allowing support workers that monitor case queues for incoming cases to quickly see when new cases come in
- Take or assign ownership of one or many cases with minimal mouse clicks
- Graphical representation of your org's queues showing how queues compare across the current day and across previous days

The tool installs via a Salesforce package very quickly and there is no development work needed and very minimal configuration to get the tool working in a Salesforce org.

If you think your company may be interested in piloting this tool, please contact me at scott@3creekstech.com for additional information.  Thank you!


 
I am creating a managed package and having trouble when installing the managed packaged into a newly-minted org.  Here is what is happening...

As you would expect, the managed package I am creating contains test methods.  A couple of these test methods have the OnInstall=true designation so that the package install will fail if these test methods do not pass.  As part of the data set up for the test methods, they create a couple Users in the User Object.  All of the test methods pass in the dev org that the package is created in.  

When I try to install the package in a new test org, the package install fails due to the Oninstall=true methods not passing.  The message indicates a DML error on the User field digestFrequency.  The message goes on to indicate that the field cannot be updated because the feature has not been enabled.  

The feature it is refering to I am assuming is Chatter, which indeed has not been enabled in the test org.  The test methods that create the users, do not reference digestFrequency or any other Chatter attribute that I can tell.

The odd thing is that Chatter is not enabled in the dev org that the package was created in either, but yet the tests pass there.

When I enable Chatter in the test org, the package installs without any issue.

Any help would be appreciated.  

Thanks

 
I have noticed that there is some strange behavior where standard SF modal dialogs do not display after a LWC component is used that uses the lightning design system modal and a custom CSS via lightning/platformResourceLoader.

I have a LWC component that comes up in the Lightning Design System's modal (https://www.lightningdesignsystem.com/components/modals/#site-main-content). The LWC component loads a css file from static resources:
 
import { loadStyle } from 'lightning/platformResourceLoader';
...
 import STAT_RES from '@salesforce/resourceUrl/StaticResources';
...

renderedCallback(){ 
        loadStyle(this, STAT_RES + '/styles.css').then(()=>{
            console.log("Styles loaded");
        }).catch(error=>{ 
            console.error("Error in loading styles");
        });
    }
This modal works fine, but when the users closes the modal, the CSS from static resources seems to interfer with standard SF modal dialogs.

For example, if my LWC component is used on the Lead screen, once it is closed, the standard modal dialog that should come up when the Convert button is pressed does not display.  Instead, the bowser window gets shaded (as it should when a modal is on the screen) but the actual modal dialog box does not appear.

To fix it, the user has to hit the refresh button.

I always know that the screen is in the strange state because I will see caret characters (^) in certain spots on the screen:

Carets chars

I ue Chrome browser primarily but I have also seen this in Firefox.  Anyone else experience this?  

Thanks
 
I have a string in apex controller stored as follows: String qtr={"Forecast_Category__c":["Unqualified","Not addressable"],"StageName":["1. Understand Customer","2. Discover Needs"]}. 
is it possible to store the following in the below format?
{Forecast_Category__c:[Unqualified,Not addressable] StageName:[1. Understand Customer,2. Discover Needs]}. 
What is the best way to show a loading indicator while retrieving data from Apex in a Lightning Web Component?

I have this approach:
import { LightningElement, api } from "lwc";
import shouldShowCard from "@salesforce/apex/ApexClass.shouldShowCard";

/**
 * Card component that is conditionally shown based on Apex.
 */
export default class ConditionalCard extends LightningElement {
    @api recordId;

    @api isDone = false;

    @api shouldShow = false;

    connectedCallback() {
        shouldShowCard({ id: this.recordId })
            .then(result => {
                this.shouldShow = result;
            })
            .finally(() => {
                this.isDone = true;
            });
    }
}



And this HTML
<template>
  <template if:false={isDone}>
    <div>Loading...</div>
  </template>
  <template if:true={shouldShow>
    <div>Card</div>
  </template>
</template>

Now, this works but I'm using the LWC ESLint rules, and when I do this, I get an error/warning "no-api-reassignment" because I'm assigning the api properties in my connectedCallback.
https://github.com/salesforce/eslint-plugin-lwc/blob/master/docs/rules/no-api-reassignments.md

Which seems reasonable, though it very similar to the pattern that the Salesforce Lightning Spinner shows.
https://developer.salesforce.com/docs/component-library/bundle/lightning-spinner/documentation

So I'm just looking for advice on the best way to handle this or if I should just disable the ESLint rule. Other things to consider are how to test this stuff, the reactivity with the API decorator has made things pretty easy on my end but I don't want to continue if I'm not using the best approach.
Hi there!

I hope somebody can help me ;) I altered this trigger to hopefully send an email alert when a new attachment is added to a case ( I am a new "developer"^^).

Now I need a Test Class for this Trigger to run in Production. I have no idea how to start as it's been awhile since I looked at code like this. 
trigger AttachmentLegalCaseTrigger on ContentDocumentLink (after insert) {	
	// 1. Get List of Object Ids you wish to notify on
	Set<Id> objectIds = new Set<Id>();
	
	// 2. Loop through list of attachments, and if attachment is associated to object you want to notify on, add Parent Id to objectIds set
	for(ContentDocumentLink a:trigger.new){
		 String keyPrefix = String.valueOf(a.LinkedEntityId).substring(0, 3);
		 
		 if(keyPrefix == '500'){
		 	objectIds.add(a.LinkedEntityId);
		 }
	}
	
	// 3. Get your objects you want to notify on, and set the Send Attachment Notification Email field to True 
        // This will to fire the workflow rule to send the email
	if(objectIds.size() > 0){
		List<Case> yourObjectList = [SELECT Id FROM Case WHERE Id IN :objectIds];
		
		for(Case obj:yourObjectList){
			obj.Send_Attachment_Notification_Email__c = true;
		}
		
		if(yourObjectList.size() > 0){
			update yourObjectList;
		}		
	}	  
}

Maybe its easy, but for me .. please help! :)  Thanks in advance!
 
Working with the Metadata Class introduced with ver 40, is there a way to dynamically build a list of Object names to be used in Metadata.Operations.retrieve?  The full names formatted in the way that Metadata.Operations.retrieve wants them are not found in the results of a Schema.getGlobalDescribe() so I am wondering if there is some where else to get this.

A use case would be displaying a list object names to the user of the objects that a custom button can be added to.

Thanks
I am using a html-data- attribute to get the field name when looping through a fieldset:
<apex:repeat value="{!$ObjectType.My_Object__c.FieldSets.Header}" var="f">
   <apex:outputField value="{!showFieldSet[f]}" html-data-FieldName="{!f}"/>
</apex:repeat>
Which gives me the following HTML for most fields:
<span data-fieldname="MyField__c">Something Important</span>
But in other cases, the data-fieldname seems to be just ignored and is not there.  The ones that are ignored, as far as I can tell, seemed to be fields that are either of type currency or percentage...so fields that are auto formatted by visualforce when displayed.   Has anyone else come across this and know of a fix or work around?

Thanks



 
I am having an issue with this version of Eclipse after the force.com plugin is installed....when ever I make a change to a file and click the save icon, I immediately get a "File only saved locally message...".   Looking at the Force.com IDE Log Viewer within Eclipse, each time I open up a file from the project to edit, 2 messages are logged:

User-added image

Both Force.com => Save to Server and Force.com => Refresh from Server on an individual project file work.

Does anyone have any ideas on what is going on and how to fix it?  Thanks
I need to create a formula field to get the date from the Creation Date and convert it to Julian Date. any help is apperciated
I did an insert of usage to product subscriptions and the invoice date was wrong. I need to correct the invoice date on all the usages that created. I tried to do an upsert using the same info in which I inserted with and only changed the invoice date but it created a duplicate record. I was able to delete those records but I still can't figure out how to change the invoice date. I can't even delete the records. I need an ID but the ID number i pull is missing 3 letters at the end so it isn't working. Can someone walk me through what i need to do?
Hello!

I have noticed recently (in the past week or so) that save times on Apex classes using the tooling API have been extremely slow (talking about usually it's max of 10 seconds, now it's anywhere from 30 seconds to 8 minutes). I usually use IntelliJ and IlluminatedCloud, but also tested using Eclipse and the Force.com IDE and experienced the same slow save times.

I did some investigation with other co-workers and it appears to be only on OS X 10.11.6 with the latest 2016-001 El Capitan security update installed. I tested on a machine without that update, to the same org, and the save times were 10 seconds. On my machine, with the update, it was 35 seconds. Co-workers using a windows machine also had ~10 second save times to the same org.

Is anyone else experiencing this slowness? The pod our Trialforce orgs have been spinning up on is NA35. I haven't seen any reports on trust or anywhere else around.

Thanks!
Matt Simonis
public with sharing class salescontroller 
{
    public string dat='this month';
   public Integer leadcount{ get; set; }
   
    public Integer getCountings()
    {
       Integer counts=[SELECT COUNT() FROM Lead];
       leadcount=counts;
        return counts;
    }
    public List<Lead> getCurrentMonthInfo()
    {
        List<Lead> ll=Database.query('SELECT Id,Name,Division_Name__c,Title,counting__c '+ 'FROM Lead');
        return ll;
    }
}


I need to transfer count value from getCountings() to getCurrentMonthInfo() and retrieve count variable value in this, Could anyone can solve this plz??
Hello Team,

I have a scenario where users are opening the same VisualForce page in two different browsers and clicking on Save button on the same time, resulting in creating two records. In the code i tried to check to see if the record exists then don't save or else save,but since it is from two different browsers, the record does not exists and end up with two records again after save.

Please suggest some options on how to restrict this behaviour.

Thank you
Nonprofit admin moonlighting as a developer here. I have a visualforce page that has a table I would like to sort by one of the columns A to Z. The visualforce page is just a pdf print out of certain things from the object and related lists. See below for the snippet of code I have for my table. How can I sort the table A-Z by "Latin Tree Name" column, which takes the {!tr.Tree_Name__r.Name} values?

<table width="100%" border="1">
<th width="15%">CRM Record #</th><th width="35%">Latin Tree Name</th><th width="15%">Stock Type</th><th width="17%">Form</th><th width="10%">Size</th><th width="8%">Quantity</th>
<apex:repeat value="{!Campaign.Tree_Records__r}" var="tr">
<tr>
<td><apex:outputtext value="{!tr.Name}" /></td>
<td><apex:outputtext value="{!tr.Tree_Name__r.Name}" /></td>
<td>{!tr.Stock_Type__c}</td>
<td>{!tr.Tree_Form__c}</td>
<td>{!tr.Caliper_Size__c}</td>
<td>{!ROUND(tr.Quantity_Requested__c,0)}</td>
</tr>
</apex:repeat>
</table>
Does anyone know if I create a Salesforce Site and associate a VF page with it, can I retrieve the site's public URL given the VF page name using SOQL? Thanks
Hi All,

I have the following code and test already working, but was wondering how to cover the bolded piece in testing.

CODE
public class OPSel {
    
    public List<OpportunityLineItemWrapperCls> lineItemList {get;set;}
    public Set<String> selOLIs {get;set;}
    public Boolean hasSelOLI {get;set;}
    public ID opportunityID {get;set;}
    public boolean Button_Disabled{get; set;}
    
    public OPSel(ApexPages.StandardController controller){
        
        try{
            opportunityID=controller.getRecord().Id;
            lineItemList = new List<OpportunityLineItemWrapperCls>();
            selOLIs = new Set<String>();
            
            for(OpportunityLineItem oli : [SELECT ID,
                                           Opportunityid,
                                           Pricebookentry.name,
                                           listprice,
                                           Quantity,
                                           UnitPrice,
                                           Description
                                           FROM OpportunityLineItem WHERE OpportunityId = :controller.getRecord().Id order by createddate]){
                                               lineItemList.add(new OpportunityLineItemWrapperCls(oli));
                                           }
            //TESTING              
            system.assertEquals(controller.getRecord().Id, '1');
            //END TESTING
            
            if(lineItemList.Size()<2)
            {
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.WARNING,'You only split an opportunity with two or more line items');
                ApexPages.addMessage(myMsg);
                Button_Disabled=true;

            }
        }
        catch (Exception e)
        {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,e.getMessage());
            ApexPages.addMessage(myMsg);
        }
    }

TEST
@isTest(SeeAllData=True)
private class test{
    static testMethod void testclass() {
    Account acc = new Account(Name='Count');
    insert acc;
    
    Program__c testprog = new Program__c();
    testprog.name = Date.today().year() + ' Program';
    testprog.Start_Date__c = Date.today();
    testprog.End_Date__c = Date.today();
    insert testprog;
        
    Product2 pr = new Product2();
    pr.name='TestPr';
    pr.Program__c=testprog.id;
    insert pr;
    
    Pricebook2 PB = new Pricebook2();
       PB.name='Testbook';
       PB.IsActive=true;
    insert PB;
     Pricebook2 standardPricebook = [SELECT Id FROM Pricebook2 WHERE IsStandard=true];
        PricebookEntry X = new PricebookEntry();
        X.Product2ID=pr.id;
        X.Pricebook2Id=standardPricebook.Id;
        X.UnitPrice=1;
        X.IsActive=true;
        insert X;
        
    Opportunity TestOpp = new Opportunity();
    TestOpp.name='testOppty';
    TestOpp.AccountId=acc.id;
    TestOpp.StageName='Maximizer';
    TestOpp.CloseDate=System.today();
    insert TestOpp;
    
    Opportunity TestOpp2 = new Opportunity();
    TestOpp2.name='testOppty2';
    TestOpp2.AccountId=acc.id;
    TestOpp2.StageName='Maximizer';
    TestOpp2.CloseDate=System.today();
    insert TestOpp2;
        
    OpportunityLineItem TestOLI = new OpportunityLineItem();
    TestOLI.OpportunityId = TestOpp.id;
    TestOli.PricebookEntryId = X.Id;
    insert TestOLI;
     
    OpportunityLineItem TestOLI2 = new OpportunityLineItem();
    TestOLI2.OpportunityId = TestOpp.id;
    TestOli2.PricebookEntryId = X.Id;
    insert TestOLI2;
        
    test.startTest();
        PageReference pageRef = Page.OpportunityLineItemSelector;
        Test.setCurrentPage(pageRef);
        pageRef.getParameters().put('id',TestOpp.id);
        OpportunityLineItemSelectorCntrlr controller = new OpportunityLineItemSelectorCntrlr(new ApexPages.StandardController(TestOpp));
        OpportunityLineItemSelectorCntrlr controller2 = new OpportunityLineItemSelectorCntrlr(new ApexPages.StandardController(TestOpp2));
        controller.split();
        controller2.split();
        update TestOpp;
        update TestOpp2;
        OpportunityLineItemSelectorCntrlr c1 = new OpportunityLineItemSelectorCntrlr(new ApexPages.StandardController(TestOpp));
        
        Debugger debug=new Debugger();
        debug.a();
        debug.b();
        debug.c();
        debug.d();
    test.stopTest();
    }
}
 
I've created a conf xml file, done the encrypting of the password, and I'm ready to run process.bat 

However, when I run it using the command: "C:\users\JJ\AppData\Local\salesforce.com\Data Loader\samples\conf\" auto_account_process-conf

I get the following:
C:\Users\JJ\AppData\Local\salesforce.com\Data Loader\bin>process.bat "C:\Users\JJ\AppData\Local\salesforce.com\Data Loader\samples\conf\" auto_accoun
_process-conf
Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -client       to select the "client" VM
    -server       to select the "server" VM
                  The default VM is client.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
C:\Users\JJ\AppData\Local\salesforce.com\Data Loader\bin>
 
My premium support inside Salesforce staff can not help.
 
We have always calculated a principle and interest payment using, Microsoft Excel, a financial calculator or loan software.
 
They all have a "PMT" function and salesforce does not.
 
This is absolutely critical for us and has stopped us in our tracks. Using "simple" interest will NOT cut it for us, as we are a commercial loan company.
 
Has anyone successfully written a principle & interest formula in salesforceeaze?
 
Please (begging) help...
  • July 21, 2006
  • Like
  • 0