• Bella
  • NEWBIE
  • 50 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 45
    Replies

I'm trying to dynamically populate the multiselect param on a custom apex:selectList. When I explicitly set it to true or false, it works. However when I pass the boolean from the controller, it always acts as if it's false.

Here is the section of the visual force page:

<apex:selectList value="{!es.inputText}" size="{!es.sizeList}" multiselect="{!es.multiselectVal}">
<apex:selectOptions value="{!es.picklist}">
</apex:selectOptions>
</apex:selectList>

This is in a list. es.sizeList is either 1 or 3 depending on whether the object is a regular picklsit or a multiselect picklist. This gets set and rendered correctly. I've tested it out, and all the multiselects come up with a size of 3 while all the regular ones come up with a size of one. In the same part of the controller I'm also setting the es.multiselectVal boolean (true for multiselect, false otherwise). When I print out the value next to the list, it reads true and false as expected. However all my lists still come up as single select picklists

 

Any ideas? Is there something special about that param that it can't use a boolean from the controller?

  • April 10, 2012
  • Like
  • 0

Hi, I'm looking for some kind of app that can check the security of my code for me. I thought I saw something like that out there but now I can't seem to find it. Does anyone know of any suck application?

  • October 13, 2011
  • Like
  • 0

Hi I have a rather odd situation I wonder if someone can help me with. I have an apex trigger that uses a custom assignment object to fill out some fields on an account converted from a lead. A few are just text fields but it's supposed to also change the owner to whatever user is listed on the custom assignment record it picked up.

 

Now the strange part is that while all the text fields are always correctly filled out, the owner only works correctly when a user with profile A does the conversion. If user with profile B does it, the text fields will be filled out correctly but the owner will be wrong. I don't get any apex exceptions and both profiles have full read/write access to all the objects in question, so I'm at a loss as to why this keeps happening.

 

Can someone explain to me, in as much detail as possible, what are the standard rules for ownership of contacts upon lead conversion? Because at this point I'm thinking that in one case the standard rules work but in another my trigger does custom assignment. Any help would be greatly appreciated.

  • January 12, 2011
  • Like
  • 0

Hi,

 

I'm trying to get a good handle on the /lead/leadconvert.jsp page and I'm wondering if anyone can help. I set up my convert button on the lead to redirect to this page and I'm filling out the URL in an apex controller. The question I have is is it possible (through URL construction or otherwise) to gray out certain field on that page so that they're no longer editable?

 

Specificly I need to be able to gray out the "Do Not Create Opportunity" checkbox. Depending on some fields from the lead, that checkbox should always be either checked or unchecked for me, but a user shouldn't be able to change it on that page.

 

Any help would be appreciated. Thanks!

  • December 08, 2010
  • Like
  • 0

I'm trying to return a list of articles with certain key words, but I'd like it to be dynamic. In the controller I have a public string keywords {get; set;} with the content of a search bar when the user clicks the search button. Then I have a visual force component connected to this controller and I have:

 

<knowledge:articleList articleVar="article"
pageSize="10"
pageNumber="1"
keyword="{!keywords}">

But I can't save it because I get an "Unknown Property: keywords" error. I have other fields being pulled from the controller sucessfully and the keywords is set as a public string with getters and setters. Any thoughts about this error? Thanks!

  • November 09, 2010
  • Like
  • 0

Hi, I have a weird thing going on and I'm trying to see if my theory is plausible. I'm working in an environment where, for some reason, the account, contact, and opportunity created by lead conversion is always assigned to the person doing the converting rather than the lead owner. None of my other environemts do that, which makes me think there's something else going on.

 

There's a lot of other code - not writen by me - that works on lead conversion. I've done my best t trace it, and some of it has to do with owner assignment, but nowhere does it say "Take current user and assign to lead, account, contact, or opportunity". I am wondering, however, if it's possible that the code searches for someone to assign upon lead conversion, then, not having found anyone, assigns the current user by default.


Can anyone think of any setting, any default, that would do that? I'm a little at a loss here...

  • October 25, 2010
  • Like
  • 0

Hi, is there any way to know if a contact and opportunity come from a lead conversion rather than a regular insertion? I need to write an apex trigger on insertion for both of those objects, but ONLY for those that come from a converted lead. For contacts, I'm thinking I can probably try to look at all inserted contacts then match on email within the lead (email is a required field) but I'm not sure about Opportunities. Is there a good way to differentiate? Thanks!

  • October 18, 2010
  • Like
  • 0

