• amarcute
  • NEWBIE
  • 254 Points
  • Member since 2010

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 78
    Replies

Hello,

 

I want to get the far right single character of the string of characters below. It is a character Y in this case. What string/sub string function is best for this? Please advise. Any help is appreciated.

 

Examle:  1234ALOCN78UY

 

Thanks

Paul

 

  • August 20, 2013
  • Like
  • 0

Can I give an "id" the value in following manner while using <apex:inputfield> component?

 

<apex:inputField value={!x} id ="{!value}" />

 

What am trying to achieve here is; I have this inputField inside an <apex:repeat> component and I need to give it a separate id everytime this component gets repeated.

 

Any suggestion is helpful.

 

Thanks ~ justin_sfdc

How can I display the task activity date in the mm/dd/yyyy format on a visualforce page?  I have a custom page with an inputText that uses a DatePickerComponent, that will initially put the date into the correct format...i.e. 8/12/2013.  After saving the record and returning to the page to edit the record, the date is then in the format of: Mon Aug 12 00:00:00 GMT 2013, so if I try and update, it throws the error:

 

Value 'Mon Aug 12 00:00:00 GMT 2013' cannot be converted from Text to Date

 

How can I resolve this issue?

 

Thanks.

I have a trigger that will insert a feed item whenever an attachment is added to a record.  I've tried a few things to get a test class in place but am striking out.  Here is the trigger:

 

trigger attachmentTrigger on Attachment (after delete, after insert, after update) {
	
	if(trigger.isinsert) {
		for(Attachment a:trigger.new){
			//system.debug(a);
			feedItem f= new feedItem();
			f.ParentId=a.ParentId;
			f.Title=a.Name;
			//f.body=a.body;
			f.body=((Trigger.isInsert) ? 'New' : 'Updated') +'Attachment'+ ' '+ a.Name +' ' +'is added ';
			insert f;
			//system.debug('f.id--->'+f.id);
		}
	}	
	
	if(trigger.isdelete) {
		for(Attachment a:trigger.old){
			//system.debug(a);
			feedItem f= new feedItem();
			f.ParentId=a.ParentId;
			f.Title=a.Name;
			//f.body=a.body;
			f.body=((Trigger.isDelete) ? 'Attachment' : 'Deleted') + ' '+ a.Name +' ' +'is deleted ';
			insert f;
			//system.debug('f.id--->'+f.id);
		}
	}
}

 

Any help writing a test class would be hugely appreciated!

  • August 12, 2013
  • Like
  • 0

how do we add vf page with custom controllers  as a buttons  or link in  a detail pagelayout ,

 

I am trying to automate the Contract End Date for a renewal term.

I have a custom date field with the Renewal Term Start Date and the number of months in the renewal term.

I want a formula to deliver the new Contract End Date and take into consideration the possibilities of Leap Years.

 

I found a formula (below) on the board that calculates the new date when it is a year later. I know I have to convert the number of months into days first but that will depend on the start date. I am lost as to how to tackle this. Can someone take a shot at this for me?

 

 

DATE(
YEAR (AppDate__c) + (FLOOR((TODAY() - AppDate__c) / 365.2425) + 1),
MONTH(AppDate__c),
IF(AND(DAY(AppDate__c) = 29,MONTH(AppDate__c ) = 02) , 28, DAY(AppDate__c)))

Hi Team,

 

I have an object called "Projects" and fields on the project record. What I would like to attempt to acheive is when I create an Opp from the Projects object by clicking a create opp button, is to populate two or more fieldsfrom project into one field in an opp. Is this possible? Example below.

 

Projects Object 

 

Fields

Project Name: Freedom Middle School Gym

Project Owner: City of Bakersfield

City: Bakersfield

State: CA

 

The above fields to populate on field on an Opp below. See Example:

 

Opp Object

 

Field

Opportunity Name: Freedom Middle School Gym

                                   City of Bakersfield

                                   Bakersfield, CA   

I'm trying to implement the <support:clickToDial> component on a visualforce page, and it won't connect to the CTI adapter (Shoretel). It just has a greyed out phone icon and when you hover over it it says "Click to Dial Disabled". We know that the CTI adapter is set up correctly because we can click on normal phone fields within salesforce. 

