• ForceCoder
  • NEWBIE
  • 105 Points
  • Member since 2012

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 40
    Replies

Hi,

 

Iny my class I am querying on my existing data like below:

 

Line 1) user usersactual = [select Id from user where id =:userInfo.getUserId()];

 

and I will use "usersactual" record in my class as per my requirement.

 

In test class, as we shouldnot use any existing data. I have created a user as follows:

 


user  usertestdata = new User(alias = 'user1', userroleid = userroleRecord.Id, email='testinguser@test.com',
                                   emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
                                   localesidkey='en_US', profileid = profileRecord.Id, country='United States',
                                   timezonesidkey='America/New_York', username='testinguser@test.com')

 

My question for testing purpose as we want "usertestdata" (of test class) to be used as data in the main class (instead of the one mentioned above in Line 1 (usersactual) of the class).

How do we do this? Please help me on this.

 

 

Thanks.

JBabu.

  • June 22, 2012
  • Like
  • 0

In this thread: http://boards.developerforce.com/t5/Visualforce-Development/Accessing-Map-values-on-Visualforce-page/td-p/65017

 

Doug Chasman said "We do plan to provide native page formula support for maps and also access to length/size on collections - stay tuned for when that will be released."

 

Does anyone know if this is possible now? That is, can you get/set map key entries without writing individual getters/setters for each one?

 

thanks,

-paul

  • June 20, 2012
  • Like
  • 0

I know that the limit to the number of entities that a user can follow is 500. 

 