Hi. Does anyone know if there's any way to pop up a visual force page through a schedualed class? For instance, I'd like a certain vf page to pop up every hour on the hour. I thought I'd do this through a scheduled class like this:

 

 

global void execute(SchedulableContext ctx) {
	callPage();
}
    
public PageReference callPage(){
	PageReference pageRef =  new PageReference('/apex/somepage');
	return pageRef;
}

 

The class runs without any errors but nothing happens. Does anyone know how to achive this? Thanks!

 

 

 

 

  • September 01, 2010
  • Like
  • 0

Hi, I'm wondering if someone can help me out with an interesting issue. I have a custom button on a custom object that, when pressed, generates a single page pdf with inform from both that object and its child objects. Let's say sales orders and sales order line items. The controller is very simple: select sales order with sf id from the current page, then select all sales order line items which reference this sales order. Whole thing works great.

 

Now I would like to have a button on the sales order front view. I'd like to select sales orders from the view, press the button, and generate pdfs for all the sales orders and sales order line items in the same way. A sequence of connected pages (one per group of sales order + its line items)  would be great or multiple single page popup would also work. Basically I'm trying to get many pages without going to each individual sales order and clicking on the button.

 

Here's what I have so far:

 

1)      I know I need to use the ApexPages.StandardSetController to get the button on the view. That’s done and the button does appear there.

2)      I can select all the sales orders and make a map of sales orders to a list of its corresponding line items.

 

What I’m having trouble with:

 

1)      Picking only the selected sales orders. I keep trying to use the getSelected(); function on the ApexPages.StandardSetController, but it’s not working. Again, in my controller I want to get a list of only the items I picked in the view.

2)      Once I have that, I have trouble understanding how to pass everything to the visual force page, how to modify it so that it goes through the list of sales orders per page, then picks up the list of corresponding line items using the maps.

 

Can anyone help with this? Give me some guidance? Thank you!

  • July 07, 2010
  • Like
  • 0

Could someone please tell me what is the apex equivalent for {!API.Partner_Server_URL_80}? I'm trying to create a page reference for Conga Merge. Also does {!API.Session_ID} == UserInfo.getSessionId()? Thanks!

  • June 04, 2010
  • Like
  • 0

I'm not sure if this is possible, but is there any way I can make a new instance of an object if I only have the type of the object saved as a string? What I mean is, I have a string called sObjectType which gets set on a visual force page and contains either "Account" or "Contact" or any other type of salesforce object. In my apex method I need to make a new instance of this object for insertion but the catch is that I can't do Account a = new Account() or anything like that directly since all I know about the type is whatever's in my sObjectType variable. Given this information, can I make this happen?

 

Something like this maybe?

 

 

String obj = 'some object from vf page';
obj variable = new obj();
List<obj> objList = new List<obj>();
objList.add(variable);
insert objList;

 

Thanks in advance!

 

  • June 03, 2010
  • Like
  • 0

I'm wondering if there's any way I can do the following thing:

 

1) From an account, I need to display a report (in an imbeded vf page for instance) of certain objects related to that account

2) Display a graph, comparing certain numerical fields on those related records.

 

So for instance if I have sales orders related to an account, I'd like to see a pie chart that would display the comparison of the totals on all the sales orders for that acocunt.

 

Is there any way I can achive this? Thanks!

  • May 25, 2010
  • Like
  • 0

I'm working on salesforce to salesforce sharing and I find that while I can share products, I cannot share pricebooks between instances of salesforce. Has anyone else come across something like this? It seems that I can share everything but pricebooks (ie all custom objects, accounts, contacts, leads, etc)? Can anyone point me to a good source about salesforce to salesforce sharing? Thank you so much in advance.

  • May 21, 2010
  • Like
  • 0

I have a piece of code that is only supposed to run if the record was last modified by a user with a specific sf id. It works perfectly in sandbox but the problem is I need to get it into production so I have to have enough test coverage and the test is running as me and I'm not the user. Is there a way I can pretend to have the required Id? To force the test to run as if that user was loged in?

  • May 13, 2010
  • Like
  • 0