Hi,

 

String.escapeSingleQuotes method making the query not to return any results if string contains a single quote

 

I'm using the method String.escaapeSingleQuotes() to make the user entered input to be safe from external Injections.

Here is the code snippet I'm using:

 

        param = String.escapeSingleQuotes(param);

        return Database.query('SELECT Id, Name FROM Account WHERE Name LIKE \'%'+param+'%\'');

 

This works fine if name does not contain any single quotes. Some of the Account names are having single quotes. For Example: L'oreal, O'connor, O'reilly etc

 

When I pass "L'ore"  as the param, String.escapeSingleQuotes() methods adds some / and ' and makes it as bellow (got it from Debug statements). I tried running the bellow query from workbench/force.com Explorer, it returns 0 results. Is it the expected behaviour?

 

SELECT Id,Name FROM Account WHERE Name LIKE '%L\\\'ore%'

 

HI 

 

We have a requirement for Integration btw SFDC system and External system(Java).

We need to Create different API's for each process like Create Case, Update Case, add Attachment and add Notes.

 

Is thare any standard API's for Create Case, Update Case, Add Notes and Add Attachment i.e. providing by Salesforce. I think there is a way for Accounts but any possibilites for above requirement.

 

Thanks,

Sravan.

 

Hi guys I am new to sales force

 

I am trying to create a managed package from my sandbox but its saying that its possible in your organization please try developer edition like that but I created lot of things in sandbox 

can any tell how to create a managed package in sandbox

 

Thanks in advance

 

Any body help me what are the main drawbacks of change sets..............?

I have a Reject button that when clicked, an alert message comes up asking the customer to fill in a certain box.  They click ok on the alert and the edit page comes up.  I'd like it to render to the field they are supposed to fill out, which is towards the bottom of the page.  

 

Here's whats going on in my code.  This is only for the customer users.  They click the Reject button, they get an alert message, they click ok.  The edit screen shows up and they can either add their reject comments and click Save or click Cancel.

 

Button code where customer logic happens:

//If current users profile is Customer Portal, fill in the current users name for Contact Rejected and fill in the current date and time 
if(profileName.indexOf("Customer")!=-1)
{
alert("You have selected to reject this change.  Please fill in the Contact Rejected Comments in the Rejected Information section towards the bottom this Change record.")
window.parent.location='/apex/rejectCustomer?Id={!Change__c.Id}&retURL=/{!Change__c.Id}';

 Apex Page:

<apex:page standardController="Change__c" extensions="rejectChangeCustomer" action="{!autorun}">


</apex:page>

 Apex Class:

public class rejectChangeCustomer
{
private final Change__c chge;    
public rejectChangeCustomer(ApexPages.StandardController controller) 
{        
this.chge=(Change__c)Controller.getrecord();     
}         
public pageReference autorun()
{          
ID Id =  ApexPages.CurrentPage().getParameters().get('Id');              

  
 
  

 PageReference retPage = new PageReference('/' + Id + '/e?retURL='+Id+'&00Na000000BA4IU=1&00Na000000BA4IW='+UserInfo.getName()+'&00Na000000BA4Ip=Rejected&00Na000000BA4IV='+DateTime.now().format().escapeHtml4()+'&saveURL='+Id);  
 retPage.setRedirect(true);
 return retPage;        
 }}

 

  • September 10, 2013
  • Like
  • 0

List   li=new List();

li.add("12");

li.add("13");

li.add("14");

li.add("12");

li.add("14");

 

My Requirment  Is Display only Duplicate values like 12 , 14 values ,  what i  do ?

ple guide me , how to do .    thank u in advanced.

 

 

 

 

The following error occurrs but I don't know how to solve this.

 

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'sf:MALFORMED_QUERY', faultstring:'MALFORMED_QUERY:
from Enrollment__c where Id IN (a0Fe000001LIGIEA4)
                               ^
ERROR at Row:1:Column:78
unexpected token: 'a0Fe000001LIGIEA4'', detail:{MalformedQueryFault:{exceptionCode:'MALFORMED_QUERY', exceptionMessage:'
from Enrollment__c where Id IN (a0Fe000001LIGIEA4)
                               ^
ERROR at Row:1:Column:78
unexpected token: 'a0Fe000001LIGIEA4'', row:'1', column:'78', }, }, }

 

The following is part of my code,

 

var PActivityQuery = "Select (Select Id From Program_Activities__r) From Enrollment__c WHERE Id = " + enrollObj.Id;
var PAqueryResult = sforce.connection.query(PActivityQuery);
var EnrollIt  = new sforce.QueryResultIterator(PAqueryResult);
while(EnrollIt.hasNext())
{
var tempPAEnroll = EnrollIt.next();
var newPActivity = [];
if(tempPAEnroll.Program_Activities__r)
{
var PAit = new sforce.QueryResultIterator(tempPAEnroll.Program_Activities__r);
while(PAit.hasNext())
{
var PActivityObj = PAit.next();

 Thanks

 

  • September 05, 2013
  • Like
  • 0

Hi is there anyway to export into excel ".xlsx" extension using visualforce page.

 

I am using contentType = "application/vnd.ms-excel#MyFile.xlsx" but gives en error while opening a file.

 

Excel cannot open the file 'MyFile.xlsx' becuase the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.

 

Please suggest me on this.

 

Thanks,

Hello!

 

I am writing a validation rule that would (in theory) work like this.  If the Status field is Approved, or Pending Renewal, then the End date on the record can be pushed out to 1 YEAR past its current original end date (date field stamped on the record.

 

I can get this to work on the 1 picklist value (approved) and it works fine, but when I try to add logic to add the additional value, it wont let me save the record even though it does not meet the criteria needed for this to not fire.  

 

NOT(IsPICKLIST(Status__c,"Approved")&&End_Date__c+365>Original_End_Date__c ||

NOT(ISPICKLIST(Status_c,"Pending Renewal")&&End_Date__c+365>Original_End_Date__c)

 

So you would this this word work correctly, but it seems to want to fire the rule every time no matter what.  Is there something small that Im missing?

Hi, i have 1000 reports in 100 folders. I need move the reports from original forder to a new folder.

 

Is there any way to do so through the metadata?

 

thanks

Hi,

 

I am having an issue with my test class not being able to save. the error I get is Unexpected token "insert"at line 16

 

Not sure why this is happening as this has never happened for this type of test class before.  Here is the code for the creation of an account and a custom object record called SPA

 

@isTest
public class triggerSPACRUD{
static testMethod void triggerSPACRUD(){
//insert account
account acc = new account(
acc.Name='test account');

insert acc;


SPA__c SPA = new SPA__c(
SPA.Recordtypeid= '012P00000004XHj',
SPA.Status__c = 'End User',
SPA.Dealer__c=acc.Id)
//fill all the required field and make sure your data passes the validation rules.
insert SPA;

}

 

Hi Folks,

 

I'm trying to run an insert using Data loader with command line interface. Below is my command:

 

        C:\Program Files\salesforce.com\Data Loader\bin>process.bat "C:\Program Files\Salesforce.com" accountInsert

 

 

Below is the output:

         

2013-08-22 12:45:14,402 INFO [main] controller.Controller initLog (Controller.java:382) - Reading log-conf.xml in C:\Program Files\salesforce.com\Data Loader\bin\log-conf.xml
2013-08-22 12:45:15,651 INFO [main] controller.Controller initLog (Controller.java:391) - The log has been initialized
2013-08-22 12:45:15,687 INFO [main] process.ProcessConfig getBeanFactory (ProcessConfig.java:103) - Loading process configuration from config file: C:\program files\salesforce.com\process-conf.xml
2013-08-22 12:45:16,506 INFO [main] xml.XmlBeanDefinitionReader loadBeanDefinitions (XmlBeanDefinitionReader.java:315) - Loading XML bean definitions from file [C:\program files\salesforce.com\process-conf.xml]
2013-08-22 12:45:16,708 INFO [accountInsert] controller.Controller initConfig (Controller.java:327) - config dir created at C:\program files\salesforce.com
2013-08-22 12:45:17,117 INFO [accountInsert] controller.Controller initConfig (Controller.java:355) - The controller config has been initialized
2013-08-22 12:45:17,150 INFO [accountInsert] process.ProcessRunner run (ProcessRunner.java:116) - Initializing process engine
2013-08-22 12:45:17,150 INFO [accountInsert] process.ProcessRunner run (ProcessRunner.java:119) - Loading parameters
2013-08-22 12:45:19,342 ERROR [accountInsert] config.Config decryptProperty (Config.java:692) - Error loading parameter: sfdc.password of type: java.lang.String
javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA13*..)
at javax.crypto.Cipher.doFinal(DashoA13*..)
at com.salesforce.dataloader.security.EncryptionUtil.decryptString(EncryptionUtil.java:210)
at com.salesforce.dataloader.config.Config.decryptProperty(Config.java:686)
at com.salesforce.dataloader.config.Config.postLoad(Config.java:638)
at com.salesforce.dataloader.config.Config.loadParameterOverrides(Config.java:664)
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:120)
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
2013-08-22 12:45:19,344 FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process accountInsert
java.lang.RuntimeException: com.salesforce.dataloader.exception.ParameterLoadException: Error loading parameter: sfdc.password of type: java.lang.String
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:162)
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: com.salesforce.dataloader.exception.ParameterLoadException: Error loading parameter: sfdc.password of type: java.lang.String
at com.salesforce.dataloader.config.Config.decryptProperty(Config.java:693)
at com.salesforce.dataloader.config.Config.postLoad(Config.java:638)
at com.salesforce.dataloader.config.Config.loadParameterOverrides(Config.java:664)
at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:120)
... 2 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA13*..)
at javax.crypto.Cipher.doFinal(DashoA13*..)
at com.salesforce.dataloader.security.EncryptionUtil.decryptString(EncryptionUtil.java:210)
at com.salesforce.dataloader.config.Config.decryptProperty(Config.java:686)
... 5 more

 

 

I first need to figure out the sfdc.password error. I am encrypting with encrypt.bat, and it is a concatenated value of my salesforce password + salesforce security token. I am under the impression this is how it should be encrypted. 

 

Any advice would be greatly appreciated!

 

Thanks,

 

 

  • August 22, 2013
  • Like
  • 0

We have a Visualforce page that contains a multi-select picklist field called Topics__c.  When a value of "Other" is selected I need to dynamically require another field called Other_Topic__c to be populated before the record can be saved.  There are several other fields on this page that are required and the page controller is checking that those fields are populated before the record can be saved.  My challenge is that I can't seem to correctly evaulate the values in the multi-select picklist prior to the record being saved to determine if Other_Topics__c needs to be required as well.  Below is the snippet of code from the page controller where I'm trying to evaluate the multi-select picklist values.

 

if (cl.Topics__c.contains('Other') && cl.Other_Topic__c ==''){
			bOk=false;
			ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL, 'Other Topic is a required field.');
			ApexPages.addMessage(myMsg);
		}

 I've found examples of how to query multi-select fields via SOQL, but since the record hasn't been written to the database yet I'm kind of at a loss.  With the code written as above I can choose "Other", with no value in Other_Topic__c and still save the record, which is bad.

 

Any help would be appreciated as I'm a relatively inexperienced coder, especially when it comes to APEX and Visualforce!

 

Hi,

 

             I am using chatter box in my vf i need to display the chatter at the right corner what i have to do..

Hello All, I’m trying to deploy a new change set of 3 components:

 

Account_RollupTrades

Account_RollupTradesTest

Account_RollupTrades trigger

 

After clearing out all test history, running ALL tests multiple times, my code coverage in the Production org is 83%. Same goes for the sandbox (83%).

Account_RollupTrades has 100% code coverage with 27/27 test methods passed in the sandbox.

Account_RollupTrades trigger has 100% code coverage with 3/3 test methods passed.

All custom settings, fields, and workflows are accounted for in both orgs.

@isTest is set to (SeeAllData = True) because it’s at version 28.0.

Debug logs are not showing me anything of concern.

 

When trying to deploy to production, it fails because the overall code coverage drops to 74% (below the required 75%).

 

 

How is it that 1 class, 1 trigger, and 1 test class could drop an entire org’s code coverage by 9% when they have 100% coverage?

Have any of you heard of this issue before? Can a sandbox display incorrect code coverage data?

i have a system admin profile

i want to provide users with chatter license access to reports and dashboards.

can anyone brief me how can i achieve this?