There is an Idea (http://success.salesforce.com/ideaView?id=08730000000HgdbAAC) to increase the limit so I don't want to hardcode 500 anywhere in case it changes.

 

My question is how can I programatically get that number in Apex? 

 

The use case is code that automatically creates EntitySubscriptions, but fails when the 500 is reached.  I know that I can surround the insert with a try/catch, but reaching 500 isn't really an exception case. I want to be able to detect it without having to insert and without having to hardcode a 500 or have a 500 in a custom setting. 

 

Ideally, I'd be able to query how many the user has and check it against a number that I get through a built-in SF class or something to that effect.

 

I don't see anything in the Limits methods:

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_methods_system_limits.htm?SearchType=Stem

 

Thanks.

Question about logging in to a custom site+portal.  From the documentation: http://login.salesforce.com/help/doc/en/sites_login_and_registration_settings.htm


"The login and registration forms must be secure. Set the 
forceSSL attribute to true for these forms. However, salesforce.com recommends that you set forceSSL to false for forms accessed by users who have already been authenticated, such as portal users. Since the forceSSL attribute forces a redirect to a secure URL, authenticated users would encounter an error."

 

In other words the login and register pages must be https.

 

Then for the Require Non-Secure Connections we have the following relevant options:

 Site-Level Security: Require Non-Secure Connections (HTTP)  Organization-Level Security: Require Secure Connections (HTTPS) Description
Not checkedChecked
  • Organization uses only HTTPS
  • Site uses HTTPS for the post-login session
  • Upon login, users see the secure.force.com domain
CheckedChecked
  • Organization uses only HTTPS
  • Site uses HTTP for the post-login session


Followed by the following Warning:

"If the Require Secure Connections (HTTPS) checkbox on the Session Settings page is selected, and the Require Non-Secure Connections (HTTP) checkbox on the Login Settings page is not selected, users logging in to the associated portal from the site will see the secure.force.com domain. For example, if you registered mycompany.force.com as your custom domain, the URL changes tohttps://mycompany.secure.force.com upon login."

(the warning applies to Not Checked, Checked)


Looks to me like in the situation where both are checked the user should never have to be exposed to the secure.force.com domain, but then how would the custom login and custom register pages be served since they require https?  Would it be that only the custom login and register pages would be served with the secure.force.com domain?

 

Ideally, we would want https://www.acme.com/login and https://www.acme.com/register AND not https://acme.secure.force.com/login.  After login, everything would be OK as just http.  The documentation is not exactly as straightforward as I'd like for something that can only be "tested" in production.

 

Thanks.

I have a customized Force.com site and Customer Portal working together.  The portal users are High Volume Customer Portal users.  There are some pages that require no authentication (i.e., public/guest) and some that require authentication.  

I'm having an issue where the authenticated user cannot see Documents files (e.g., a pdf) , even though the guest/public user can.

 

Here's what's happening:

1. A user comes to the Force.com site as a guest/public user and can click the link that was created with apex:outputLink with a value of "/servlet/servlet.FileDownload?file=<recId>" and see the pdf because I set up sharing on the folder that the file is in to include the Guest User.  No problem.  

2. User logs in becoming an authenticated High Volume Customer portal user.

3. User clicks on that same link and now they get a Insufficient Privileges error.  PROBLEM!!!

 

According to http://login.salesforce.com/help/doc/en/customer_portal_manage_users.htm the High Volume Portal User cannot be included in any sharing rules, so there is no way to share this document with them (as far as I can tell); however, it seems like there *should* be some way for them to view it since the use case I've described seems completely reasonable that if the whole world (i.e., guest user) can see the document the authenticated user should be able to as well.

 

Both the portal profile and the guest/public profile have Read CRUD set on the Documents.

 

How can I get the authenticated High Volume Portal user to be able to see the Document?  I feel like I must just be missing something obvious, because I can't see how this wouldn't be supported.

 

If there is no way then what is the recommended way to handle this situation?

 

Thanks.

Is it possible to have to different custom domains redirect to two different sites within the same Salesforce instance?

 

For example, BigCompany sells Widgets and Sprockets and their accessories.  They track the sales, house the product descriptions, etc. for both in their one-and-only Salesforce instance; however, both are branded as completely different companies to the public, so both should have different domains and should be two different Force.com sites.

 

We'd set up a bigcompany.force.com/widgets site and a bigcompany.force.com/sprockets site.  We'd like to be able to create two different custom web address to point to each Force.com site:

  www.widgetsusa.com --> bigcompany.force.com/widgets

  www.sprocketsinmypockets.com --> bigcompany.force.com/sprockets

 

Is this possible?  When looking at the documentation it appears that it isn't...

It looks like we'd have to have something like widgets.bigcompany.com and sprocketsinmypockets.bigcompany.com as the custom web addresses.  Is that correct?

 

According to the metadata API, the Custom Site component is supported.  I see the '.site' XML metadata file in the Force.com IDE for my site and can select it when building a deployment from there; however, when I build a Change Set through the Web UI in my Org there is no Custom Site component (or anything even close to Site aside from Remote Site which is different) choice in the Component picklist.


What gives?  Why would it show up in the Force.com IDE as a component category choice, but not as a Component option in the Change Set Web UI's component picklist?

 

Thanks.

 

Is there a way to save a deployment being build as In Progress? 

 

For example, let's say I am building up a rather large deployment and I click the Validate Deployment button and it fails validation due to a single custom field having some problem, so I never advance to the actual Deployment. The solution ends up being that I have to cancel out of the current construction that I was doing and remove/uncheck that single field from the list of Metadata Components or something to that effect.

 

What I'd like to be able to do is something close to pulling up that last deployment that I was building making slight changes vs. having to rebuild the entire thing.  Is there anything like that?

1. How are changes moved from org to org (e.g., QA/UA to production, dev sandbox to QA, etc.)?

I didn't see anything in the change sets for Siteforce.

 

2. Is there a best practice for team development involving Siteforce?

For example:
Along with the developer.force.com Enterprise Development guide book, there are some excellent Dreamforce session videos on team development involving svn, Jenkins, Selenium, and other useful tools.

 

There is a CI example where there is a setup of multiple devs, each with their own dev sandbox. They check in/out code and meta data changes to svn. Checking in kicks off a Jenkins CI build which runs all unit tests and a suite of Selenium tests (I realize there are no native unit tests for Siteforce, but Selenium tests would seem like they could be very useful for Siteforce). Is something like that possible or does everyone just work together in the same org? If so, how are conflicts handled and how is versioning handled?

 

Thanks.


I know that the limit to the number of entities that a user can follow is 500. 

 

There is an Idea (http://success.salesforce.com/ideaView?id=08730000000HgdbAAC) to increase the limit so I don't want to hardcode 500 anywhere in case it changes.

 

My question is how can I programatically get that number in Apex? 

 

The use case is code that automatically creates EntitySubscriptions, but fails when the 500 is reached.  I know that I can surround the insert with a try/catch, but reaching 500 isn't really an exception case. I want to be able to detect it without having to insert and without having to hardcode a 500 or have a 500 in a custom setting. 

 

Ideally, I'd be able to query how many the user has and check it against a number that I get through a built-in SF class or something to that effect.

 

I don't see anything in the Limits methods:

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_methods_system_limits.htm?SearchType=Stem

 

Thanks.

We are planning to create an Ecommerce site by using force.com site

 

1) How many authenticated user allowed in the customer portal. Around 1000 users required for my Ecommerce site

2) I don’t required more than one user licence for Foce.com login.

 

