• ShadowlessKick
  • NEWBIE
  • 265 Points
  • Member since 2008

  • Chatter
    Feed
  • 7
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 45
    Questions
  • 69
    Replies
The Spring '16 preview had been applied to our Sandbox.  A design refresh from our production version was applied to the Sandbox.  How can we get the the Spring '16 preview back?
his organization has implemented URL hacks through its Salesforce.com instance. There are several ways that these hacks are executed.  Pre-populating fields on form opening is one of the multiple reasons for the hacks.

For the most part Visualforce pages were avoided.  This allowed the administrators to manage configuration on their own.  After attending Dreamforce '15, the users are now demanding Lightning offering them the same functionality as Classic Salesforce.com.

Please explain the steps it would take to replace these development practices.  It would be hard to believe a huge organization like Salesforce.com would recklessly eliminate a core part of their functionality without a work around.  Cannot find an answer.   

This example scraps the opportunity and pre-populates a custom object with values from the opportunity.  The record is placed in edit mode. The user has the ability to chose wether or not to save it or not.  Please explain the new process that has to take place in steps.  This is an existing javascript button.
var TheMockUpName = "Mock Up: " + "{!Opportunity.Name}";
var TheValues = "{!Opportunity.KCO_Competition_Current_Suppliers__c}";
var TheValueArray = TheValues.split(";");
var TheTarget = "&00N50000002pCh2";
var TheParameters = "";

for (var i=0;i<TheValueArray.length;i++){
TheParameters = TheParameters + TheTarget + "=" + TheValueArray[i] ;
}


var TheAmount = "{!Opportunity.Amount}";
TheAmount = TheAmount.substring(3);
var TheURL = "/a0G/e?CF00N500000026uRE={!Opportunity.Name}&CF00N500000026uR5={!Opportunity.Account}&00N50000002pCi0={!Opportunity.Opportunity_Number__c}&00N50000002pCuV={!Opportunity.KI_Quote__c}&00N500000026uRM={!Opportunity.Sales_Representative__c}&00N50000002pCmW={!Opportunity.District_Name__c}&00N50000002pCmb={!Opportunity.Region__c}" + TheParameters + "&00N500000026uRK=" + TheAmount + "&00N500000026uRK={!Opportunity.Project_Coordinator__c}" + "&Name=" + TheMockUpName + "&retURL=/{!Opportunity.Id}";
window.open( TheURL,"_blank","menubar=yes, location=yes, titlebar=yes, status=yes, toolbar=yes, scrollbars=yes, resizable=yes, top=1, left=1, fullscreen=no" );

Thank you.
Trying to duplicate a  process that was developed in Salesforce Classic.  What should happen is a method in a controller should be launched on page load of  a visual force page, the constructor should do some work and return  a parm to the visualforce page.  Do not want to click more buttons other than the initial "action button" that calls a visualforce page.  Could someone please explain what is in error here?  Is this the correct path to take?  
<apex:page standardController="Opportunity" extensions="opportunityMockUp" showQuickActionVfHeader="false"> 
<script>  
         window.onload = new function() { buildURL(); };
            function buildURL()
            {
			//Just a container to launch the action button
            };   
  </script>
  <script>          
            function navigateToMockUp(){            
               if ( (typeof sforce != 'undefined') && (sforce != null) )  {s
                   alert('{!theBuiltURL}');
                    sforce.one.navigateToSObject('{!theBuiltURL}');
                } else {
                    window.location='/' + '{!theBuiltURL}';
               }        
            }
</script>
   <apex:form >
       <apex:actionFunction name="buildURL" action="{!autoRun}" rerender="none" oncomplete="navigateToMockUp();">
       </apex:actionFunction>
</apex:form>
</apex:page>
 
