• MrTheTyler
  • NEWBIE
  • 214 Points
  • Member since 2010

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 112
    Replies

I am interested in knowing if there is a way in which our organization could share our basic Salesforce set-up with another organization who has just acquired Salesforce. We are both non-profits with similar needs and we would like to share our basic set-up that they would then be able to customize to their needs rather than have to start from scratch. We are working collaboratively to better our communities and would like to share this information so they do not have to reinvent the wheel. Is there any way to share this information across organizations? Any help would be appreciated.

Hi All,

 

Is there a way where we can Migrate all of our data from one production org to other production org; like for configuration we do it by deploying metadata from one org to other.

 

Any help would be highly appreciated.

 

Thanks in Advance.

Uzair

  • September 06, 2012
  • Like
  • 0

Hi, I have a routine that downloads new and modified account information to local database.  The routine retrieves the information from salesforce using a SOQL query.  The query populates an array of Account objects which are then persisted to the local storage.  For some reason, the billing street is being loaded into the Account object with spaces instead of carriage return line feeds CRLF.

 

This creates a problem if I need to display the information in another program since I cannot determine what data belongs to Address line one vs Address line two.

 

Here's and example of what I am seeing

 

Address entered like this in sales force:

123 Anystreet

Dept. ABC

 

Address appears like this in loaded Account object:

123 Anystreet Dept. ABC

 

So, instead of a CRLF (Dec. 13 + 10)  in between the last "t" in street and "D" in Dept., I am finding a space (Dec. 32)

 

Any help would be greatly appreciated.

 

Thanks!

 

Jim

  • September 04, 2012
  • Like
  • 1

I need to create a VF Email template that creates an email message with a PNG attachment. The PNG content comes from an Attachment to the record that is the relatedToType for the email message.

 

I've created an email template that includes a messaging:attachment with renderAs="image/png" where the attachment's content comes from a custom component.

 

The template looks like this:

 

<messaging:emailTemplate subject="Test With Generated Attachment" recipientType="User" relatedToType="Account">
    <messaging:htmlEmailBody >
    <html>
    <body>
    <p>This email contains a PNG attachment where the content comes from an Attachment to the Account.</p>
    </body>
    </html>
    </messaging:htmlEmailBody>

    <messaging:attachment renderAs="image/png"  filename="test.png">
        <c:Sample />
    </messaging:attachment>
</messaging:emailTemplate>

 

The custom component looks like this:

 

<apex:component controller="Sample" access="global" >{!thePNG}</apex:component>

 

The component's controller looks like this:

 

public class Sample {
    public Blob thePNG {
        get {
            if (thePNG == null) {
                Attachment att = [select Body from Attachment where ParentId='001E000000Lr7wW' and Name='Casey.png' limit 1];

                // Returning att.Body results in an email message with a PNG attachment,
                // but the attachment can't be opened as a PNG
                return att.Body;
                
                // Assuming att.Body is Base64-encoded, I tried decoding it, but
                // the email doesn't appear to be sent.
                //return EncodingUtil.base64Decode(att.Body.toString());
            }
            return thePNG;
        }
        set;
    }
}

 Eventually, the query in the controller will be more sophisticated, getting the PNG from an Attachment related to the account record it's called with, but for now, it's simple. The point is that the PNG isn't in a well-known place like in a specific document -- it's in an Attachment related to the Account.

 

If the controller just returns the Attachment's Body, the email is sent with an attachment, but I can't open the PNG - it's not being sent as a valid PNG file. If I base64-decode the Body, the email doesn't even appear to be sent.

 

Given that the PNG is stored in an Attachment related to the Account, how can I include it as an email attachment in a VF email template?

 

Also, before you suggest it, I can't construct the email in Apex as a Messaging.SingleEmailMessage because the email has to be sent by workflow, not by Apex, to avoid the governor limits associated with the number of emails that can be sent via Apex in a 24-hour period.

 

