• metaforce
  • NEWBIE
  • 375 Points
  • Member since 2009

  • Chatter
    Feed
  • 15
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 60
    Replies

Hello EveryOne,

 

I'm trying to write a Test class for the below Apex class. While runnig the test class i'm getting error like

"System.QueryException: List has no rows for assignment to SObject

 

Class.sendemail.sendEmailOnContacts: line 13, column 1 Class.sendemail.TestshowContacts: line 54, column 1"

 

 

Please find the below mentioned code snippet-

 

public class sendemail
{
String STR;
public sendemail()
{
STR=apexpages.currentpage().getparameters().get('id');
system.debug('Debug Statements=====>'+STR);
}
public pagereference sendEmailOnContacts(){
try
{

contact conobj=[select id,email from contact where id=:STR];
system.debug('Email Data=========>'+conobj.email);



Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String VarEmailSetting=conobj.email;
String[] toAddresses = new String[] {VarEmailSetting};

System.debug('<==============>'+toAddresses);

mail.setToAddresses(toAddresses);
mail.setSubject('Contact Information');
mail.setPlainTextBody('Hi You Are Added To Our System As Contacts');
mail.setReplyTo('jaan.vivek746@gmail.com');
mail.setSenderDisplayName('HR Management');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });


pagereference pagref=new pagereference('/'+conobj.id);
return pagref;
}
catch(System.EmailException ex)
{
system.debug('no emailid========>');
return null;
}

}
//**********************Test Class************************
static testMethod void TestshowContacts()
{
sendemail testObj=new sendemail ();
Contact con = new Contact();
con.FirstName = 'abc';
con.LastName = 'hi';
con.Email = 'abc.hi@gmail.com';
insert con;
Messaging.SingleEmailMessage testmail = new Messaging.SingleEmailMessage();
String testVarEmailSetting=con.Email;
String[] testtoAddresses = new String[] {testVarEmailSetting};
testmail.setToAddresses(testtoAddresses);
testObj.sendEmailOnContacts();
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { testmail });
 }
}

 

 

I don't have much hands on on sfdc but i'm eager to learn it.

 

It would be great help if you suggest me in this case.

 

 

Thanks for your valuable help.

 Your suggestions are always welcome.

 

Vivek


How to write the below code in SOQL format?

 

SQL:-

 

SELECT ROW_NUMBER() 
        OVER (ORDER BY EmployeeName) AS Row, 
    EmployeeId, EmployeeName, Salary 
FROM Employees where Row BETWEEN 2 AND 4

How can i write a trigger in note standard object

Hi all, I've been making some tests with Suvbersion plugin in a Salesforce project. I've established the following workflow:

 

  1. Team -> Update
  2. Change code
  3. Team -> Update
  4. Merge (if needed)
  5. Team -> Commit
  6. Force.com -> Save to Server

The problem wih this process is that nothing prevents someone from saving changes to server without commiting in first place.

 

Has someone faced this problem? Any hints on how managing this?

 

Thanks in advance!

Jésica.

  • December 16, 2011
  • Like
  • 0

Hi,

 

  I'm having an issue trying to update an account record using a future method.  It is necessary to use the future method because ultimately I want the record to be updated from the result of a webservice method.  From what I understand, callouts are only allowed from future methods.

 

I was following the pattern outlined here.

http://www.cheenath.com/?tutorial/sfdc/sample1/index.html

 

Here Is my code:

 

 

public class setAccount
{
    @future(callout = true)
    public static void setWebsite(String AccountID) 
    {
        //Account a = [SELECT Website from Account where Id =:AccountID];
        Account acc = new Account(Id=AccountID);
        //tempuriOrg.Service1Soap Service = new tempuriOrg.Service1Soap();
        acc.Website = 'http://www.helloworld.com';//Service.HelloWorld();
        update acc;
    }

}

 

trigger CreateTegrityInstances on Account (before update, before insert) 
{
    //setAccount webServiceThing = new setAccount();
    for(Account a : Trigger.new)
    {
        setAccount.setWebsite(a.Id);
        //update a;
    }
}

 

 

 

If I remove the update acc the exception goes away.  

 

Here is the exception:

Update failed. First exception on row 0 with id 001T000000hRmldIAC; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CreateTegrityInstances: execution of BeforeUpdate caused by: System.AsyncException: Future method cannot be called from a future method

 

 