I have a really weird thing going on in my code. I need to make a pdf based on some fields from an opportunity and the opportunity owner. I click a button which directs me to a vf page where those fields are updated. Based on those updates (the most recent information) I then need to generate the final pdf and save it as an attachment to the opportunity, but what I save seems always a version behind. What I mean is, if on my intermediate page, if I select a "show lable" checkbox, the pdf in the attachment should have a label. If I uncheck it, it shouldn't. If I just call the visual force page directly, it's always up to date, always picks up the most rect information from the opportunity and owner, but when I look at the attachment, it's always a version behind, like whatever changes I'm making don't show up till next time. I have a feeling it's a problem with the PageReferance class but I don't know how else to do this. Can anyone help? Here's the skelleton of my code. This code gets called from the second button, saves the attachment, and redirects to the VF page (though really it should redirect to the atachment I just saved, but that's never up to date.)

 

 

try{
	update u;
	update o;
}catch(DmlException ex){
	ApexPages.addMessages(ex);
}

PageReference pageRef =  new PageReference('https://c.cs2.visual.force.com/apex/PDF?Id=' + o.Id);
Attachment a = new Attachment(Name = 'attachmentName.pdf', ParentId = o.Id, Description = 'attachmentDescription', Body = pageRef.getContentAsPDF());			
	
try{
	insert a;
}catch(DmlException ex){
	ApexPages.addMessages(ex);
}

String aId = a.Id;
aId = aId.substring(0, 15);
o.Generated_PDF__c = 'https://cs2.salesforce.com/servlet/servlet.FileDownload?file=' + aId;

try{
	update o;
}catch(DmlException ex){
	ApexPages.addMessages(ex);
}

return pageRef;

 

  • May 04, 2010
  • Like
  • 0

Hi, I have a question about the use of a multi-select picklist on a VF page. I have a custom multi-select picklist on an Opportunity and what I need to do is display all the selected items from that picklist on a VF page and have them look something like this:

 

"Item 1, Item 2, Item 3...." or "N/A" if none are selected.

 

How would I do that? The only function I found that deals with multiselect picklists is INCLUDES and I have a lot of items in the picklist so it would be a pain to do it through if... then statments. Thanks in advance!

  • April 29, 2010
  • Like
  • 0

I have a pdf document generated from fields on an opportunity. I need to then attach it to the opportunity it came from. So far I have code that looks like this:

 

 

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://c.cs2.visual.force.com/apex/PDF?Id=' + o.Id);
req.setMethod('GET');
HttpResponse res = h.send(req);
Attachment a = new Attachment(Name = 'Attachment Name', ParentId = o.Id, Body = Blob.valueOf(res.getBody()));
insert a;

 

 

When I run it, it clreates an attachment and attaches to the right opportunity, but the attachment itself is not the pdf but rather some small text file that reads:

 

The URL has moved <a href="https://cs2.salesforce.com/visualforce/session?url=https%3A%2F%2Fc.cs2.visual.force.com%2Fapex%2FPDF%3FId%o.Id">here</a>

 

 

Can anyone help me figure out what's going on? Again, all I need to do is take a pdf generated by a vf page and attach it to the coresponding opportunity. Thanks!

  • April 27, 2010
  • Like
  • 0

Could someone please tell me how I would update a record from a custom vf page? I'm selecting fields from opportunities and useres and passing them to a custom vf page, then possibly editing them on that page, and those edits should be reflected in the records. How would I do that? Thanks!

  • April 23, 2010
  • Like
  • 0

Hi, I'm wondering if there's any way I can make a link in a visual force page that would allow me to download an object (pdf file, excel sheet, etc) from Content (ContentVersion) object? All I found so far is this:

 

 

<apex:page standardController="Attachment">
    <apex:outputLink 
      value="{!URLFOR($Action.Attachment.Download,
                      attachment.id)}">
      Download Now!
    </apex:outputLink>
</apex:page>

 but that's not very helpful because I can't seem to find the actual URL to pass. Anyone try this? Thanks!

 

  • April 16, 2010
  • Like
  • 0

Quick (hopefully) question. I need to add a specific user to a public group. Ids for both are listed within an object called Fund Document Entitlments, so all I have to do is use those two ids, but I'm not sure how. Here's my code so far:

 

 