Thanks for your help!

Hi...I have made one visualforce page & in that i have made one table.

I am giving different-different color to their each row by javascript & it is working fine in salesforce environment but when i render the same page as PDF then I am not getting any background color on that row ?

I need background color in PDF too.

Please tell me how can i get background color in PDF too.

THnaking you...

Hi everyone! I recently installed the Campaign Mass Task Creator (from AppExchange) and am getting the following error:

 

Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please clear the Completed Date/Time field until this task is marked Completed.

 

Anyone familiar with this app? Any thoughts on what is happening and how to fix it?? I desperately need to use this app or I will have to create 120 tasks manually! Thanks!

I have a selectList and I'd like to remove one of the values from the selectList as it should no longer be an option for new records, but I need to keep it for historical data so I don't want to delete the value.

 

Here is my apex code:

 

public List<SelectOption> getEngagementTypes() 
    {
        List<SelectOption> options = new List<SelectOption>();
      
        Schema.DescribeFieldResult rsEngagementType  = Schema.sObjectType.Pricing__c.fields.EngagementType__c.getSObjectField().getDescribe();
 		for(Picklistentry entry : rsEngagementType.getpicklistValues()) {
			options .add(new SelectOption(entry.getValue(), entry.getLabel()));   
        }  
             
        return options;
    }

 

Here is my visualforce page code for the selectList:

 

<apex:selectList value="{!Pricing__c.EngagementType__c}" rendered="{!isEditPage}" size="1" multiselect="false" styleClass="ddlEngagementType">
						<apex:selectOptions value="{!EngagementTypes}"/>
						<apex:actionSupport action="{!engagementChangeSave}" event="onchange" reRender="SaveMsg,PricingBaseServices" status="SaveStatus"/>
					</apex:selectList>

 

How can I remove a specific value from the selectList?

 

Thanks for any help.

I have a utility (userless application that runs on a schedule) which is hosted in amazon cloud and will need to store data in salesforce.  I would like to have some means by which the application can authenticate without needing the credentials of a specific user.

What I have seen in the past is a instance with many of these outside utilities all tied to one special "system process" account that no individual actually uses.  My concern here is that if this account becomes comprised, all of these critical utilities will have to be updated with the new credentials.

REST on a public site is one way to achieve this but the concern is that it allows anyone to post data to that endpoint and could be used in a malicious attack.  I have used a hardcoded password in the REST handler class before that looks for that password in a POST variable which, if not present, aborts the process but this seems less than ideal.

Any thoughts?

 
Hello,

  Looking for a way to report on the name and lastmodifieddate of all workflows.  What I've done thus far:
  1. I've looked at the describe metadata info for the workflow type but am not seeing any properties in there.  
  2. Also looked for standard sobjects and haven't found anything promising. 
  3. Looked for report types that allow for reporting on worflows - no luck
I know the data is in there, as when I look at workflow from web interface I can see created and modified info.

screenshot

More of a theoretical question - in the displayfields function below is it possible to do what I've done in pseudocode?

 

main(){
  sobject acc = [select name, phone from account limit 1];
  displayfields(acc);
}

static void displayfields(sobject x){
  //somehow loop through the available fields on the sobject
  //and display them
  for(field f:x.fields) system.debug(f.fieldname);  //should print out "name" , "phone"
}

 

Thanks!

 

Tyler

 

I found some interesting behavior today.

 

contact c  = new contact();
c.put('accountid', '');

system.debug(c.get('accountid')==null); //prints false
system.debug(c.accountid==null); //System.StringException: Invalid id: 

 

Why is the put() method allowed to update an ID field with an empty string if the direct route of c.accountid='' would raise an exception?

 

 

Cheers,

 

 

Tyler

it possible to programmatically know what fields are available for a given instance of an sobject? Let's say I have a function that takes in a contact sobject that is queried from the database, could it know if let's say the firstname field is available for the particular instance of the sobject and if it is print it out and if not, don't?

 

 