Any help you can provide is greatly appreciated.

 

Thank you.

  • April 01, 2011
  • Like
  • 0

Hi,

I'm having problems with a test class that fails on a validation rule even when it shouldn't.
When running it, it's failing with the following reason: 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, mapOwnerInfoToAccount: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id 0012000000e1kjCAAQ; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Store-ID can not be populated when Status is set to Prospecting. You need to choose the status Test Mode or Live.: [Status__c] Trigger.mapOwnerInfoToAccount: line 150, column 2: []


But in the test case, the Status__c is set to Live, so it shouldn't be a problem.
Though when I look through the log of the test case it seems to pass first and then it just fails, can't understand why.
Copied a part of the log:

11:51:59.049|WF_ACTIONS_END| None
11:51:59.049|CODE_UNIT_FINISHED|Workflow:Account
11:51:59.051|DML_END|[150]
11:51:59.051|VF_PAGE_MESSAGE|Store-ID can not be populated when Status is set to Prospecting. You need to choose the status Test Mode or Live.
11:51:59.052|EXCEPTION_THROWN|[150]|System.DmlException: Update failed. First exception on row 0 with id 0012000000e1kjCAAQ; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Store-ID can not be populated when Status is set to Prospecting. You need to choose the status Test Mode or Live.: [Status__c]
11:51:59.058|FATAL_ERROR|System.DmlException: Update failed. First exception on row 0 with id 0012000000e1kjCAAQ; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Store-ID can not be populated when Status is set to Prospecting. You need to choose the status Test Mode or Live.: [Status__c]

 

Some code from the test class:

 

 

Account a1 = new Account(Name='testkonto',
        CurrencyIsoCode='SEK',Country__c='Sweden',Industry='Art and Design');
        insert a1;
        a1.Status__c = 'Live';
        a1.Store_ID__c='9999';
        update a1;

 

And here's the trigger that I'm testing:

 

 

trigger mapOwnerInfoToAccount on Account_Owner_Info__c (after insert, after update) {

	List<String> storeids = new List<String>();
	Map<String, Account_Owner_Info__c> aoifs = new Map<String, Account_Owner_Info__c>();

	for(Integer i = 0; i < Trigger.new.size();i++)
	{
		if(Trigger.new[i].EID__c <> '')
		{
			storeids.add(Trigger.new[i].EID__c);
			aoifs.put(Trigger.new[i].EID__c, Trigger.new[i]);
		}
	}
	
	List<Account> accounts = [
	SELECT
		Id,
		EOI_Agree_with_pno__c,
		EOI_Number_of_Owners__c,
		EOI_Orgno__c,
		EOI_Owner_1_First_Name__c,
		EOI_Owner_1_Last_Name__c,
		EOI_Owner_1_Pno__c,
		EOI_Owner_2_First_Name__c,
		EOI_Owner_2_Last_Name__c,
		EOI_Owner_2_Pno__c,
		EOI_Submitter_name__c,
		EOI_Submitter_Pno__c,
		Store_ID__c,
		Status__c
	FROM
		Account
	WHERE
		Store_ID__c IN :storeids
	];
	
	List<Account> accountsToUpdate = new List<Account>();
	
	for(Account a : accounts)
	{
		Account_Owner_Info__c ao = aoifs.get(a.Store_ID__c);
		if(a.EOI_Agree_with_Pno__c == null && a.EOI_Submitter_Pno__c == null)
		{
			a.EOI_Agree_with_Pno__c = ao.Agree_with_Pno__c;				
			a.EOI_Number_of_Owners__c = ao.Number_of_Owners__c;
			a.EOI_Orgno__c = ao.Orgno__c;
			
			a.EOI_Owner_1_First_Name__c = ao.Owner_1_First_Name__c;
			a.EOI_Owner_1_Last_Name__c = ao.Owner_1_Last_Name__c;
			a.EOI_Owner_1_Pno__c = ao.Owner_1_Pno__c;
			
			a.EOI_Owner_2_First_Name__c = ao.Owner_2_First_Name__c;
			a.EOI_Owner_2_Last_Name__c = ao.Owner_2_Last_Name__c;
			a.EOI_Owner_2_Pno__c = ao.Owner_2_Pno__c;
			
			a.EOI_Submitter_name__c = ao.Submitter_name__c;
			a.EOI_Submitter_Pno__c = ao.Submitter_Pno__c;
			
			accountsToUpdate.add(a);
			
		}
	}
	
	update accountsToUpdate;
}