public static void AddUserToPublicGroup(List<Fund_Document_Entitlement__c> items){
	Set<Id> portalIds = new Set<Id>();
	Set<Id> publicGroupIds = new Set<Id>();
	for(Fund_Document_Entitlement__c fde : items){
		portalIds.add(fde.Customer_Portal_User_ID__c);
		publicGroupIds.add(fde.Public_Group_ID__c);
	}
		
	List<Group> pgList = [select Id from Group where Id in: publicGroupIds];
	List<User> uList = [select Id from User where Id in: portalIds];
		
	for(Fund_Document_Entitlement__c fde : items){
		for(Group pgroup : pgList){
			for(User u : uList){
				if(fde.Customer_Portal_User_ID__c == u.Id && fde.Public_Group_ID__c == pgroup.Id){
					//what do I put here
				}
			}
		}
	}
}

 Somehow I need to say "add the user with user Id u.Id into group pgroup.Id. How do I do that? Thanks!

 

  • April 07, 2010
  • Like
  • 0

I'm trying to dynamically populate the multiselect param on a custom apex:selectList. When I explicitly set it to true or false, it works. However when I pass the boolean from the controller, it always acts as if it's false.

Here is the section of the visual force page:

<apex:selectList value="{!es.inputText}" size="{!es.sizeList}" multiselect="{!es.multiselectVal}">
<apex:selectOptions value="{!es.picklist}">
</apex:selectOptions>
</apex:selectList>

This is in a list. es.sizeList is either 1 or 3 depending on whether the object is a regular picklsit or a multiselect picklist. This gets set and rendered correctly. I've tested it out, and all the multiselects come up with a size of 3 while all the regular ones come up with a size of one. In the same part of the controller I'm also setting the es.multiselectVal boolean (true for multiselect, false otherwise). When I print out the value next to the list, it reads true and false as expected. However all my lists still come up as single select picklists

 

Any ideas? Is there something special about that param that it can't use a boolean from the controller?

  • April 10, 2012
  • Like
  • 0

Hi, I have a weird thing going on and I'm trying to see if my theory is plausible. I'm working in an environment where, for some reason, the account, contact, and opportunity created by lead conversion is always assigned to the person doing the converting rather than the lead owner. None of my other environemts do that, which makes me think there's something else going on.

 

There's a lot of other code - not writen by me - that works on lead conversion. I've done my best t trace it, and some of it has to do with owner assignment, but nowhere does it say "Take current user and assign to lead, account, contact, or opportunity". I am wondering, however, if it's possible that the code searches for someone to assign upon lead conversion, then, not having found anyone, assigns the current user by default.


Can anyone think of any setting, any default, that would do that? I'm a little at a loss here...

  • October 25, 2010
  • Like
  • 0

Hi, is there any way to know if a contact and opportunity come from a lead conversion rather than a regular insertion? I need to write an apex trigger on insertion for both of those objects, but ONLY for those that come from a converted lead. For contacts, I'm thinking I can probably try to look at all inserted contacts then match on email within the lead (email is a required field) but I'm not sure about Opportunities. Is there a good way to differentiate? Thanks!

  • October 18, 2010
  • Like
  • 0

Hi. Does anyone know if there's any way to pop up a visual force page through a schedualed class? For instance, I'd like a certain vf page to pop up every hour on the hour. I thought I'd do this through a scheduled class like this:

 

 

global void execute(SchedulableContext ctx) {
	callPage();
}
    
public PageReference callPage(){
	PageReference pageRef =  new PageReference('/apex/somepage');
	return pageRef;
}

 

The class runs without any errors but nothing happens. Does anyone know how to achive this? Thanks!

 

 

 

 

  • September 01, 2010
  • Like
  • 0

Hi,

How do you create/display a small popup windows right in the middle just to inform the users some information and when a user click Ok the popup window will go away? Please advice. Please send sample codes if available.

 

thanks

Paul

 

  • August 02, 2010
  • Like
  • 0

Hi, I'm wondering if someone can help me out with an interesting issue. I have a custom button on a custom object that, when pressed, generates a single page pdf with inform from both that object and its child objects. Let's say sales orders and sales order line items. The controller is very simple: select sales order with sf id from the current page, then select all sales order line items which reference this sales order. Whole thing works great.

 