Anyone can help me what would be the cost or which license have to go ?

Hi,

 

I have developed a new webservice class to return a set of account records. Following is the code:

 

global class AccountMinesiteWebService
{

// Object to be returned by the webservice
global class Minesite{
webservice String msId;
webservice String msName;
webservice String msMineType;
webservice String msMineral;
webservice String msExternalId;
webservice String msAccountStatus;
webservice String msPhone;
webservice String msFax;
webservice String msParentName;
webservice String msIsActive;
webservice String msMineLatitude;
webservice String msMineLongitude;
}


webservice static List<Minesite> minesiteDetails(){
List<Minesite> minesites = new List<Minesite>();
Minesite ms;

//Query for the minesite Accounts
List<Account> accountList = new List<Account>([SELECT Id, Name, Mineral__c, External_ID__c, Mine_Type__c,
Account_Status__c, Phone, Mine_Latitude__c, Mine_Longitude__c,
Fax, Parent.Name, Is_Active__c, Jitterbit_Update__c
FROM Account
WHERE Type = 'Mine Site' AND Jitterbit_Update__c = 'YES']);

// Add all the minesite Accounts to the webservice class object that will be sent out to the external system
for(Account acc: accountList){
ms = new Minesite();
ms.msId = acc.Id;
ms.msName = acc.Name;
ms.msMineType = acc.Mine_Type__c;
ms.msMineral = acc.Mineral__c;
ms.msExternalId = acc.External_ID__c;
ms.msAccountStatus = acc.Account_Status__c;
ms.msPhone = acc.Phone;
ms.msFax = acc.Fax;
ms.msParentName = acc.Parent.Name;
ms.msIsActive = String.valueOf(acc.Is_Active__c);
ms.msMineLatitude = acc.Mine_Latitude__c;
ms.msMineLongitude = acc.Mine_Longitude__c;
minesites.add(ms);
}

return minesites;

}

public static testMethod void testAccountMinesiteWebService(){
List<Minesite> testMinesites = new List<Minesite>();
testMinesites = AccountMinesiteWebService.minesiteDetails();
}
}

 

When I run the test, it is just covering 18% of the class. The reason is, it is not entering the for loop at all (which means the accountList has no records in it). But I executed the same query in developer console, there it is successfully returning the records that satisfy the query conditions and it is entering the for loop as well. I can't figure out why the same query is failing to return any records in the webservice class (there are some account records in our sandbox that satisfy the query conditions). Please help me if there is any mistake in my code! Thanks much.

I really hope someone can help me because I have been banging my head over this one for far too long.  I have a VF page to override the contact view.  Its tabbed and most tabs are made of their own cutom component.

 