(I removed some additional variables so line 150 is the one where the update is fired).

 

 

 

Could you guys maybe give me a clue about what the problem is?

This post stems from another post about our orgs issue with overall test coverage issue, the link to the previous post is here:

http://boards.developerforce.com/t5/Apex-Code-Development/Code-Coverage/td-p/257383

 

We found out that there were some classes installed in our production that do not have any code coverage and is bringing our overall coverage to around 35%.  There is also a managed package installed that is causing test failures.  These issues are not allowing us to develop and deploy any custom code.

 

If I developed custom code in a developer org and deployed the custom code we need as a managed package, would it deploy OK?  I've installed other managed packages into our production so I'm thinking this may be the way to go. 

 

Any suggestions or advice?  Thanks!

I have a button that opens a VF page in a new window to collect a few fields of data.  I have the header and sidebar hidden in this new page.  I'd like the new page to be about smaller that a normal full window.  I can add css width and height on Pageblock, but that doesn't seem to work.  Can anyone offer the best way to do this?
  • May 28, 2009
  • Like
  • 0

 

 Hi All,

 

I want to rerender a dependent picklist as per the value of a master picklist, I am facing a strange behavior here. On re-render all the stuff other than the dependent picklist is updates like text field.

 

Here is the code, on change of "category"picklist I want to rerender "categoryValue". I tried using the Id of dependent picklist but thats not working so, I am rerendering the complete form.

 

 

 

<apex:page controller="RerenderController">



<h1>Select a Category</h1>
<apex:form id="theForm">
<apex:actionFunction name="onCategoryChange" action="{!onCategoryChange}" reRender="theForm" />

<apex:selectList value="{!category}" size="1" onchange="onCategoryChange()">
<apex:selectoptions value="{!categories}"/>

</apex:selectList>
&nbsp; &nbsp; &nbsp;
<apex:selectList value="{!categoryValue}" size="1">
<apex:selectoptions value="{!categoryValues}"/>
</apex:selectList>

&nbsp; &nbsp; &nbsp;
<apex:outputText value="{!categoryValuesAsCSV}" />


</apex:form>

</apex:page>

 

 

public class RerenderController {
private static Map<String, List<SelectOption>> catValueMap = new Map<String, List<SelectOption>> ();

static {
List <Selectoption> fruits = new List<SelectOption>();
fruits.add(new SelectOption('Apple','Apple'));
fruits.add(new SelectOption('Grape', 'Grape'));
fruits.add(new SelectOption('Banana','Banana'));
fruits.add(new SelectOption('Orange','Orange'));
catValueMap.put('Fruits', fruits);

List <Selectoption> animals = new List<SelectOption>();
animals.add(new SelectOption('Dog','Dog'));
animals.add(new SelectOption('Cat', 'Cat'));
animals.add(new SelectOption('Monkey','Monkey'));
animals.add(new SelectOption('Donkey','Donkey'));
catValueMap.put('Animals', animals);

List <Selectoption> computers = new List<SelectOption>();
computers.add(new SelectOption('Dell','Dell'));
computers.add(new SelectOption('Compaq', 'Compaq'));
computers.add(new SelectOption('Acer','Acer'));
computers.add(new SelectOption('Apple','Apple'));
catValueMap.put('Computers', computers);
}

public List<SelectOption> categories {get ; set;}
public String category {get ; set;}
public List<SelectOption> categoryValues {get ; set;}
public String categoryValue {get ; set;}

{
categories = new List<Selectoption>();
categories.add(new Selectoption('Fruits', 'Fruits'));
categories.add(new Selectoption('Animals', 'Animals'));
categories.add(new Selectoption('Computers','Computers'));


}

public String getCategoryValuesAsCSV () {
String csv = '';
if (categoryValues != null) {
for (Selectoption so: categoryValues ){
csv += so.getValue() + ' , ';
}
}
return csv;
}

public void onCategoryChange() {
categoryValues = catValueMap.get(category);
}
}

 

 

 I tried searching on the boards, but people are saying this problem can be because of required fields in the form. But my form is not having any such data. 

 

Please help.

Message Edited by abhinavgupta19 on 05-27-2009 06:38 PM

