• Rufus Roden
  • NEWBIE
  • 135 Points
  • Member since 2015

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 15
    Replies
I am trying to get a handle on this Ajax Toolkit.

I am referring to this example https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_vf_sample.htm 
I do not understand where GETSESSIONID() is coming from here, can someone point me in the right direction?
 
<apex:page >
    <script type="text/javascript">
    var __sfdcSessionId = '{!GETSESSIONID()}';
    </script>

 
Hi all!  I am still fairly new to development and need help writing a test class for a class I have developed (my experience is with triggers).  I am trying to autosync a quote to an opportunity upon creation and after studying some blog posts I came up with the following class:

public class QuoteAutoSyncUtil
    {
        @future
        public static void syncQuote(Map<Id, Id> quoteMap)
        {
            List<Opportunity> oppList = new List<Opportunity>();
           
            for(Id currentQuote : quoteMap.keyset())
            {
                Opportunity opp = new Opportunity();
                opp.Id = quoteMap.get(currentQuote);
                opp.SyncedQuoteId = currentQuote;
                oppList.add(opp);
            }
           
            Integer oppSize = oppList.size();
            update oppList[oppSize -1 ];
     
        }
       
    }

And the following trigger:

trigger QuoteAutoSync on Quote (after insert)
    {
        Map<Id, Id> quoteMap = new Map<Id, Id>();
        for(Quote currentQuote : Trigger.New)
        {
          if(currentQuote.ExpirationDate != NULL)
          {
              quoteMap.put(currentQuote.Id, currentQuote.OpportunityId);
          }
        }
       
        QuoteAutoSyncUtil.syncQuote(quoteMap);
    }

It is working perfectly in Sandbox but I am getting stuck on the test class.  This is what I have so far:

@isTest
public class AutoSyncQuote {

    public static testmethod void TestAutoSyncQuote(){
       Account a = new Account();
        a.Name = 'Test Account';
        a.salesReach__Agent_Account_Company_Name__c = '001a000001DbY9F';
        a.salesReach__Agent_Contact_Name__c = '003a000001iM38p';
        a.Account_Status__c = 'Active';
        a.Diamond_Account__c = True;
        a.Net_One__c = False;
        
        Insert a;
        
       Opportunity opp = new Opportunity();
        opp.Name = 'Telecom Product or Service';
        opp.CloseDate = Date.today();
        opp.StageName = 'Quote Requested By Client';
        opp.Opportunity_Type__c = 'Install New Service';
        opp.AccountId = a.Id;
        
        Insert opp;
        
       Quote q = new Quote();
        q.Name = 'Telecom Product or Service - Quote';
        q.ExpirationDate = opp.Quote_Expiration_Date__c;
        q.OpportunityId = opp.Id;
        
        Map<Id, Id> quoteMap = new Map<Id, Id>();

        QuoteAutoSyncUtil.syncQuote(quoteMap);
        
              
    }
    
}

but so far it is saying none of my lines are covered.  PLEASE HELP!!!  Thank you very much!
Hi Guys, 

I would like to send a service notification for the sales reps in chatter when a case is created. I know that the workflow doesn't have this functionality. Is there any way to do it?

 
I've been trying to get the action.setStorable working.  What I've coded turns out to be very similar to @Gaurav Puranik 's as described here
https://developer.salesforce.com/forums/#!/feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=9060G000000XaU3QAK
 
No surprise then that my results are the similar.  I've found that my component, hosted in Lighting Experience, seems to only cache the results for about 30 seconds.
 
However if I create an Lightning App and call the auraStorage:init from there I've found that I can get the call to cache; although the process appears to be in-memory only (yes, I've tried persistent="true")
 
My question so then is this. 
 
Currently is the <auraStorage:init/> with name="actions" only instantiable for a Lightning App and, if you are hosting your component in Lightning Experience, that that component is bound to LEX's setting for when it called it's <auraStorage:init/> ?
 
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 all, 
We need to improve the code on the below so that our batch job does not time out, this is as per SF support advise. 

What would be the best way to go about this? see code below

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public opportunityUtils(list<Opportunity> newOppys, map<Id,Opportunity> oldOppysMap, string operation){
    
// Do some validation on the Opportunity Amount & Record Type
    if(operation == 'validation'){
      for(Opportunity oppy :newOppys){
        
        // TO-DO:  Need to add in the Batch__c Lookup to the below logic - also need to consider other fields
        if(oppy.Batch_Closed__c == true && (oppy.Amount != oldOppysMap.get(oppy.Id).Amount || oppy.RecordTypeId != oldOppysMap.get(oppy.Id).RecordTypeId)){
          oppy.addError('ERROR');
        }  
      }
    }
  }
​--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks all

J
I receive the following error when trying to save any of the classes in my developer console: "DEPLOYMENT ERROR: An unexpected error has occurred. 891009581-41899 (749494588) for deploymentId=1drK0000000qbfFIAQ If this persists, please contact customer support."

I've tried closing the developer console and re-opening it. As of writing, I've tried saving for roughly an hour with no luck. 
I am trying to get a handle on this Ajax Toolkit.

I am referring to this example https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_vf_sample.htm 
I do not understand where GETSESSIONID() is coming from here, can someone point me in the right direction?
 