On this particular component, I have a list of wrapperClass custom objects so users can mass copy Insurances (custom object).  The popup allows them to choose which contact to copy the insurances to, and when you click select, the JS calls a function on the parent page that simply calls an actionFunction to insert the new records, and refreshes the list and adds a page message.  Works great with every browser except IE.  I really wish I could just force users to not use IE, but not an option at this point.

 

I have looked over the boards and tried every suggestion I could find from previous posts.  I have taken out the showHeader="false", I have tried nesting the entire page in <body> tags, I tried immediate="true" in the actionFunction, I have added the following to the controller

 

Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8'); 

 

 

Nothing seems to work.  It is actually closing the window, but it is not calling the actionFunction and rerendering the page at all.  I just dont know how to fix this   please help

 

Popup VF Page

 

<apex:form id="form">

<table cellpadding="5px" cellspacing="0" style="margin: 10px;">
    <tr>
        <td colspan="3" align="center"><apex:commandButton value="Select" action="{!save}" oncomplete="fun();" rerender="panel1,panel2"/>&nbsp;<apex:commandButton value="Cancel" onclick="window.top.close();" /></td>
    </tr>
    <tr>
        
    </tr>
        <tr>
            <td width="50px"></td>
            <td width="400px" class="cts_th">Which Family Member(s) would you like to copy selected Insurances to?</td>
            <td width="50px"></td>
        </tr>
        <tr>
            <td width="20px"></td>
        </tr>
        <tr>
            <td width="20px"></td>
        </tr>    
    <tr></tr>
    </table>
    
    <table cellpadding="5px" cellspacing="0" style="margin: 10px;">
    <apex:repeat value="{!conWrappers}" var="con">
        <tr>
            
            <td width="50px" align="right"><apex:inputCheckbox value="{!con.checked}" id="check"/></td>
            <td width="200px">{!con.cntact.Full_Name__c}</td>
            
        </tr>
    </apex:repeat>
    </table>
    <apex:outputpanel id="panel2">
    <apex:pageblock id="block">
	    <apex:inputHidden value="{!saved}" id="saved"/>
	    <apex:inputHidden value="{!sel}" id="sel"/>
	    
	</apex:pageblock>    
    </apex:outputpanel>
</apex:form>


<script>
function fun() {
	var item = document.getElementById('page:form:block:saved');
    if(item.value == 'false'){
    	alert('You didn\'t choose anyone');
    }
    if(item.value == 'true') {          
		
    	Close();
    }
}

function Close() {	 
   
      var winMain=window.opener;
      if (null==winMain)
      {
         winMain=window.parent.opener;
      }
      item = document.getElementById('page:form:block:sel');
      var sel = item.value;
      winMain.userSelected(sel);     
   
}
</script>

 

Snippets from Parent Page

<apex:actionfunction name="copyInsurance" action="{!copyInsurance}" immediate="true" rerender="insurances,table,dataTable"/>

<apex:inputhidden value="{!sel}" id="selected"/>

<script>
function userSelected(sel) {
	
    var tag = document.getElementById('{!$Component.com.block.section.selected}');
    tag.value = sel;
    copyInsurance();
    closePopup();
}

function closePopup() {
	if (null!=newWin) {
    	newWin.close();
    }  
}
</script>

 

Its pretty straight forward and works perfectly on every other browser.  Just dont get it.  Please help

 

Chris

 

 

We are going to integrate three external programs related to Accounts in Salesforce:
1. Customer Locator (results on our website for people to find the companies)
2. Inventory Management
3. Event Management (people can sign up to attend our events such as workshops, conferences, trade shows, from  an outside source, and have it come back to Salesforce, as well as be able to signup in salesforce which will feedback to the Event management program).

Items 1 and 2 will be related for Accounts. Item 3 is related to Contacts (which is related to accounts).

If we get these integrated in Salesforce, do we have to do separate integration to have this available in the Portal? or can we simply provide portal access to the custom objects?

  • July 19, 2012
  • Like
  • 0

  I am getting error message while validating in PRODUCTION. 

 Following are the steps 

 