This is actually not a visualforce development question.

 

I added the visualforce page to Account page in the page layout editor, but it seems there is a limit of the length.

This page is a tab like thing to show the related contacts on this account.

 

If there are too many records on the visualforce page, only the first few (around 12) will show up. There's no "more" link and no scroll bar. Some times it even only show the upper half line of the record.

 

Anyone have encountered this? 

 

Thanks in advance!

Hi,

 

I created a two input fields for Fathers name and Guardians Name in visual force page, in this i want to make either one field value is required. For example here user can enter either Fathers Name or Guardians Name or else he can enter values in both fields.Here i tried if condition for checking but i'm not getting the output.Can any one help me to solve this.

 

My Visualforce Page code:

 

<apex:page controller="prac"> <apex:pageBlock > <apex:form > <p><apex:outputLabel value="Father"/></p> <apex:inputText value="{!Father}" id="fName"/> <p><apex:outputLabel value="Guardian"/></p> <apex:inputText value="{!Guardian}"/> <p><apex:commandButton value="Save" action="{!mySave}"/></p> </apex:form> </apex:pageBlock> </apex:page>

My Apex Class Code:

 

public class prac { string fname; string gname; public string getFather() { return fname; } public void setFather(string s) { this.fname=s; } public string getGuardian() { return gname; } public void setGuardian(String s){ this.gname=s; } public pageReference mySave() { pageReference newPage; if(fname == null) { newPage=Page.currentPage; } newPage=page.NextPage; return newPage; } }

 

  • May 27, 2009
  • Like
  • 1

Is there any way to update a list managed and loaded from a server-side visualforce controller via javascript? Obviously I can extend the drop down on the client side that is attached to the list, but on post back it errors off saying the value is not valid.

 

Thanks!

Zack 

How do we test code that's dependent on an approval process or workflow field update? the reason I ask this question is because we are working with managed packages, and whenever we try to create a patch org, no configuration (workflow/approval process) gets created, and so corresponding test methods fail.

 

Let me how what are the best practices in such cases?

 

Thanks

Ajay

 

 

I am seeing this error from today morning which is causing a delay in my client package release:

 

core.apexpages.el.adapters.metadata.ApexObjectValueMetadataELAdapter cannot be cast to java.lang.String

 

Is anyone else facing the same problem?

 

Need urgent help!!

 

Ajay

Managed beta package got created and uploaded successfully but when trying to install on test org, getting this weird error:

 

Error Number: 1430644609-5758 (-1866127068) 

 

with no appropriate message which could have helped debug the problem.

 

Please advise. 

Hi

 

I intend to build an application for student evaluation. Broadly, the app will offer the ability to:

 

1. define the number of pages in a test

2. number of questions on each page

3. each question can be any one of the predefined type (radio, checkbox, plain text, etc)

 

What can be the best approach to implement the desired functionality as after I've designed the test, I need to render the appropriate form components dynamically (radio, checkboxes, textboxes, etc) on the VF page depending on the questions selected for the test.

 

Please let me know if someone has done the similar thing before and if can provide the sample code or point me in the right direction so I can get started.

 

Am open to using VF native components, HTML controls, third party libraries like YUI/ExtJS/Flex.

 

Thanks in advance 

I've tried almost all combinations, but i couldn't make the Dashboard tab visible on the partner portal. This tab is, however, visible to the salesforce internal user. I've made sure that the Dashboard tab is included in my application.

Is it by design that Dashboard tab has not been made available on the Partner Portal? I noticed that this tab doesn't appear in the list of "Standard Tab Settings" for Partner User profile, but when am on "Settings" under App Setup -> Customize -> Partners -> Partner Portal -> "Customize Portal Tabs" button,I see the Dashboards tab in the list of available tabs. I select it and move it to Selected Tabs list, but still it is not visible on the partner portal user login.

Am I going wrong somewhere?

Am trying to upload a package from my dev org. The package gets created successfully (both in case of unmanaged and managed) but when I click on upload, it throws a weird error which is non suggestive of the cause. The following "Component c" error message is displayed:

 

Component error in package upload 

 

Not sure why this is occuring, this came last week also when we were working on the Spring 09 release and it used to go away all of a sudden without any reason.

 

But after Summer 09 release last weekend, this error consistently comes up whenever we upload a package. Does anyone know if this is a bug?