Now I would like to have a button on the sales order front view. I'd like to select sales orders from the view, press the button, and generate pdfs for all the sales orders and sales order line items in the same way. A sequence of connected pages (one per group of sales order + its line items)  would be great or multiple single page popup would also work. Basically I'm trying to get many pages without going to each individual sales order and clicking on the button.

 

Here's what I have so far:

 

1)      I know I need to use the ApexPages.StandardSetController to get the button on the view. That’s done and the button does appear there.

2)      I can select all the sales orders and make a map of sales orders to a list of its corresponding line items.

 

What I’m having trouble with:

 

1)      Picking only the selected sales orders. I keep trying to use the getSelected(); function on the ApexPages.StandardSetController, but it’s not working. Again, in my controller I want to get a list of only the items I picked in the view.

2)      Once I have that, I have trouble understanding how to pass everything to the visual force page, how to modify it so that it goes through the list of sales orders per page, then picks up the list of corresponding line items using the maps.

 

Can anyone help with this? Give me some guidance? Thank you!

  • July 07, 2010
  • Like
  • 0

Could someone please tell me what is the apex equivalent for {!API.Partner_Server_URL_80}? I'm trying to create a page reference for Conga Merge. Also does {!API.Session_ID} == UserInfo.getSessionId()? Thanks!

  • June 04, 2010
  • Like
  • 0

I'm not sure if this is possible, but is there any way I can make a new instance of an object if I only have the type of the object saved as a string? What I mean is, I have a string called sObjectType which gets set on a visual force page and contains either "Account" or "Contact" or any other type of salesforce object. In my apex method I need to make a new instance of this object for insertion but the catch is that I can't do Account a = new Account() or anything like that directly since all I know about the type is whatever's in my sObjectType variable. Given this information, can I make this happen?

 

Something like this maybe?

 

 

String obj = 'some object from vf page';
obj variable = new obj();
List<obj> objList = new List<obj>();
objList.add(variable);
insert objList;

 

Thanks in advance!

 

  • June 03, 2010
  • Like
  • 0

I have a piece of code that is only supposed to run if the record was last modified by a user with a specific sf id. It works perfectly in sandbox but the problem is I need to get it into production so I have to have enough test coverage and the test is running as me and I'm not the user. Is there a way I can pretend to have the required Id? To force the test to run as if that user was loged in?

  • May 13, 2010
  • Like
  • 0

I have a pdf document generated from fields on an opportunity. I need to then attach it to the opportunity it came from. So far I have code that looks like this:

 

 

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://c.cs2.visual.force.com/apex/PDF?Id=' + o.Id);
req.setMethod('GET');
HttpResponse res = h.send(req);
Attachment a = new Attachment(Name = 'Attachment Name', ParentId = o.Id, Body = Blob.valueOf(res.getBody()));
insert a;

 

 

When I run it, it clreates an attachment and attaches to the right opportunity, but the attachment itself is not the pdf but rather some small text file that reads:

 

The URL has moved <a href="https://cs2.salesforce.com/visualforce/session?url=https%3A%2F%2Fc.cs2.visual.force.com%2Fapex%2FPDF%3FId%o.Id">here</a>

 

 

Can anyone help me figure out what's going on? Again, all I need to do is take a pdf generated by a vf page and attach it to the coresponding opportunity. Thanks!

  • April 27, 2010
  • Like
  • 0

How do I pass an account id into filter field on a custom report via a link on the account record?

 

Want to create a generic report that I can run directly from any account record page.  Is it possible to click the link, have the account id passed into the report filter criteria field then run report?

 

Help is appreciated.

 

 

I just read the posting "Modal Dialogs in Visualforce.." on the force.com blog, http://wiki.apexdevnet.com/index.php/Tutorial:_Modal_Dialogs_in_Visualforce_using_the_Yahoo%21_User_Interface_Library .

 

I was wondering if you can do this same thing, using a custom button or link on a standard salesforce page. So basically launch a custom modal dialog off of a standard page, and then have the content from the dialog update the standard page. Any ideas?

3 days old (new) to salesforce!
i need to invoke a webservice from a tab like contacts when a button is clicked.
i understand i can add a custom button, but how do i write the code behind it, which will be triggered upon clicking.
the code behind the buttons needs to invoke this webservice, passing some details from the screen such as customer name and postcode, and the response that is received should be displayed on the screen.

please help people !