<apex:page >
    <script type="text/javascript">
    var __sfdcSessionId = '{!GETSESSIONID()}';
    </script>

 
I have a batch and it sends an email out at the end to users who fit a certain criteria. In each email, I need to include a specific salesforce link to a record that's owned by them. What's the best way to do this? I imagined I would run through getBaseUrl() and then add a '/' then the custom link to that specific record. Just not sure how to get that specific Id that pertains to that person in that instance.
Hello,

Can somebody tell me that is below piece of code is correct or not.
And if it is incorrect then let me know with the help of reason(s)

public class className01 {
       public List<className01> cn;
}


In short a vaiable/property is defined in a class taking class name as the dataType for list.



Regards,
Ritik
  • April 09, 2015
  • Like
  • 0
I have a trigger on a Parent Object_A to update records on a Child Object_B 

I have a Set<ID> myID to get current record from Object A.

Object_B has a Picklist field Status__c.

List<Object_B> ToUpdate = [SELECT id, Name, Status__c from Object_B WHERE Status__c = 'Open' OR Status__c = 'Late' AND Object_B.Object_A in ;myID];

I would like to choose records that have the picklist value of EITHER Open or Late and where the lookup for Object A has the ID from my set myId.
It all works perfectly if I do Where Status equals one value. But I can't figure out how to say one value or the other.

Thanks in advance
  • March 20, 2015
  • Like
  • 0
Not sure if this is the right place to post this.

We saw this error - not sure what it means - same text, slightly different errors each time
Workflow Actions attempted

Error Number: 1585159311-507635 (1918307596)
Error Number: 1585159311-507641 (1918307596)
Error Number: 1585159311-507629 (1918307596)


I'm not sure if it is related, we also getting this error on about 3% of email for the last week:
421 4.4.0 [internal] no MXs for this domain could be reached at this time
Hey all!

I'm wondering why our Developer here at my company is getting this error when he's just typing in code into the console - nothing else.

An unexpected error has occured. 1890225493-1668894 (528326319) for deploymentID=1drK0000000KTj6IAC  If this persists, please contact customer support. 

Any help would be appreciated!  Thanks!
Hi all!  I am still fairly new to development and need help writing a test class for a class I have developed (my experience is with triggers).  I am trying to autosync a quote to an opportunity upon creation and after studying some blog posts I came up with the following class:

public class QuoteAutoSyncUtil
    {
        @future
        public static void syncQuote(Map<Id, Id> quoteMap)
        {
            List<Opportunity> oppList = new List<Opportunity>();
           
            for(Id currentQuote : quoteMap.keyset())
            {
                Opportunity opp = new Opportunity();
                opp.Id = quoteMap.get(currentQuote);
                opp.SyncedQuoteId = currentQuote;
                oppList.add(opp);
            }
           
            Integer oppSize = oppList.size();
            update oppList[oppSize -1 ];
     
        }
       
    }

And the following trigger:

trigger QuoteAutoSync on Quote (after insert)
    {
        Map<Id, Id> quoteMap = new Map<Id, Id>();
        for(Quote currentQuote : Trigger.New)
        {
          if(currentQuote.ExpirationDate != NULL)
          {
              quoteMap.put(currentQuote.Id, currentQuote.OpportunityId);
          }
        }
       
        QuoteAutoSyncUtil.syncQuote(quoteMap);
    }

It is working perfectly in Sandbox but I am getting stuck on the test class.  This is what I have so far:

@isTest
public class AutoSyncQuote {

    public static testmethod void TestAutoSyncQuote(){
       Account a = new Account();
        a.Name = 'Test Account';
        a.salesReach__Agent_Account_Company_Name__c = '001a000001DbY9F';
        a.salesReach__Agent_Contact_Name__c = '003a000001iM38p';
        a.Account_Status__c = 'Active';
        a.Diamond_Account__c = True;
        a.Net_One__c = False;
        
        Insert a;
        
       Opportunity opp = new Opportunity();
        opp.Name = 'Telecom Product or Service';
        opp.CloseDate = Date.today();
        opp.StageName = 'Quote Requested By Client';
        opp.Opportunity_Type__c = 'Install New Service';
        opp.AccountId = a.Id;
        
        Insert opp;
        
       Quote q = new Quote();
        q.Name = 'Telecom Product or Service - Quote';
        q.ExpirationDate = opp.Quote_Expiration_Date__c;
        q.OpportunityId = opp.Id;
        
        Map<Id, Id> quoteMap = new Map<Id, Id>();

        QuoteAutoSyncUtil.syncQuote(quoteMap);
        
              
    }
    
}

but so far it is saying none of my lines are covered.  PLEASE HELP!!!  Thank you very much!
Hi Guys, 

I would like to send a service notification for the sales reps in chatter when a case is created. I know that the workflow doesn't have this functionality. Is there any way to do it?

 
Hello,
I need to retrieve reports available in the salesforce org.
I am able to retrieve all the reports (using SOQL query) with its folder name but I am not able to retrieve "Report Type" of the report. I checked there is [Report Type] object but no field in [Report] object to connect with [Report Type] object.
How can I retrieve [Report Type] ?