We deployed managed beta package on our sandbox environment and since then we haven't been able to access a VF page which displays Account details on a tabbed layout. This custom VF page includes default related lists as well as other custom VF pages in tabs. It throws an "Insufficient Privileges" error.

 

On sandbox after deployment, we can access this page internally as admin profile user, but the partner portal user with Gold Partner Usr profile sees this error. Noticed an odd thing that on the Gold Partner Profile Edit page, no class deployed in the managed package is visible in the "Enabled Apex Class Access" section, is this the expected behavior? Can I assume that the partner user profile will have access to these classes? Is it because of the missing classes here or some other reason?

 

Need an immediate help here. Any pointer is greatly appreciated.

 

Thanks. 

We deployed managed beta package on our sandbox environment and since then we haven't been able to access a VF page which displays Account details on a tabbed layout. This custom VF page access refers to default related lists as well as other custom VF pages. It throws an "Insufficient Privileges" error.

 

On sandbox after deployment, we can access this page internally as admin profile user, but the partner portal user with Gold Partner Usr profile sees this error. Noticed an odd thing that on the Gold Partner Profile Edit page, no class deployed in the managed package is visible in the "Enabled Apex Class Access" section, is this the expected behavior? Can I assume that the partner user profile will have access to these classes? Is it because of the missing classes here or some other reason?

 

Need an immediate help here. Any pointer is greatly appreciated.

 

Thanks. 

Message Edited by metaforce on 06-05-2009 10:13 AM

Hi 

 

I am new to YUI and am looking for sample implementation of YUI Autocomplete Combobox control on VF page.

 

Please share if anyone has already done that.

 

Thanks!

Hello. I have a custom VF component which contains an <apex:selectList> component, as follows:

 

<apex:component controller="picklistController" id="compPickList">
<apex:attribute name="SystemEntity" description="" type="String" required="true" default="Account" assignTo="{!systemObject}"></apex:attribute>
<apex:attribute name="picklistField" description="" type="String" required="true" default="Type" assignTo="{!picklist_Field}"></apex:attribute>
<apex:attribute name="value" description="" type="String[]" required="true"></apex:attribute>
<apex:selectList id="ddlPickList" value="{!value}" multiselect="true" size="4">
<apex:selectOptions value="{!pickListOptions}"></apex:selectOptions>
</apex:selectList>
</apex:component>

 

The component's controller is obvious, so am skipping it for now.

 

The component acceps two attributes which it uses to populate the selectList options. I am using this component in a page and it works fine, i.e. am able to retrieve the selected values from the component into the page as long as am working with the pre-populated options, the code is as follows:

 

 

<apex:page controller="sampleCon" id="myPage"> <apex:form id="myForm"> <c:sObjectFieldPicklistComponent id="accountPicklist" value="{!accountIndustry}" picklistField="Ownership" systemEntity="Account" /> <apex:commandButton value="Test" action="{!SaveValues}" /> </apex:form> </apex:page>

 

I am again skipping the page controller code as it's obvious, but do let me know if you want to see it.

 

Now, the problem starts when I add dynamic <option> to this multi-select picklist through JavaScript, am able to add them in the browser on the client side, but when I click on the command button to submit the user selected values, the previously working code breaks, the values are not submitted, the execution never enters the action function (in this case - SaveValues()), and I get a message in the System Log window:

 

myPage:myForm:accountPicklist:compPickList:ddlPickList: Validation Error: Value is not valid

 

Any idea what's happening here? I am suspecting that the system (not me) is checking the submitted values against the viewstate and is throwing an error somewhere which I am unable to trap and trace.

 

Can someone please explain this behavior, and if possible, a solution to get this thing going?

 

Thanks in advance!

Ajay

I have a simple formula field, below, which evaluates correctly when viewing it in the page layout.

 

if (User__r.Profile.Name = 'System Administrator', 'FIXED TRUE', User__r.Profile.Name)

 

The problem I have is when I try and lookup / reference the field in SOQL, i get a different result to what i see in the page layout, SOQL below:

 

select name, isActive__c from Incentive_Plan__c where user__c =:UserId

 

For the simple formula field logic above, the SOQL query returns the value 'PT1 ', I have no idea where it is getting this value from !

 

Hope someone can explain this behaviour.

 