Created the Outbound ChangeSet in sandbox and uploaded it into Production environment. I have included three things in the ChangeSet: Apex class, Visualforce Page, Custom Field. The TestClass coverage is 100 percent.

 

 Uploading the ChangeSet into the Production: It said successfully uploaded.

 

 In Production environment: I clicked Name|Setup|Deploy|Inbound ChangeSet

   selected the required Change Set name and clicked Validate.

 

 The validation failed and there were 2 errors which are not related to the 3 things which I have uploaded in the Outbound     ChangeSet. The error is in some other TestClass in the Sandbox environment, which I have not even used. 

 Is it possible to get an error message in some other TestClass which I have not at all used?

 Help me! Am new to salesforce.com development. 

 

 
 

Hi,

 

How can i send generate password email when i am creating new users through apex.

 

Thanks

Ritika

Question about logging in to a custom site+portal.  From the documentation: http://login.salesforce.com/help/doc/en/sites_login_and_registration_settings.htm


"The login and registration forms must be secure. Set the 
forceSSL attribute to true for these forms. However, salesforce.com recommends that you set forceSSL to false for forms accessed by users who have already been authenticated, such as portal users. Since the forceSSL attribute forces a redirect to a secure URL, authenticated users would encounter an error."

 

In other words the login and register pages must be https.

 

Then for the Require Non-Secure Connections we have the following relevant options:

 Site-Level Security: Require Non-Secure Connections (HTTP)  Organization-Level Security: Require Secure Connections (HTTPS) Description
Not checkedChecked
  • Organization uses only HTTPS
  • Site uses HTTPS for the post-login session
  • Upon login, users see the secure.force.com domain
CheckedChecked
  • Organization uses only HTTPS
  • Site uses HTTP for the post-login session


Followed by the following Warning:

"If the Require Secure Connections (HTTPS) checkbox on the Session Settings page is selected, and the Require Non-Secure Connections (HTTP) checkbox on the Login Settings page is not selected, users logging in to the associated portal from the site will see the secure.force.com domain. For example, if you registered mycompany.force.com as your custom domain, the URL changes tohttps://mycompany.secure.force.com upon login."

(the warning applies to Not Checked, Checked)


Looks to me like in the situation where both are checked the user should never have to be exposed to the secure.force.com domain, but then how would the custom login and custom register pages be served since they require https?  Would it be that only the custom login and register pages would be served with the secure.force.com domain?

 

Ideally, we would want https://www.acme.com/login and https://www.acme.com/register AND not https://acme.secure.force.com/login.  After login, everything would be OK as just http.  The documentation is not exactly as straightforward as I'd like for something that can only be "tested" in production.

 

Thanks.

Hi all, It is possible to create an application to clone an inbound changeset to an outbound changeset .kindly let me any possiblities and provide me description with deails asap Thanks!

Our portal users see this error in the comments section of their case and I need help understanding what could cause this problem.  This issue happens with our custom comment, the standard SF comment system works fine.

 

This issue was reported to us from our customers starting today, 5/15/12.  Did something changed over the weekend that could cause this?  I can send your our Apex script if needed.

 

Thanks in advance!

Hello,

 

I have a Force.Com Site in which we have created our own authentication process which logs a user in using an Account (not the user object).  The user therefore logs into their account....

 

On successfully logging in I wish to then change the site to use HTTPS.  To implement this changeover what is the best process for doing so (I was unsure how to implement the changeover)?

 

Thanks in advance for any advice.

I'm frequently getting the error "System.CalloutException: Read timed out" on an HTTP Service (RESTful) call I am making from an Apex class.

It doesn't appear to be a proxy/firewall issue as I *am* able to get a response.   I think I just have a slow server on the other end.

Is there any way to increase the timeout period on this call to ensure that the web service has time to respond?

Thanks!