string printFirstname(contact C){
  if (c.firstname.isavailable) system.debug(c.firstname);
}

 

 

Thanks!

 

Tyler

 

 

I was curious to know if there is a best practice for designing unit tests that can handle the addition of new required fields to an object. For example, let's say that I have an insert trigger defined on a opportunity object.  so, in order to get complete code coverage I develop a test method which creates a dummy opportunity record. At the time of writing this test method I make sure that the dummy record has all the necessary fields included.  the dummy record is inserted and causes the insert trigger to fire and everything works fine. Let's say six months later a new field is added to the opportunity object and it is a required field. Would that not cause my test method to be invalid?

 

Just curious if anyone out there has experienced this issue in the past and what technique you used to deal with this circumstance.

 

~Tyler

If I create a custom object record that is linked to a lead and then that lead is converted to an opportunity and account, can I somehow traverse from the account or opportunity back to the originating lead and finally to the custom object?

 

 

Cheers,

 

 

Tyler

I've found using system.debug to be a little cumbersome so I created this little bit of code today to help myself and hope that it will help others too.   The most challenging part about this was simply reading through the documenation to find how to create a generic sobject handler and then iterate through the fields without knowing the object type beforehand. 

 

First thing to do is create a new object called debug.  Add fields for text and timestamp.  Add the controller and vforce page listed below.  From there you can call DebugPlus.writeLog() from your code or ExecuteAnonymous.  You can write a string or a list<sObject>.

 

 

Cheers,

 

Tyler

---------------------------------------

The Nerd Whisperer LLC

www.thenerdwhisperer.com

 

 

 

Controller

 

public class DebugPlus {

    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [select name,text__c, timestamp__c from debug__c order by name desc]));
            }
            return setCon;
        }
        set;
    }

    // Initialize setCon and return a list of records  
    
    public List<debug__c> getDebugEntries() {
         return (List<debug__c>) setCon.getRecords();
    }
    
    static public void writeLog(string s){
    	debug__c x = new debug__c();
    	x.Text__c = s;
    	x.timestamp__c = datetime.now();
    	insert x;
    }
    
    static public void writeLog (list<sObject> lo){
    	string output;
    	for (sobject o : lo){
    		output = '';
    		Schema.DescribeSObjectResult r = o.getSObjectType().getDescribe();
    		Map<String, Schema.SObjectField> M = r.fields.getMap();
    		
    		for (string fldname : M.keyset()){
    			try{
    				output = output + ' | ' + fldname + ':' + o.get(m.get(fldname));
    			}
    			catch(System.SObjectException e){}
    		}
    		
    		writelog(output);
    	}
    }
    
    static public PageReference clearLog(){
    	list<debug__c> lDbg = [select id from debug__c];
    	delete lDbg;
    	pagereference DebugPage= new pagereference(Page.DebugLogPlus.getURL());
		DebugPage.setRedirect(true);
		return Debugpage;
    }
}

 

 

vForce

 

<apex:page controller="DebugPlus">
    <apex:form >
    	<apex:commandButton action="{!ClearLog}" value="Clear Log" id="ClrLog"/>
    </apex:form>
    
    <apex:pageBlock >
    	<apex:pageBlockTable value="{!DebugEntries}" var="d">
			<apex:column value="{!d.name}"/>
            <apex:column value="{!d.Text__c}"/>
            <apex:column value="{!d.TimeStamp__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

 

 

Let's say I got 50,000 records in a table where there is a field named OwnerID.  Let's say I just want to grab a set of the distinct OwnerIDs and not be charged 50,000 query rows for my governor limits.  What ya'll have to say about 'dat?

 

 

~Tyler

I have a custom object but I'm using a layout generated page as opposed to a custom vforce page.  I want to add a bold, red line of text across the top of the page and I'm simply trying to avoid having to write a vforce page just to do this.  Any tips?

 

 