Thanks

  • July 04, 2012
  • Like
  • 1

Hello EveryOne,

 

I'm trying to write a Test class for the below Apex class. While runnig the test class i'm getting error like

"System.QueryException: List has no rows for assignment to SObject

 

Class.sendemail.sendEmailOnContacts: line 13, column 1 Class.sendemail.TestshowContacts: line 54, column 1"

 

 

Please find the below mentioned code snippet-

 

public class sendemail
{
String STR;
public sendemail()
{
STR=apexpages.currentpage().getparameters().get('id');
system.debug('Debug Statements=====>'+STR);
}
public pagereference sendEmailOnContacts(){
try
{

contact conobj=[select id,email from contact where id=:STR];
system.debug('Email Data=========>'+conobj.email);



Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String VarEmailSetting=conobj.email;
String[] toAddresses = new String[] {VarEmailSetting};

System.debug('<==============>'+toAddresses);

mail.setToAddresses(toAddresses);
mail.setSubject('Contact Information');
mail.setPlainTextBody('Hi You Are Added To Our System As Contacts');
mail.setReplyTo('jaan.vivek746@gmail.com');
mail.setSenderDisplayName('HR Management');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });


pagereference pagref=new pagereference('/'+conobj.id);
return pagref;
}
catch(System.EmailException ex)
{
system.debug('no emailid========>');
return null;
}

}
//**********************Test Class************************
static testMethod void TestshowContacts()
{
sendemail testObj=new sendemail ();
Contact con = new Contact();
con.FirstName = 'abc';
con.LastName = 'hi';
con.Email = 'abc.hi@gmail.com';
insert con;
Messaging.SingleEmailMessage testmail = new Messaging.SingleEmailMessage();
String testVarEmailSetting=con.Email;
String[] testtoAddresses = new String[] {testVarEmailSetting};
testmail.setToAddresses(testtoAddresses);
testObj.sendEmailOnContacts();
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { testmail });
 }
}

 

 

I don't have much hands on on sfdc but i'm eager to learn it.

 

It would be great help if you suggest me in this case.

 

 

Thanks for your valuable help.

 Your suggestions are always welcome.

 

Vivek


How to write the below code in SOQL format?

 

SQL:-

 

SELECT ROW_NUMBER() 
        OVER (ORDER BY EmployeeName) AS Row, 
    EmployeeId, EmployeeName, Salary 
FROM Employees where Row BETWEEN 2 AND 4

How to hide Home tab ?

How to chnage color of the standard tabs ?

How to side for particular objects (ideas) ?

How to create libraries under Libreies ?

Please answer me if posible 

Hi ,

 

How to render a VF page without hyperlinks.....

If using <apex:detail> tag i am rendering a page, it displays all sections...but alongwith [Change],[View Hierarchy] links. Is it possible to remove the links and render the page..

 

Is it possible to render all sections excluding System Information and Custom Links dynamically.

 

Please suggest.

 

Thanks and regards

Vasu

 

 

How can i write a trigger in note standard object

 

Why does the currency field not show up when viewing an account?  It is on the layout, and field level security is setup accordingly, but it will not show.

I don't really know html well and what I need to do is to just copy a simple microsoft word doc's content/format into a salesforce email template.  It looks like salesforce's email template would need to be html so that we retain the format.

The Microsoft word doc essentially just contains this 5 lines of simple text but there is one line where it's a text box and there is some text in the book. I was trying to see what online tools are available for converting word.doc to html but most of them only seems to copy the text info but not the actual box.

 

i tried to save the word doc as a web page so it is an html file and then just view the source page on firefox and copy/paste the code into salesforce's email template (for html), but the formatting is not exactly right and instead of showing the text in the box, it actually has in the box itself the text "Text Box: xxxxx" where xxxxx is the text that should be in the box. And also the xxxx was truncated so not all the text in the box showed up.

 

Can anyone offer some nifty way to convert word doc to an html email template?

  • December 16, 2011
  • Like
  • 0

I have several images stored in a zip file. I'm passing in a parameter to decide which one to display. Yet, I can't seem to get this to work:

 

<img alt="Chat Support" class="ssg-image-alignright" src="{!URLFOR($Resource.CSSimages, "{!Logo}")}" />

 

{!Logo} is the name of my image. i.e.:

 

MyImage.png.

 

The error I get is:

 

