• stunaite
  • NEWBIE
  • 23 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 34
    Replies

I am using the following code to create a popup on the Account page when a custom field is NOT NULL

 

<apex:page standardController="Account" rendered="{!Account.Facility_SOPs__c==null}">
 <script type="text/javascript">
     {
         window.alert("Please review Facility SOPs: {!Account.Facility_SOPs__c}");
     }
 </script>
</apex:page>

 If I remove the second = making the redered=NULL the popup will be displayed on accounts where the field is null.  I need the opposite to happen, but it doesn't appear to work when I designate NOT NULL using ==

Hi,

I'm trying to create a CNAME record on a registrar (Godaddy.com) so my company domain www.cloudland.co can be "redirected" to cloudland.force.com (which is my force.com sites domain). When I call www.cloudland.co on the browser it goes to login.salesforce.com instead of going to public cloudland.force.com. Any ideas to fix this thing? (I'm waisting tons of time with something that should be just take a couple of minutes).

Thanks in Advance

PS:
1 -  My org doesn't have the Custom Web Address field available
2 - Forward wih masking stops the site to work well on mobile browsers (cos it wrap the force.com page in a frame).

Hi.

 

How  can a user have read/write access (he is able to edit and save it ) on a record and is unable to delete it, if his profile has Read/Create/Edit/Delete all TRUE for the object which that records belong??? (the record isn't owned by this user but he has read/write access via a sharing rule)

 

Thanks in advance for any help (It is driving me nuts)

 

Joao

Hi,

 

I am trying to populate a list with all likes from a chatter feedItem

 

This is the query (pay attention that FeedLike can't be queried directly so using a subquery is the only way... as much as I know):

 

List<feeditem> feedItemLst = [select likeCount,(select feedItemid, feedEntityId from feedlikes) FROM feeditem WHERE likecount > 0

 

List<feedLike> feedLikeLst = new List<feedLike>();
for(FeedItem feeditemcr:feeditemLst){
    for(FeedLike feedlikecr: feeditemcr.feedlikes){ //results in an exception Aggregate query has too many rows for direct assignment, use FOR loop
        feedLikeLst.add(feedlikecr);
}
}

 

so I replace by:

 

List<feedLike> feedLikeLst = new List<feedLike>();
for(FeedItem feeditemcr:feeditemLst){
    for(sObject feedlikecr: feeditemcr.getsObjects('FeedLikes')){ //Returns a list with just 1 feedlike ignoring the remaining ones
        feedLikeLst.add((FeedLike)fl); 
    }
}

 

Does someone have an idea to overtake this?

 

Many Thanks in Advance

 

Joao

Hello All!

 

I have detected that there are scaling diferences between Santandard and Visualforce pages on mobile browsers

 

When a  mobile (Android or Apple IOS) browser loads a standard page, it allows the user to ZoomOut until all page fits the display size and all content is visible.

 

standard page view - max zoomout this the standard page with max zoomout

 

In contrast, VF pages don't allow the user to ZoomOut until all the page fit the screen.

 

 this the visualforce page with max zoomout

 

 

 

I have already inserted <meta name="viewport" content="width=device-width"/> with no results. Nor even <meta name="viewport" content="minimum-scale=0.1"/> causes any difference.

 

Note that this results are obtained with the same browser settings and I used different browsers. So it isn't a browser configuration issue (I have tryed to change settings without any result as well).

 

Tryed with <apex:page standardStylesheets="false" showheader="false" ... doesn't change the behavior either.

 

Any help we'll be extremely appreciated.

 

Regards

 

Hi!

 

I have created 2 different record types to Campaign.

 

rectype1 uses a standard page layout (lets call "STDCampaign")

rectype2 should use a Visual Force Page (lets call it  "Rectype2_VFP")

 

When I press "New" to create a campaign one page is showed (lets call it "RecType Page")  with a dropdown so I can choose the recordtype of the new object. After choosing I have to press "Continue" button.

 

Overriding the "New" button to a VisualForce Page (lets call it "redirect page") I intend to check what recordtype object is being created and redirect the flow to the right page:

 

if it is rectype2 I redirect it to  "Rectype2_VFP" ->  {!urlfor($Page.Rectype2_VFP)} 

 

if it is rectype1 Iamtrying to redirect to  "STDCampaign" -> {!urlfor($Action.campaign.new)} but unfortunately it is redirected to "RecType Page".

 

So I have to replace  {!urlfor($Action.campaign.new)} for something to overlap the "RecType Page" and goes straight to  "STDCampaign". 

 

here is the page:

 

<apex:page standardController="campaign" 
action="{!if($CurrentPage.parameters.RecordType = '012P0000000CqIX',urlfor($Page.SEP_CompetitionCreation),urlfor($Action.Campaign.new,$CurrentPage.parameters.RecordType))}">
</apex:page>

 

'012P0000000CqIX' is the recordtypeID for rectype2.

 

 

Any idea will be very appreciated!

 

 

 

 

Hi There.

 

I want to copy the standard behavior of field validation error on a visual force page.

 

here is my prototype:

 

Page:

<apex:page controller="Test">
    <apex:form > 
        <apex:pageBlock title="Hello {!$User.FirstName}!">
		<apex:inputtext value="{!ola}" id="e_validation"/> 
        <apex:commandButton action="{!save}" value="Save"/>    
        <apex:message for="e_validation"  />   
        </apex:pageBlock>  
    </apex:form>  
</apex:page

 And the controller:

public with sharing class Test {
	
	public String ola {get;set;}
	
	public PageReference save(){
		ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'test'));
		return null;
	}
}

 

Nothing happens when I click on save button. I expect that message 'test' appears bellow the inputtext component on visual page : (

Hi!

 

I have an object which is the child object on a Master-Detail relations ship. I am using a (just one) VisualForce page overriding New, Edit and Clone.

 

The field that is used to connect the child to the parent is like this on the page:

 

<apex:inputfield value="{!stdrcontroller.pointToParent__c}"/>

 

 

Results that I verified:

 

If I am in  "New" mode, an editable input field with a lookup button is generated - Right Behavior

if I am in  "Edit" mode, an output text is generated which makes sense once the connection to the parent has to be created at creation moment and cannot be changed so - Right Behaviour

If I am in "Clone" mode, an output text is generated which doesn't make sense once the object isn't created yet. I check that with the standard page and the behaviour is different so the field appears as an inputfield.

 

Any explanation for this or it is just a bug?

 

Thanks in advance

 

Joao

 

 

 

 

Hi,

 

I have a visualforce page with an <apex:messages/> tag. I have created a validation rule with an error message. To have a similar behavior with standard pages I need to break my validation rule error message in diferent lines so the error message appears in 3 different lines.

 

Standard Behavior:

 

                                                                     

                                                                               Error: Invalid Data. 

                                                Review all error messages below to correct your data. 

                                                                   Pair (Year/Product) already exists!

 

What I have now:

 

Error: Invalid Data. Review all error messages below to correct your data. Pair (Year/Product) already exists!

 

I tried to split the error message text in 3 different lines in my validation rule error message box:

 

Error message box in validation rule page:

 

Error: Invalid Data. 

Review all error messages below to correct your data.

Pair (Year/Product) already exists!

 

 

It had no effect. What characters should I include in error message to cause a real line break?

 

Thanks in advance

I activated th multicurrency in my organization and set up the DatedConversionRates object. It seems that doesn't have any influence in currency fields in custom objects.

 

Can someone confirm if DatedConversioCurrency doesn't work with custom objects fields?

 

Thanks

Is there some solution to do it from Apex Code? All I found was some "Core calls" to be used from an external aplication :-(

Hi!

 

I am trying to update currencyType and datsObject with dayly values from a webservice.

 

Unfortunately currencyType is one of those Standard Objects that don't support DML calls. However looking at CurrencyType definition

 

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_currencytype.htm

 

we found some supported calls (core calls) like create(), update(), delete() and so on.

 

Can I use this calls inside my apex code? If so, what is the syntax. An example we be very wellcome. All examples I found using this calls are in client applications so quite unesuful for my case.

 

Thanks in advance

 

 

 

Hi!

 

I want to use a webservice whose WSDL is unable to be imported by Salesforce. So I pick up its WSDL file as input for a SOAP Client "SOAP UI" which gave me the soap message to request de service:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:ConversionRate>
         <web:FromCurrency>USD</web:FromCurrency>
         <web:ToCurrency>EUR</web:ToCurrency>
      </web:ConversionRate>
   </soapenv:Body>
</soapenv:Envelope>

 So what I need is to send this SOAP message through my apex code. I tried this skeleton:

 

 

//setting endpoint
string serviceUrl = 'http://www.webserviceX.NET/currencyconvertor.asmx';

Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(serviceUrl); 
req.setMethod('POST');
req.setTimeout(10000);

HttpResponse res = h.send(req);
string bodyRes=res.getBody();

 What should I add to my code in order I can send the SOAP message above?

 

Thanks in Advance

Hi All!

 

Where can I subscribe a new Force.com Free Edition account.? I didn't found any information that Free Edition isn't available anymore.

 

Please help ASAP!

Hi,

 

I just want to focus on a inputtextbox than the first, when a page is opened. But it doesn't work.

 

 

<apex:page controller="focus">
	<apex:form id="f1">
	<apex:inputtext id="field1" />
	<apex:inputtext id="field2" />
	</apex:form>		
	<script>
		function focu(){
			document.getElementById('{!$Component.f1.field2}').focus();
		}
		
		focu();
	</script>
</apex:page>

 

 

Curiously, using a command button focus is correctly moved to 2nd inputtext box.

 

 

<apex:page controller="focus">
	<apex:form id="f1">
	<apex:inputtext id="field1" />
	<apex:inputtext id="field2" />
	<apex:commandbutton value="f2" onclick="focu();" rerender="nothing"/>
	</apex:form>		
	<script>
		function focu(){
			document.getElementById('{!$Component.f1.field2}').focus();
		}
	</script>
</apex:page>

 

 

Someone please help me.

 

Thanks in advance

Hi There!

 

I have a page wich loads a huge image. I want to enable a commandbutton after image is loaded. 

 

That's my page: 

<apex:page action="{!Initio}" Controller="async">
<apex:form >
	<apex:actionFunction name="enableButton" action="{!enableButton}" rerender="Button1"/>
    <script>
		function imgLoaded(){
		 	enableButton();
		}
	</script>
	<apex:commandButton id="Button1" value="myButton" action="{!doNothing}"  disabled="{!buttonDisabled}"/>
	<apex:repeat value="{!myIntegerSet}" var="myis">
		<apex:outputtext value="{!myis}"/>
	</apex:repeat>  	
  	<img src="http://www.free-pictures-photos.com/vegetable/radish-5di2.jpg" onload="imgLoaded()"/>
</apex:form>
</apex:page>

 

And my controller: 

 

 

public with sharing class async {
	
	public List<Integer> myIntegerSet;
	public Boolean buttonDisabled {get;set;}
	
	public void Initio(){
		buttonDisabled = true;
		myIntegerSet = new List<Integer>();
		myIntegerSet.add(1);
		myIntegerSet.add(2);
		myIntegerSet.add(3);
	}
	
	public void enableButton(){
		buttonDisabled = false;
	}
	
	public List<Integer> getMyIntegerSet(){
		System.debug('It was called');
		return myIntegerSet;
	}
	
	public void doNothing(){}
}

 

 

So, when image is loaded, javascript function imgLoaded is called and it calls method enableButton on controller.

A rerender of commandButton is done.

 

I can't explain why but the method getMyIntengerLst() is called twice as the result of ajax call. I checked that using system log. 

 

System.debug('It was called');

is called once when page is loading and is called twice as the result of Ajax call.

 

 

Someone can help? Yhanks in Advance

 

Hi,

 

I am running unit tests and I need to see values at few places.

 

So I have used debug statements similar to below one at lot of places:

 

  system.debug(Logginglevel.ERROR,'message no # 1');

 

Still I am not able to see the messages in debug log b/c of max debug log size issue.

 

I also went to developer console - > workspace: Default -> Change log levels -> I have changed every one to ERROR level.

 

Once I ran the test class and see log file on the first line of the file I see below details

 

"24.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;VALIDATION,INFO;WORKFLOW,FINEST"

 

I am not sure why the levels are not changed in the above debug log.Please help me on this.

 

Thanks,

JBabu.

  • July 10, 2012
  • Like
  • 0

Hi,

  So whenever i deactivate any user i want to set the role to inactive since we can't do this through workflow i wrote trigger but when i deactivate the user the role doesn't seems to get changed any ideas?

 

trigger Inactive on User (after update) {
list<User> ulist = [select u.Id,U.Name,u.IsActive,u.IsBmEnabled__c,u.UserRoleId,u.UserRole.Name from User u where u.Id =: trigger.new[0].Id];

 for(User u:ulist){

   if(u.Isactive==false){

      u.IsBMEnabled__c = false;

      u.UserRole.Name = 'Inactive';

      }

 }

}

Hi,

 

Firstly I will apologies for my lack of knowledge in this field I'm just starting out with APIs and Apex.  I have recently been asked to see if I can get the Chatter influence score currrently shown as a bar in the users profile for all users.

 

After a little digging it appears this information is available using the Chatter REST API only.  However I'm looking to do this in Apex and Visualforce but I'm not getting very far.

 

I've researched a number of board entries and blog posts around the subject 'using REST API in Apex' and I believe I have some working code but not necessarily the desired end result.  I was hoping to create a visualforce page that auto ran an apex class that pulled in all user's chatter influence score and title.

 

If this is possible I could really do with some guidance of how to create this.  As I said I have written an Apex Class to see if I could first acutally access the REST API but not entirely sure how to create the VF page to run the apex class I've created.

 

Thanks in advance

hi i have a query i n my controller as DataLoadTest__c selectedRecord = [select Id,name,city__c,country__c,phone__c from DataLoadTest__c where id=:rId limit 1]; how to write test method for this query. it showing exception as System.QueryException: List has no rows for assignment to SObject

I have a VG page that shows all existing contacts on an Account, as well as allows you to add new contacts to the Account; it does so through a pageblockTable and some extensions.  I need a way to add an Update button next to each one of the lineitems on the pageblockTable to allow the user to make a change to one Contact and then quicksave it separate from the rest.  

 

Is this possible?

I've read through at least 20 posts about this issue, and one or two actually have working examples that seem to match what I'm attemping, but it doesnt work for me.  Please take a look and tell me what I'm not getting right, thanks.  For what its worth, I'm getting no luck with action Function either.

 

I expect that when I click on "I WANT ITX",  the varible "poid" in the controller is set to "123" and then the function "addToCard() gets fired off with access to the new value of "poid".  However, "poid" is always null.

 

Page snippet

<apex:outputPanel styleClass="want">
  I WANT ITX
  <apex:actionSupport event="onclick" action="{!addToCart}">
    <apex:param name="poid" assignTo="{!poid}" value="123"/>
  </apex:actionSupport>
</apex:outputPanel>

 

Controller snippet

// apex:param for apex:actionSupport
public String poid { get; set; } 

// function called from apex:actionSupport
public PageReference addToCart() {
  System.debug('===== POID: ['+((poid==null)?'null':poid)+']');
  .
  .
  .
}

 

 

 

  • December 25, 2011
  • Like
  • 0

Hello guys,

 

Need some help with the Command Link. I know there's no attribute as "Disable" for <apex:commandLink >, like we do have for <apex:commandButton> . But as per the requirement, i want to have the link disabled for a particular profile. Can this be achived??

 

All your replies are highly appreciated.

 

Thanks

Krugger

Hi There.

 

I want to copy the standard behavior of field validation error on a visual force page.

 

here is my prototype:

 

Page:

<apex:page controller="Test">
    <apex:form > 
        <apex:pageBlock title="Hello {!$User.FirstName}!">
		<apex:inputtext value="{!ola}" id="e_validation"/> 
        <apex:commandButton action="{!save}" value="Save"/>    
        <apex:message for="e_validation"  />   
        </apex:pageBlock>  
    </apex:form>  
</apex:page

 And the controller:

public with sharing class Test {
	
	public String ola {get;set;}
	
	public PageReference save(){
		ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'test'));
		return null;
	}
}

 

Nothing happens when I click on save button. I expect that message 'test' appears bellow the inputtext component on visual page : (

I am using the following code to create a popup on the Account page when a custom field is NOT NULL

 

<apex:page standardController="Account" rendered="{!Account.Facility_SOPs__c==null}">
 <script type="text/javascript">
     {
         window.alert("Please review Facility SOPs: {!Account.Facility_SOPs__c}");
     }
 </script>
</apex:page>

 If I remove the second = making the redered=NULL the popup will be displayed on accounts where the field is null.  I need the opposite to happen, but it doesn't appear to work when I designate NOT NULL using ==

Hi

I have created a look up from case object to a custom object. The field name is statusupdate__c i am getting the value of the statusupdate__c field but I what the id of the field to compare whether it is present in the case object. What should I do. pls help me it is urgent. pls

 

my code 

 list<string> status1 = new list<string>(); 
    list<string> id = new list<string>();
    list<string> name1 = new list<string>();
    
    for(Case caseobj:Trigger.new)
    {
        status1.add(caseobj.statusupdate__c);
        id.add(caseobj.recordtypeid);
        //id.add(caseobj.recordtypename);
        //status1 = [select status from case  where id=:recordtypeid]; 
        //id  = [SELECT id, selectstatus__c from statusupdate__c WHERE id =:status.id];
    }
    
    list<statusupdate__c > newstatus = new  list<statusupdate__c >();
    newstatus = [select Name,selectstatus__c,id from statusupdate__c where id =:status1]; 
    RecordType contactRecType = [select name from RecordType where id=:id ];
    
   // list<statusupdate__c > statusid = new  list<statusupdate__c >();
   // statusid = [select id from statusupdate__c  where selectstatus__c = :status1];
   
    list<case> newcase = new list<case>();
    newcase = [select Status,id,statusupdate__c from case];
    
    system.debug('+++++++++++++++++++++++++++++++'+newcase[0].statusupdate__c) ;

 pls help me i am new to salsforce. 

Hi All,

 

I'm using dataTable component to visualize statistic data. Simple example is here:

 

Table1

 

I would like to merge in column "Land" such cells like 'DACH' or 'UK' with the empty cells below.

 

I've tried to set rowspan attribute of "Land" column:

 

 

<apex:dataTable value="{!Acc2}" var="acc" id="theTable" rowClasses="odd,odd,even,even" border="1" cellpadding="5" cellspacing="1" styleClass="tableClass" bgcolor="lightyellow" >
<apex:column rowspan="2">  
   <apex:facet name="header">Land</apex:facet>
   <I><apex:outputText value="{!acc.Land}"/> </I>
</apex:column> 

and got the following result where empty cells shift right:

 

Table2

 

 

As dataset for table the list of custom classes is provided.

 

Do you have any ideas how it can be implemented?

 

Thank you in advance,

  Kostja

 

 

 

How can I prevent user to create new list view ( Lead view )  , I have no set authorize for "Manage Public List Views" on user profile

Please suggest me what I can do that

  • February 08, 2011
  • Like
  • 0
Not a great way to start off a Monday morning. I have a very simple piece of code that should pass a param to the page controller but it is not working at all. I have tried using assignTo as well as ApexPages.currentPage().getParameters() but neither approach has worked. Below is a simple page and controller to reproduce.

Page:
<apex:page controller="param" >
<apex:form>
<apex:commandButton value="Proceed to Upload" action="{!proceedToUpload}" id="uploadButton">
<apex:param name="uploadType" assignTo="{!uploadType}" value="org" id="param"/>
</apex:commandButton>
</apex:form>
</apex:page>


Controller:
public class param {

public String uploadType {get; set;}

public pageReference proceedToUpload(){
system.debug(uploadType);
system.debug(ApexPages.currentPage().getParameters().get('uploadType'));
system.debug(ApexPages.currentPage().getParameters());
return null;
}
}

 

Please tell me I am blind and this is a simple typo I have overlooked. If you don't mind could you try to reproduce this in your org.

Thanks,
Jason

Message Edited by TehNrd on 11-16-2009 11:43 AM
  • November 16, 2009
  • Like
  • 0
Can anyone tell me how to fix the following issue with Eclipse?

I get the error message:
Unable to load Scontrol Editor
FactoryException: No id found for filepath 'S-Controls/MyControl.scf'

This is happening ever since I installed the latest version of Eclipse (3.3/Europa) in order to get the Force.com toolkit.  I followed the Wiki to do a new install (this was recommended) even though I had an older version of Eclipse (3.2 I think) with all of my code there.  When I installed the new version that is called Java IDE as indicated on the Wiki, I get this error every time I try to open any of my scontrols.  When I installed the Europa (3.3) version of Eclipse it asked me where I wanted to have my workspace and I pointed it to where all of my old projects in the last version of Eclipse were...could this be the issue?  Please advise on how to proceed as I am stuck and need to do some Apex coding to update my app....

Thanks in advance for any help...