public with sharing class opportunityMockUp{
//Define the Project Object
    Opportunity theOpportunity = new Opportunity(); 
    String thePageOpportunityId;  
    String theOpportunityID; 
    String theOppName;
    String theAccountID;
    String theAmount;
    String theOppNumber;
    String theQuote;
    String theSalesRep;
    String theDistrictName;
    String theRegion;
    String theProjectCoordinator;
    String theMockUpName;
    String theTarget;
    String theParameters;
    String theValues;   
    String theURL;
    String theAccountName;
    public String theBuiltURL {get;set;}
       
    // Constructor - this only really matters if the autoRun function doesn't work right     
    public opportunityMockUp(ApexPages.StandardController stdController) {        
        this.theOpportunity = (Opportunity)stdController.getRecord();   
     } 
    
    // Code invoked on page load.      
    public PageReference autoRun()
    {           
        thePageOpportunityId = ApexPages.currentPage().getParameters().get('id'); 
        if (thePageOpportunityId == null) 
        {             
            // Display the Visualforce page's error message if no Id is passed over             
            return null;         
        }       
      
    for (Opportunity theOpportunity:[select Id, Name, Accountid, Account.Name, Amount, Opportunity_Number__c, KI_Quote__c, Sales_Representative__c,District_Name__c,Region__c, 	Project_Coordinator__c, KCO_Competition_Current_Suppliers__c from Opportunity where id =:thePageOpportunityId Limit 1]) 
    {               
        theTarget = '&00N50000002pCh2'; 
        theParameters = '';
        theValues = theOpportunity.KCO_Competition_Current_Suppliers__c; 
        if (theValues != null && theValues  != '' && theValues != '0'){
        List<String> theValueArray = theValues.split(';'); 
        for (integer i=0; i < theValueArray.size(); i++) { 
          theParameters = theParameters + theTarget + '=' + theValueArray[i] ; 
        system.debug('TheParms: ' + theParameters);
        }
        }  
        else
        {
          theParameters = '';
        }
        
        theMockUpName = 'Mock Up: ' + theOpportunity.Name;
        theAmount = String.ValueOf(theOpportunity.Amount);
        if (theAmount != null && theAmount != '') {
        theAmount = theAmount.Substring(0,3);
        }
        else
        {
          theAmount = '0';
        }
         
        theOpportunityID = theOpportunity.Id; 
        theAccountID = theOpportunity.Accountid; 
        theAccountName = theOpportunity.Account.Name;
        theOppName = theOpportunity.Name;
        theOppNumber = theOpportunity.Opportunity_Number__c;
        theQuote = theOpportunity.KI_Quote__c;  
        if (theOpportunity.KI_Quote__c != null && theOpportunity.KI_Quote__c != '') {
        theQuote = theOpportunity.KI_Quote__c;  
        }
        else
        {
          theQuote = '';
        }
        theSalesRep = theOpportunity.Sales_Representative__c;
        theDistrictName = theOpportunity.District_Name__c;
        theRegion = theOpportunity.Region__c;
        theProjectCoordinator = theOpportunity.Project_Coordinator__c;
        theOpportunityID = theOpportunity.id; 
        TheURL = '/a0G/e?CF00N500000026uRE=' + theOppName + '&CF00N500000026uR5=' + theAccountName + '&00N50000002pCi0=' + theOppNumber + '&00N50000002pCuV=' + theQuote + 	'&00N500000026uRM=' +  theSalesRep + '&00N50000002pCmW=' + theDistrictName + '&00N50000002pCmb=' + theRegion + theParameters + '&00N500000026uRK=' + theAmount + 	'&00N500000026uRK=' + theProjectCoordinator + '&Name=' + theMockUpName + '&retURL=/' + theOpportunityID + ' target="blank"';  
          system.debug('TheURL 1: = ' + TheURL);
        //TheURL = EncodingUtil.URLENCODE(TheURL,'UTF-8');
            system.debug('TheURL 2: = ' + TheURL);
        theBuiltURL = TheURL;    
        }  
     return null;
    }

 
I am using an "Quick Action" to create the same functionality that a button had in Classic.  There is always a phantom box that does not close without user interaction. It must be some type of QuickAction container? Can this be closed automatically somehow?   Thought using the NavigateToSObject would force the "Action" to redirect.
<apex:page standardController="Contact" showQuickActionVfHeader="false">
   <script src="/soap/ajax/33.0/connection.js" type="text/javascript"></script>
    <script> var previousOnload = window.onload;
     window.onload = function() { if (previousOnload) { previousOnload(); }
        if( (typeof sforce != 'undefined') && (sforce != null) ) {
        sforce.one.navigateToURL('https://Somewhere.com/sfdc/APlace?UserId={!$User.Id}&SessionId={!$Api.Session_ID}&ServerEndPoint={!$Api.Partner_Server_URL_260}&SFDCId={!Contact.Id}&SFDCIdType=Contact');
        sforce.one.navigateToSObject('{!Contact.Id}');
        }
        else {
       	window.location="https://Somewhere.com/sfdc/APlace?UserId={!$User.Id}&SessionId={!$Api.Session_ID}&ServerEndPoint={!$Api.Partner_Server_URL_260}&SFDCId={!Contact.Id}&SFDCIdType=Contact')";
      	sforce.one.navigateToSObject('{!Contact.Id}');
       }       
  }  
</script>
</apex:page>
User-added image
 
The user would like a batch job to run at an unspecified intraval to clear a hidden field.  This could cause problems if it updates a record that someone is currently editing.  I have not found a posting that explains how to identify if a record is currently being edited.  Is that possible in APEX?   This is not a on a custom object or through a visualforce page. Just want to see if the Opportunity record is currently in th process of being modified.  IE..The user pressed the "EDIT' button.

I know that I can specify if my process is updating something.  How can I check the record is already being updated at the time I check.

I have seen postings about records being "locked" for an approval process that is not what I am referring to here.
Not sure what the best way to accomplish this task.  There is a request to log a record each time a record of a specific type is opened.  There is not a concern if it was updated.  They want to capture the document name,  the user that opened the record and a date time.  There has to be multiple ways to do this but I was just wondering what the best way to accomplish this.        
Could someone please clarify this topic about Salesforce1?   Say we are talking about the Opportunity page layout.  Is it possible to define an Opportunity page layout for users viewing pages through Salesforce1 on their phone and a different Opportunity page layout for the same users viewing through a browser on their desktop computers.  I keep reading contradictary information.  
A javascript button extracts string data from a textarea.  The string has a newline character of "\r\n" inside the html.   When the javascript line is extracted it looks like this -

var TheDrawingNumber = "{!tenrox__c.KI_Drawing_Space_Plan__c}"; 

An error of "Unterminated string constant" is displayed.

How can the value be extracted without the javascript blowing up? 

Is there a way like "{!tenrox__c.KI_Drawing_Space_Plan__c.replace(/(\r\n|\n|\r)/gm, "%2c") }";
There are examples of triggers related to the Partner object in these forums.  I asked a question about why I could not see the Partner object in Eclipse.  The response was that it is visible in the developers console.  That is true.  The problem is that when the Parnter object is selected it throws and an error of "SObject type does not allow triggers: Partner" 

Now what? 

Does anyone know how a Partner trigger can be created?
Would like to write an afterupdate trigger against the Salesforce "Partner" object.  It is not availble to pick in the Eclipse IDE.  Is this some type of setting in Eclipse that I missed? 
Am getting this error:
Initial term of field expression must be a concrete SObject: SET<String>

Any ideas? 

global Set<String> TheCoorNames = new Set<String>();
TheCoorNames.add("James Jones");
TheCoorNames.add("Sue Smith");

for (Integer TheIndex = 0; TheIndex < TheCoorNames.size(); TheIndex++){
String TheName;
TheName =  TheCoorNames.get[TheIndex].tostring;
}
We have a custom object that requires a record type to be selected.  Before the administrator created the different record types the custom table id was captured in the Sandbox. I was too late when they went to production and now I cannot figure out how to get the full ID of the custom table.  I do not need the ID of a specific record or the 3 digit prefix of the object.  I need the full ID of the custom object.

For instance the URL the works in the Sandbox contains the full table Id after the value or "ent=XXxXXXXXXXXXxxx'  This process then calls a visual force page that calls a class and prepopulates the custom object.

Example.
var TheURL = "setup/ui/recordtypeselect.jsp?ent=01I500000007Qqe&retURL=/{!Opportunity.Id}&save_new_url=%2Fapex%2FcreateProjectFromOpportunity%3Fid={!Opportunity.Id}";

Could someone please explain to me how to get the full id of the custom object?  I cannot use the 3 digit prefix of the object and cannot use the name of the custom object in place of ent=01I500000007Qqe like ent=CustomObject__c.

Thanks.
I have an Apex Controller that works but I cannot get the test class to compile. It blows with the following error.

System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: this ID value isn't valid for the user: : [RecordTypeId]

The user I am using is authorized to record types "CAD", "Install"  

Name      Id
CAD        012W00000004S1FIAU
Install     012W00000004S1AIAU

When I run the test scripts I pull out the user ID and query for the record type I want to use.

The Debug logs are returning the correct ID's
User: 00550000001J8elAAC
RecordTypeID: 012W00000004S1AIAU

The hardcoded record type id does not work either.

The Test Script Looks like this:

@isTest
public with sharing class createProjectFromProject_Test {
// Method for testing
     public static testmethod void testCreateProjectFromProject_Test()   
     {     
     //Start Test
     Test.startTest();     
           
     // Get User Settings       
     User UserSetting = [select name, TimeZoneSidKey,
          LocaleSidKey,
          EmailEncodingKey,
          ProfileId,                            
          LanguageLocaleKey
          from User where name = 'Administrator' LIMIT 1];
         
     // Create Test User       
     User theTestUser1 = new User (FirstName = 'Test',
                            LastName = 'User',
                            Username = 'Test.User@ki.com',
                            Email =  'Test.User@ki.com',
                            Alias = 'TestUser',
                            TimeZoneSidKey = UserSetting.TimeZoneSidKey,
                            LocaleSidKey = UserSetting.LocaleSidKey,
                            EmailEncodingKey = UserSetting.EmailEncodingKey,
                            ProfileId = UserSetting.ProfileId,
                            LanguageLocaleKey = UserSetting.LanguageLocaleKey);
                            insert theTestUser1;
                           
                           
                            Id theAdminUserID = [SELECT Id FROM  User where name = 'Administrator' LIMIT 1].id;
                           
// Create Account   
      Account theTestAccount = new Account(Name = 'Test Opp. To Project  Account', Type = 'End User', Site = 'Test Account City', MARKET_CODE__C = 'University & College Market – 1', SALES_REP__C = 'Zakowski, Ted', STATE__C = 'WI', DISTRICT__C = '125',  Region__c = '1', FIELD_SALES_REP_NUMBER__C = '12542', DISTRICT_NAME__C = 'KI-New York', DISTRICT_TYPE__C  = 'Direct',   Owner = theTestUser1);       
      insert theTestAccount;
        
      RecordType theRecordType = [SELECT Id FROM RecordType where Name = 'Install' and SobjectType = 'tenrox__c' Limit 1];
  

// Create Project     
       Tenrox__c TheOrigProject = new Tenrox__c (Name =  'Test',
      Description__c =  'Test',
      Start_Date__c = Date.Today(),
      Account__c = theTestAccount.id,
     Finish_Date__c =  date.valueOf('2039-12-31'),
     OwnerId = theAdminUserID,
     RecordTypeId = therecordtype.id);       
        insert TheOrigProject;       
       theProjectID = TheOrigProject.id;
 
       /*****************************************************************/       
       /*                   Data Setup Complete                         */       
       /*****************************************************************/                
       /*****************************************************************/       
       /*                       Test Scenario                          */       
       /*****************************************************************/
      // Test Controller        
  
      ApexPages.StandardController controller1 = new ApexPages.StandardController(TheOrigProject);
 
   createProjectFromProject controller2 = new createProjectFromProject(controller1);
   
     controller2.autorun();
   
  PageReference pageRef = Page.createProjectFromProject;
  pageRef.getParameters().put('id', String.valueOf(TheOrigProject.id));
  Test.setCurrentPage(pageRef);
  controller2.autorun();
  
  Test.stopTest();
    
   }
}
The outbound message functionality is clean and does what we need it to do.  We like the session id feature and the response back. 

Can it be used through a button?  Ours fires from a workflow action.  The workflow fires when an object is saved.  Just want to invoke the outbound message without saving anything. 

Would like the functionaliy to work just like it does with a workflow but this time through a button. 

If APEX is necessary what is the syntax to call the outbound message?

Thanks.
When an Account is deleted the related Contacts are also removed from Salesforce.  What event eliminates them?  I have created a trigger to capture the ID of the contacts when they are deleted. It is successful when the contacts are deleted individually or merged through the UI.  However, when they are removed with an Account deletion the ID's are not captured.  The "After Delete" trigger on the contact does not seem to fire.

Is there some other kind of event that needs to be monitored?

Am implementing outbound messaging in a .Net web application.  Am sending in the ID only.  Receive an acknowledgment back and everything is working to that point. 

The next step is to to re-access Salesforce.  Multiple posts say that with the session id passed through the outbound message you can get back to Salesrooms without logging in again.

 

Does anyone have an example of code for that?  Have been trying to use the SforceService but it appears that you MUST log in with credentails. 

Need some ideas as to how to prompt the user for a record type.  This is on a custom object which is being called from the opportunity.  The existing custom button calls a visual force page that does nothing but executes a class.  The class scapes the opporutnity and populates the custom object with a numerous amount of data from the opporutnity.  The Salesforce out of the box recordtypeselect.jsp does exaclty what I need but I do not know how I would force that in front of my existing process.

 

<apex:page standardController="Opportunity" extensions="createProjectFromOpportunity" action="{!autoRun}">   
<apex:sectionHeader title="Access Add Project Page"/>   
<apex:outputPanel > If you see this page, something went wrong. Print this page and send the error to the Help Desk.  
</apex:outputPanel> 
</apex:page>

 

 

Trying to rewrite a trigger that keeps getting System.LimitException: Too many SOQL queries: 101.  Thought it was in bulk structure but I guess not.  The only reason there is a group by on the query was to try to limit the amount of data being returned.  That did not help.

 

trigger CheckDuplicateContractNumber on Apttus__APTS_Agreement__c (before update) 
{
List<Id> TheContractIds = new List<Id>(Trigger.newMap.keySet());
Integer theCountFound;

for (Apttus__APTS_Agreement__c theAgreement :Trigger.new ) 
{
        for(AggregateResult ar : [SELECT Count(Id) thecounter, APTPS_BPCS_Contract_Number__c BPCSCntr from Apttus__APTS_Agreement__c WHERE APTPS_BPCS_Contract_Number__c = :theAgreement.APTPS_BPCS_Contract_Number__c AND Id Not IN :TheContractIds Group BY APTPS_BPCS_Contract_Number__c Limit 2])
        theCountFound = Integer.valueOf(ar.get('thecounter'));  
            if (theCountFound >= 1) 
            {
                theAgreement.addError('The Contract Number already exists. Please enter a unique number.');
            }
        }
  }

 

The trigger I wrote works but....  SOQL should not be inside the for loop.  Any suggestion of how to improve the trigger would be appreciated. Thanks.

 

trigger Aptus_OpportunityAgreement on Apttus__APTS_Agreement__c (before insert) {

	private ID theOppId = null;
	for (Apttus__APTS_Agreement__c theContract : Trigger.new )  
	{  
		if ((theContract.Apttus__Related_Opportunity__c != null) && (theContract.name.left(3) == 'SPA' || theContract.Name.left(2) == 'OT' ))
		{
			theOppId = theContract.Apttus__Related_Opportunity__c;
			Opportunity theOpportunity = [SELECT Id, Market_Code__c, Sales_Representative__c, AccountId FROM Opportunity WHERE id = :theOppId Limit 1];
			if (theOpportunity != null)
			{
			 theContract.Apttus__Account__c = theOpportunity.AccountId; 
			 theContract.APTPS_Field_Sales_Rep_Name__c = theOpportunity.Sales_Representative__c; 
			 theContract.APTPS_Market__c = theOpportunity.Market_Code__c; 
			}
		}
	} 
} //End Of Trigger

 

 

Could someone explain how you convert null value errors returning from fields collected in an SOQL Query? 

 

Error: System.NullPointerException: Argument 1 cannot be null

 

Opportunity theOpportunity = new Opportunity();  

for (Opportunity theOpportunity:[select Id, Quote__c from Opportunity Limit 1]) 
{
		String TestField;
   		TestField = String.valueOf(theOpportunity.get('Quote__c'));
		System.debug('The Value 1 :' + TestField);     
	 	TestField = String.valueOf(theOpportunity.Quote__c);
	 	System.debug('The Value 2 :' + TestField);     
}

 Would have thought that the String.valueOf would convert null to ''.

How would you substring an ID within a select statement.  Would like only the first 15 characters of the ID. 

For instance:  Select id.substring(0, 15) from Opportunity

The Spring '16 preview had been applied to our Sandbox.  A design refresh from our production version was applied to the Sandbox.  How can we get the the Spring '16 preview back?
Trying to duplicate a  process that was developed in Salesforce Classic.  What should happen is a method in a controller should be launched on page load of  a visual force page, the constructor should do some work and return  a parm to the visualforce page.  Do not want to click more buttons other than the initial "action button" that calls a visualforce page.  Could someone please explain what is in error here?  Is this the correct path to take?  
<apex:page standardController="Opportunity" extensions="opportunityMockUp" showQuickActionVfHeader="false"> 
<script>  
         window.onload = new function() { buildURL(); };
            function buildURL()
            {
			//Just a container to launch the action button
            };   
  </script>
  <script>          
            function navigateToMockUp(){            
               if ( (typeof sforce != 'undefined') && (sforce != null) )  {s
                   alert('{!theBuiltURL}');
                    sforce.one.navigateToSObject('{!theBuiltURL}');
                } else {
                    window.location='/' + '{!theBuiltURL}';
               }        
            }
</script>
   <apex:form >
       <apex:actionFunction name="buildURL" action="{!autoRun}" rerender="none" oncomplete="navigateToMockUp();">
       </apex:actionFunction>
</apex:form>
</apex:page>
 
public with sharing class opportunityMockUp{
//Define the Project Object
    Opportunity theOpportunity = new Opportunity(); 
    String thePageOpportunityId;  
    String theOpportunityID; 
    String theOppName;
    String theAccountID;
    String theAmount;
    String theOppNumber;
    String theQuote;
    String theSalesRep;
    String theDistrictName;
    String theRegion;
    String theProjectCoordinator;
    String theMockUpName;
    String theTarget;
    String theParameters;
    String theValues;   
    String theURL;
    String theAccountName;
    public String theBuiltURL {get;set;}
       
    // Constructor - this only really matters if the autoRun function doesn't work right     
    public opportunityMockUp(ApexPages.StandardController stdController) {        
        this.theOpportunity = (Opportunity)stdController.getRecord();   
     } 
    
    // Code invoked on page load.      
    public PageReference autoRun()
    {           
        thePageOpportunityId = ApexPages.currentPage().getParameters().get('id'); 
        if (thePageOpportunityId == null) 
        {             
            // Display the Visualforce page's error message if no Id is passed over             
            return null;         
        }       
      
    for (Opportunity theOpportunity:[select Id, Name, Accountid, Account.Name, Amount, Opportunity_Number__c, KI_Quote__c, Sales_Representative__c,District_Name__c,Region__c, 	Project_Coordinator__c, KCO_Competition_Current_Suppliers__c from Opportunity where id =:thePageOpportunityId Limit 1]) 
    {               
        theTarget = '&00N50000002pCh2'; 
        theParameters = '';
        theValues = theOpportunity.KCO_Competition_Current_Suppliers__c; 
        if (theValues != null && theValues  != '' && theValues != '0'){
        List<String> theValueArray = theValues.split(';'); 
        for (integer i=0; i < theValueArray.size(); i++) { 
          theParameters = theParameters + theTarget + '=' + theValueArray[i] ; 
        system.debug('TheParms: ' + theParameters);
        }
        }  
        else
        {
          theParameters = '';
        }
        
        theMockUpName = 'Mock Up: ' + theOpportunity.Name;
        theAmount = String.ValueOf(theOpportunity.Amount);
        if (theAmount != null && theAmount != '') {
        theAmount = theAmount.Substring(0,3);
        }
        else
        {
          theAmount = '0';
        }
         
        theOpportunityID = theOpportunity.Id; 
        theAccountID = theOpportunity.Accountid; 
        theAccountName = theOpportunity.Account.Name;
        theOppName = theOpportunity.Name;
        theOppNumber = theOpportunity.Opportunity_Number__c;
        theQuote = theOpportunity.KI_Quote__c;  
        if (theOpportunity.KI_Quote__c != null && theOpportunity.KI_Quote__c != '') {
        theQuote = theOpportunity.KI_Quote__c;  
        }
        else
        {
          theQuote = '';
        }
        theSalesRep = theOpportunity.Sales_Representative__c;
        theDistrictName = theOpportunity.District_Name__c;
        theRegion = theOpportunity.Region__c;
        theProjectCoordinator = theOpportunity.Project_Coordinator__c;
        theOpportunityID = theOpportunity.id; 
        TheURL = '/a0G/e?CF00N500000026uRE=' + theOppName + '&CF00N500000026uR5=' + theAccountName + '&00N50000002pCi0=' + theOppNumber + '&00N50000002pCuV=' + theQuote + 	'&00N500000026uRM=' +  theSalesRep + '&00N50000002pCmW=' + theDistrictName + '&00N50000002pCmb=' + theRegion + theParameters + '&00N500000026uRK=' + theAmount + 	'&00N500000026uRK=' + theProjectCoordinator + '&Name=' + theMockUpName + '&retURL=/' + theOpportunityID + ' target="blank"';  
          system.debug('TheURL 1: = ' + TheURL);
        //TheURL = EncodingUtil.URLENCODE(TheURL,'UTF-8');
            system.debug('TheURL 2: = ' + TheURL);
        theBuiltURL = TheURL;    
        }  
     return null;
    }

 
I am using an "Quick Action" to create the same functionality that a button had in Classic.  There is always a phantom box that does not close without user interaction. It must be some type of QuickAction container? Can this be closed automatically somehow?   Thought using the NavigateToSObject would force the "Action" to redirect.
<apex:page standardController="Contact" showQuickActionVfHeader="false">
   <script src="/soap/ajax/33.0/connection.js" type="text/javascript"></script>
    <script> var previousOnload = window.onload;
     window.onload = function() { if (previousOnload) { previousOnload(); }
        if( (typeof sforce != 'undefined') && (sforce != null) ) {
        sforce.one.navigateToURL('https://Somewhere.com/sfdc/APlace?UserId={!$User.Id}&SessionId={!$Api.Session_ID}&ServerEndPoint={!$Api.Partner_Server_URL_260}&SFDCId={!Contact.Id}&SFDCIdType=Contact');
        sforce.one.navigateToSObject('{!Contact.Id}');
        }
        else {
       	window.location="https://Somewhere.com/sfdc/APlace?UserId={!$User.Id}&SessionId={!$Api.Session_ID}&ServerEndPoint={!$Api.Partner_Server_URL_260}&SFDCId={!Contact.Id}&SFDCIdType=Contact')";
      	sforce.one.navigateToSObject('{!Contact.Id}');
       }       
  }  
</script>
</apex:page>
User-added image
 
The user would like a batch job to run at an unspecified intraval to clear a hidden field.  This could cause problems if it updates a record that someone is currently editing.  I have not found a posting that explains how to identify if a record is currently being edited.  Is that possible in APEX?   This is not a on a custom object or through a visualforce page. Just want to see if the Opportunity record is currently in th process of being modified.  IE..The user pressed the "EDIT' button.

I know that I can specify if my process is updating something.  How can I check the record is already being updated at the time I check.

I have seen postings about records being "locked" for an approval process that is not what I am referring to here.
Curious what the best approach is to replace custom buttons that are currently using OnClick Javascript or URL since they are no longer supported when switching to Lightning Experience. Is it best to replace the classic buttons by building a new buton using the Lightning Design System framework within Lightning components and then adding to the page layout?
Not sure what the best way to accomplish this task.  There is a request to log a record each time a record of a specific type is opened.  There is not a concern if it was updated.  They want to capture the document name,  the user that opened the record and a date time.  There has to be multiple ways to do this but I was just wondering what the best way to accomplish this.        
Could someone please clarify this topic about Salesforce1?   Say we are talking about the Opportunity page layout.  Is it possible to define an Opportunity page layout for users viewing pages through Salesforce1 on their phone and a different Opportunity page layout for the same users viewing through a browser on their desktop computers.  I keep reading contradictary information.  
Hi All

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

User-added image
A javascript button extracts string data from a textarea.  The string has a newline character of "\r\n" inside the html.   When the javascript line is extracted it looks like this -

var TheDrawingNumber = "{!tenrox__c.KI_Drawing_Space_Plan__c}"; 

An error of "Unterminated string constant" is displayed.

How can the value be extracted without the javascript blowing up? 

Is there a way like "{!tenrox__c.KI_Drawing_Space_Plan__c.replace(/(\r\n|\n|\r)/gm, "%2c") }";
Hi,
I came from vb6 and I try to write some code into visual studio express 2013 desktop. I look to this link "https://developer.salesforce.com/page/Integrating_Force.com_with_Microsoft_.NET" for get some ideas but i don't found the solution to my problem .
i need to update some fields of contact, this is my code, anyone can help me please? thanks
i imported into vbnet wsdl enterprise "wsdl.jsp.xml" from my salesforce 

Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
        'sf = service references
        'sforce1 = web references
        Dim SfdcBinding As sforce1.SforceService = New sforce1.SforceService
        Dim CurrentLoginResult As sforce1.LoginResult

        CurrentLoginResult = SfdcBinding.login("myuser", "passtoken")

        SfdcBinding.Url = CurrentLoginResult.serverUrl
        SfdcBinding.SessionHeaderValue = New sforce1.SessionHeader
        SfdcBinding.SessionHeaderValue.sessionId = CurrentLoginResult.sessionId
        Dim contact() As SF.Contact
        contact(0) = New SF.Contact ' i use sf because sforce1 haven't a list of object lead,case,opportunity,contact,account...
        contact(0).Id = "0032000000Hppxn"
        contact(0).MobilePhone = "34911111111"

        Dim saveResults As sforce1.SaveResult
        saveResults = SfdcBinding.update(contact(0)) ' <---- HERE i have an error when compile: cannot convert sf.contact into matrix sforce1.sobject

        If saveResults.success Then
            MsgBox("update ok")
        Else
            MsgBox("update ko")
        End If
      
    End Sub
Would like to write an afterupdate trigger against the Salesforce "Partner" object.  It is not availble to pick in the Eclipse IDE.  Is this some type of setting in Eclipse that I missed? 

I am unable to refresh an access_token using the rest api.  I am making the following POST:

 

POST /services/oauth2/token HTTP/1.1
Host: login.salesforce.com
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&client_id=<cid>&client_secret=<cis>&refresh_token=<rt>

 

with appropriate vales for <cid>, <cis> and <rt>.  I am getting a 400 error with the following values returned:

 

{
"error": "invalid_grant",
"error_description": "token validity expired"
}

 

Does anyone know what is going on?  When I pass in a known invalid refresh_token I get a different error:

 

{
"error": "invalid_grant",
"error_description": "expired access/refresh token"
}

 

So, I think my refresh token is valid.  I can't find any information explaining the meaning of "token validity expired".  I have tried the refresh immediately after receiving the refresh_token and after waiting for a few hours.  Any help would be appreciated.

 

  • September 05, 2013
  • Like
  • 0
For some reason, whenever I use a record ID within a custom link or button, Salesforce is passing in the 15-character ID instead of the 18-character ID. In the past, I have coded around this on my own (using case-sensitive comparisons and substrings) but I'm now running into an issue where it's not possible to use these tricks.

Why is SF only passing the 15-character ID and how do I make it use the 18-character ID?

Thanks,
Mike