Description	Resource	Path	Location	Type
Save error: Element type "img" must be followed by either attribute specifications, ">" or "/>".	sc_kbsearch.component	/Sandbox/src/components	line 0	Force.com save problem

 Is there a way to get this to work the way I want? 

I have a custom field on the user object.
I would like to show this field on the account object, with the user field info related to the account owner!

Right now it is possible to show user information on the account page, but only user information of the user who created the record and the user who last modified the record. But not of the user who owns the record.

Is this possible?


Thanks in advance!

Hi all, I've been making some tests with Suvbersion plugin in a Salesforce project. I've established the following workflow:

 

  1. Team -> Update
  2. Change code
  3. Team -> Update
  4. Merge (if needed)
  5. Team -> Commit
  6. Force.com -> Save to Server

The problem wih this process is that nothing prevents someone from saving changes to server without commiting in first place.

 

Has someone faced this problem? Any hints on how managing this?

 

Thanks in advance!

Jésica.

  • December 16, 2011
  • Like
  • 0

Hi all 

 

How to add look up filters for look up fields in another objects plz help us how to do it.

Hi All,.

 

Normally  in dot net are java there is no limits but coming to salesforce it should have governor limits so Why governor limits are required in salesforce and what is the reason.Kindly let me know any one.

 

Thanks

Hi,

 

I can't seem to figure out formula language.  How would I write a validation rule that states if one check box is checked (true) then a second checkbox becomes required?  Thanks in advance.  :smileyhappy:

I have a strange problem, let me explain you the scenario :

 

1) I have installed a managed package with namespace (ankit), it includes a object name Sling and two recordtypes "test1" and "test2".

 

2) Now I have done some custom development on my personal org where I have installed that package. I have created a test class which looks something like this :

 

 

@isTest
private class MyTestClass
{
    private static testmethod void testM()
    {
        ankit__Sling__c s = [select id from ankit__Sling__c limit 1] ;
        System.debug('s :::::: ' + s) ;
        
        List<RecordType> rt = [select id from recordtype where sobjectType = 'ankit__Sling__c'] ;
        System.debug('rt ::::: ' + rt) ;
        
        List<RecordType> rt2 = [select id from recordtype] ;
        System.debug('rt2 ::::: ' + rt2) ;
        
        System.assertEquals(rt.size() , 2) ;
    }
}

 

 

3) Now I simply create another package which is unmanaged and include this test class in it, automatically package object sling and its record types are included. Now I have created a package(Unmanaged), and its done successfully. Now I am checking the debugs it gives me proper data (two record types are returned in test class and assert is passed).

 

Note : Till now I have not create a namespace for my organization.

 

4) Now what I have done is created a namespace on my organization and try to upload the same package(unmanaged) again. This time my test class get failed and the problem is no record type is returned whose sobjecttype is 'ankit_sling__c'.

 

My second debug

 

 

System.debug('rt2 ::::: ' + rt2) ;

 returns two record type which is expected, just wondering why these record types are not returned when I am putting where clause condition "where sobjecttype = 'ankit_sling__c' "

 

 

Is this is a bug??? I have tried this on multiple orgs and faced same problem everywhere.

Any directions over this will be great.

 

 

Thanks
Ankit Arora

 

Hey guys, Can you provide a hyperlink or a link to a URL through a Error message displayed as part of a Trigger? For example, instead of hardcoding the URL as shown below, use a markup to make it a link: c.addError('ERROR TRM100: There is already an identical record: Record Number '+cs.Number+' (https://na8.salesforce.com/'+cs.Id+')'); This currently reads as: Error: Invalid Data. Review all error messages below to correct your data. ERROR TRM100: There is already an identical record: Record Number 60311 (https://na8.salesforce.com/500M0000000mJJ9IAM) It would be great if I could make the "Record Number 60311" a hyperlink. Any idea is greatly appreciated. Thanks,
  • May 26, 2011
  • Like
  • 0

I know we can set the content-type header in visualforce using the contenttype attribute for <apex:page>, but can we set Content-Disposition?  E.g.

 

Content-Disposition:attachment;filename=myfile.xls

 

 

How can I determine the URL of a static resource from my Apex code?

 

I'm looking for the equivalent of the VisualForce $Resource variable, but one that I can use from with Apex code.

 

Thanks!

  • February 28, 2009
  • Like
  • 0