Tyler

I'm overriding the default tab view for the Case object.  It's all easy enough to add access to existing views via a dropdown, just like the default tab would have

 

 

      <apex:selectList value="{!filterId}" size="1">
        <apex:actionSupport event="onchange" rerender="list"/>
        <apex:selectOptions value="{!listviewoptions}"/>
      </apex:selectList>

 

 

But of course an overriden tab should provide the preexisting functionality which enables the user to create new views, edit existing ones, etc.  So is there a way I can leverage salesforce's code to provide the standard view links like below (Create New View | Edit | Delete | Refresh) in my custom visual force page?

 

 

 

Cheers,

 

Tyler

 

I've got 2 visualforce email templates which use

 

 

({!LEFT($Api.Partner_Server_URL_200, FIND(".com/",$Api.Partner_Server_URL_200)+3)

 

 

One template resolves this to "https://na8.salesforce.com" and the other resolves this to "https://na8-api.salesforce.com"

 

Anybody got the scoop on this one?

 

 

Cheers,

 

Tyler

 

Wow, I just can't seem to figure this simple thing out.  In a visualforce template I want to create a link to an object record. 

 

I've seen examples like this

 

 

({!LEFT($Api.Partner_Server_URL_140, FIND(".com/",$Api.Partner_Server_URL_140)+3)

 

but shouldn't I be able to use a simple relative URL to get this to work?

 

 

 

 

A new record was created!  <a href="/{!RelatedTo.ID}">Click here</a>  to see it.

 

 

However, when the email gets sent out the link becomes "http://5008000000dmoskaax/" and not "http://na8.salesforce.com/5008000000dmoskaax"

 

 

 

Any idears?

 

 

 

Tyler

 

 

 

I have 2 objects on which I want to report: Cases and Surveys.  Cases are master objects of surveys.   I've created a "Report Type" (Setup>Create>Report Types) which shows all cases with surveys fields even if there is no related survey (ie. a left outer join).

 

How can I segment my cases into 2 groups: cases with surveys and cases without surveys?

 

 

Cheers,

 

 

Tyler 

Is there a way for me to modify CRUD settings on a custom object for all profiles simultaneously?  

 

Thanks!

 

Tyler

I've got a custom object which has a lookup relationship to a case object.  I have a visualforce email alert  template in which I want to reference {!relatedto.RelatedCase__c.CaseNumber} .  The problem is that the {!relatedTo.RelatedCase__c} returns a string containing the objectID of the case and will not allow me to traverse through to the CaseNumber.  How might I accomplish this?

 

 

Many Thanks,

 

 

Tyler

if I write

 

 

string s= '\';

 

 

I get the error "line breaks not allowed in string literals".

 

 

However, if I find a text field in an object and fill it with only a '\' and do like so:

 

 

string s = [select fld from obj where id = 123abc].fld; 

 Everything is just swell.  What gives?

 

 

Tyler

 

I am creating a custom visualforce page with custom controller.  Several of my properties return non-sobject values such as string and boolean types.  As such no automatic label is created and I must use the outputLabel component.  When I do this as in the code sample below, the spacing between the label and bound field component are so great that it is confusing to the eye.  How would I go about specifying a tighter spacing? 

 

 

<apex:pageBlockSection title="Spacing Test">
		<apex:outputLabel value="Checkbox" for="theCheckbox"/>
		<apex:inputCheckbox value="{!inputValue}" id="theCheckbox"/>
</apex:pageBlockSection>

 

I have also tried simply putting raw text next to the input component such as:

 

 

<apex:pageBlockSection title="Spacing Test">
		ToCheckorNotToCheck<apex:inputCheckbox value="{!inputValue	id="theCheckbox"/>
</apex:pageBlockSection>

 

 

Cheers,

 

Tyler

 

 

Using Schema.DescribeFieldResult and getPicklistValues() one can get the labels, values, isenabled, and isdefault info on each entry in a picklist.   I am trying to figure out how to know if a picklist value for the status of a case indicates that the case is closed.  

 

 

Cheers,

 

 

Tyler

Been reading the docs (Using Constructors & Using Initialization Code) trying to understand when to use initializer vs. constructor.  In the "Using Initialization Code" link it is stated:

 

 

If you do not want to write your own constructor for a class, you can use an instance initialization code block to initialize instance variables. However, most of the time you should either give the variable a default value or use the body of a constructor to do initialization and not use instance initialization code.

 

 

It's a bit vague.  Is there a good rule of thumb to follow?

 

Cheers,

 

Tyler

On a Visualforce Page, I have a section which is collapsible by default and I use Javascript to toggle it
 
<script type="text/javascript">
    
    $(document).ready(function(){ 
        collapseSections();
        
    });
    
    function collapseSections(){
        $('img[id*="additionalProducts"]').each(function() {
            twistSection(this);
        });
    } 
</script>

<!--Some Code-->

<apex:pageBlockSection title="Service Products" id="additionalProducts" showheader="true" collapsible="true" columns="1">

<!--Some Code-->

The issue I'm having is should the user try to save, and a validation rule is flagged, when the page rerenders the section is collapsed again. I want the section collapsed on the initial page load, but if the user toggles the section down, saves, and hits a validation rule, I'd like the section to remain "uncollapsed".

Any ideas? I have a controller I can add code too as well if needed.

Thanks!
Hi,
I have written this trigger to append 'Dr' prefix for al lead names.but i am getting some error.Please help me.

"Error: Compile Error: expecting a semi-colon, found 'Name' at line 6 column 27"


trigger PrefixDoctor on Lead (before insert,before update) {
for(Lead l :trigger.new)
{
List<Lead> leadlist=new List<Lead>();
{
l.First Name='Dr.'+l.First Name ;
}
}
}

 

Hi,

 

Can someone please explain to me how the introduction of communities affects force.com users. My Salesforce sales rep is saying that after July 31, the force.com authenticated website users will be discontinued and you have to switch to communities. this does not make any sense to me as the communities functionality is not relevant to force.com. Can anyone please provide whatever information they might have. Customer community licenses as opposed to authenticated website licenses are about 5 times the cost for functionality that i dont want. All i want is authentication.

 

"The Authenticated Website high-volume portal user license is specifically designed to be used with Force.com sites. Because it's designed for high volumes, it should be a cost-effective option to use with Force.com sites."

https://na14.salesforce.com/help/doc/en/salesforce_platform_portal_implementation_guide.pdf

 

Thank you for your help.

 

Adam

Hello I have a scheduled class in Salesforce sandbox that runs a SOQL query on the Case object and checks for specific records. Once they are found, the class will send an e-mail out to specific users. However, the e-mail is going straight to the junk folder. Is there anything in the code I should add or change so the e-mail goes to the inbox?

Hi,

 

I have a problem with classes extensions, here a very simple example: 

 

 

public virtual with sharing class Car{

	protected String brand;
	
	public virtual String getBrand(){
		return this.brand;
	}
}

 

public with sharing class Mustang extends Car{

	protected String brand = 'Ford';

}

 

Controller:

Car myCar = new Mustang();

system.debug( myCar.getBrand() ); // return null

 

myCar.getBrand() should return 'Ford' but I get null.

 

Where is the problem?

 

Thanks.

I am interested in knowing if there is a way in which our organization could share our basic Salesforce set-up with another organization who has just acquired Salesforce. We are both non-profits with similar needs and we would like to share our basic set-up that they would then be able to customize to their needs rather than have to start from scratch. We are working collaboratively to better our communities and would like to share this information so they do not have to reinvent the wheel. Is there any way to share this information across organizations? Any help would be appreciated.

Hi All,

 

Is there a way where we can Migrate all of our data from one production org to other production org; like for configuration we do it by deploying metadata from one org to other.

 

Any help would be highly appreciated.

 

Thanks in Advance.

Uzair

  • September 06, 2012
  • Like
  • 0

Hi All,

 

    I have a requirment like i want to block those email address to create case whose extension is @something ,What I need to do this in email to case creation .

 

Any one please give me solution is highly appreciated.

 

 

Advance thanks

Samu

  • September 06, 2012
  • Like
  • 0

Hi -

I have an SSN field - it's encrypted for most users and for most applications/profiles.


However, one application needs to see the SSN, so I gave them access to view encrypted fields.

 

Now, they want to view it formatted as SSN, and they want it printed, like on their insurance forms, formatted as SSN - with all the numbers and the dashes.


How can I do this?

 

Thank you in advance -

Sara

  • September 05, 2012
  • Like
  • 0

Hi there

 

Wondering if anyone has similar experience.

 

I have an object that stores some equipment information.  Sometimes the user needs to send out a report of equipments that the customer may want to procure.  

 

The user can set up an "Equipment Type" filter and then run the report.

 

However occasionally sometimes the user may also want to include an equipment of another Equipment Type because, even though they are categorized differently, they do have a lot of things in common, so they want to include the extra equipement from another Equipment Type into the report as well for customer's consideration.

 

Anyway, the requirement is that, instead of setting a filter "Equipment Type = A", run the report, and then "Equipment Type = B" and run the report, is it possible to simply display a list of records to the user and then let the user select (probably via checkboxes) which individual records they want to go to the report?  i.e. rather than using a filter?

 

I suppose you could do that with VF and Apex (and use Apex to keep track of the record ID of the records selected?)

 

Before I tackle the VF and Apex,  wonder if you could do it using the standard SF's out-of-the-box feature.

 

Thanks

 

I set up a new Case queue that will be used to assign cases to a particular team based on the request.  The queue is setup with 'send email to members' as checked so I would think this would automatically email the case team if any cases were assigned to this queue.  But when we go to a case and assign the case to a queue, the 'send notification email' is not checked by default.  But when you change the owner to a user, the checkbox is checked by default.  How do we set this up so that queue members are automatically emailed if something is assigned to their queue?  I can't leave it up to users to always check that box - we'll have some critical cases missed.  Help would be appreciated.  thx

  • September 05, 2012
  • Like
  • 0

Hi Folks,

 

In our instance, we have some approval pages setup and whenever we try to include a long text field in the approval page AND something is in that text field, we get the error below. Any thoughts?

 

error on line 7 at column 1649: PCDATA invalid Char value 20

 

Many thanks!

 

All the best,

Peter

Hi, I have a routine that downloads new and modified account information to local database.  The routine retrieves the information from salesforce using a SOQL query.  The query populates an array of Account objects which are then persisted to the local storage.  For some reason, the billing street is being loaded into the Account object with spaces instead of carriage return line feeds CRLF.

 

This creates a problem if I need to display the information in another program since I cannot determine what data belongs to Address line one vs Address line two.

 

Here's and example of what I am seeing

 

Address entered like this in sales force:

123 Anystreet

Dept. ABC

 

Address appears like this in loaded Account object:

123 Anystreet Dept. ABC

 

So, instead of a CRLF (Dec. 13 + 10)  in between the last "t" in street and "D" in Dept., I am finding a space (Dec. 32)

 

Any help would be greatly appreciated.

 

Thanks!

 

Jim

  • September 04, 2012
  • Like
  • 1

Hi all has anyone does anyone know how to copy over the parent account of an opportunity using salesforce to salesforce?

 

if an opporunity is created it gets sent over to the partner org but i need its parent account to come over as well and have them linked. Has anyone else done this?

 

Cheers

  • September 04, 2012
  • Like
  • 0