• Force2b_Mike
  • NEWBIE
  • 345 Points
  • Member since 2004
  • Salesforce.org


  • Chatter
    Feed
  • 12
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 130
    Replies

Hi, I just upgraded my Eclipse to 3.5 version, downloaded the 19.0 API and everything seems to be ok but the Javascript code is not highlighted.

 

Could someone help me up? I tried to follow some directions I found in this forum with 3.4 version, but didn't work this time.

 

I need it because I have some javascript code embeed into my Visualforce page that I need to edit, and with syntax coloring it is much easier.

 

Regards,

 

Wilmer

I go to Setup/Develop/Apex Classes and there is no "New" button.  I have permissions as an Apex Author (and am a system administrator).  I can't figure out why I can't create classes.  Thanks!

 

I'm escaping Strings for Javascript and curious if there is anything in APEX that mirrors  the org.apache.commons.lang Class StringEscapeUtils in Visualforce.

 

If not I suppose I will write it myself!

 

I am trying to create a custom tag allowing the user to automatically log in to a website specified by a global variable with user-specific credential saved in a custom object (lookup from UserID)

 

We decided to do it through S-Control. I am a bit lost because S-Control docs are all gone. Can anyone give me some pointer?

I need to have a custom button that will clone a lead then give it a different record type. I am using the custom button to invoke S-Control which will then call my Apex code as webservice but so far, the call not able to invoke anything, without any error message.

S-Control code here:





<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/15.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/15.0/apex.js" type="text/javascript"></script>
<script>
function createCharterLead() {
var lead = sforce.sObject("lead");
var lead2 = sforce.apex.execute("spinOffCharterLead","createCharterLead",l:lead);
}
</script>



Charter Lead created.








Apex code:

global class spinOffCharterLead {

// eyCDUkymDHyd9MisHBFLPIYJm

webService static Lead createCharterLead(Lead l) {

// log entry
System.debug('Now in spin off class');

ID cid = [select id from RecordType where name='CharterLead' limit 1].id;
System.debug('Now selected recordtype ID');

Lead lc = l.clone(false, true);
lc.RecordTypeId = cid;

// Now insert
insert(lc);
System.debug('Inserted Lead');

// Track
Program_Charter_Link__c pcl = new Program_Charter_Link__c();
pcl.Charter_Lead__c = lc.Id;
pcl.Program_Lead__c = l.Id;
insert(pcl);
System.debug('Inserted tracking');

return lc;

}

}

Hi,

 

 Please send me some links for apex materials.

  • June 09, 2009
  • Like
  • 0

Hi, 

 

I have been through the visualforce documentation and although it has helped me a great detail in being able to provide a custom list of all my events, I would still like to build an if/then statement. Depending on a certain event name I would like the text to be bold for example. Does anyone know what code I can use? Below is my code

 

<apex:page controller="EventController" showHeader="false"> 

 

 

  <apex:repeat value="{!Events}" var="event" id="event_id">

 

      <p><a href="/apex/event_details?id={!event.id}">{!event.name}, {!event.Event_Date__c}</a>

      <br/>Description:&nbsp;{!event.Description__c }

 

    if {!event.name} = "marathon" then ....

 

</p><hr/>

 

  </apex:repeat>

                          

 

</apex:page> 

  • June 05, 2009
  • Like
  • 1

Hi,

 

 

I currently developing certain wizards that include fields that need to be set as required and some that need to be conditionally set as required. I am using Javascript to set the fields accordingly, those that need to be conditionally set as required. My question is, is there some way I can replace the red bars with asterisks?

 

Barring that, is there some way to set the red bar in case of those fields that are being set as required using Javascript?

 

Thanks

Message Edited by Azsharael on 03-10-2009 06:33 AM
I assume Ron himself is the best one to answer this, but just in case:

We hacked together a quick solution for our Access client app two years ago using Ron Hess' CSession and "KT"s (don't know who that is!) SFC class modules I dug up somewhere on line here.  Now we need to add functionality that requires version 3 of the Toolkit.  Before we rewrite it all from 2 to 3, a question: did Ron or somebody else ever update CSession and SFC to work with Toolkit 3? (and if so, where could I find it?)

TIA!

Rick N.

According to the documentation, to be able to browser the Viewstate of a VF page, I should be able to check a box for "Show View State in Development Mode" on the User details page for my User. Unfortunately, I do not see this option at all. 

Documentation: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_tools_edit_toolbar.htm
To enable the View State tab:
1. From your personal settings, enter Advanced User Details in the Quick Find box, then select Advanced User Details. No results? Enter Personal Information in the Quick Find box, then select Personal Information.
2. Click Edit.
3. Select the Development Mode checkbox if it isn't selected.
4. Select the Show View State in Development Mode checkbox.
5. Click Save.

Below is what I see when I check the "Developmetn Mode" checkbox on my User record. Note that the "Show View State in Development Mode" box is not there.
User-added image

I'm a full system admin and have author apex permissions. I've tried logging in as some other admins as well. No luck. Has anyone seen this issue before?

Best Regards,

Mike

I'm getting the following strange error when deploying a Permission Set from a CS3 (Winter 13) Sandbox into NA13 (Summer '12) production org. Normally, there shouldn't be issues deploying between the two, but I'm fairly sure this error is due to the version difference:

 

Unknown user permission: AllowContacts20

 

A clip of the permission set source code with the above setting is below.

 

    <userPermissions>
        <enabled>false</enabled>
        <name>AllowContacts20</name>
    </userPermissions>

 

Has anyone run into a similar issue deploying permission sets between orgs of different api versions?

 

 

Best Regards,

 

Mike

I've run into a very strange error trying to deploy a Change Set into Production today.

 

I uploaded a Change Set around 2pm Eastern and that deployed fine, though I had a Deployment Error. I made a small change in the Sandbox and re-uploaded the Change Set into Production. Now when I try to open the Change Set in Production I get the following error message.

"The AppExchange Application or component you have selected is not yet available on your instance of salesforce.com. Please check back in a few days to retry the installation. Press the back button of your browser now and bookmark the AppExchange Directory page so that you can find it later."

This really makes no sense. Why would the Change Set I uploaded a few hours ago "work" and the new one not work? Plus, why does the error message talk about the "AppExchange"? The absolute worst part is checking back in a few days. At this point, I'm half way through a major deployment and unable to continue.

I've noticed that if you're writing a unit test using v24 of the API without the @SeeAllData=true annotation, there seems to be a catch-22 type problem with the Standard Pricebook.

 

The following unit test code will return an error because the Unit Test does not see the Standard Pricebook: 

string standardPB = [Select Id from Pricebook2 where IsStandard=true limit 1].Id;

 

If you try to create a new Standard Pricebook with the following, that code cannot be saved since the IsStandard field is not updatable (error = "Field is not writeable: Pricebook2.IsStandard"):

Pricebook2 pb = new Pricebook2(Name='Standard Pricebook', IsStandard = true);
insert(pb);

 

 

The result is that you simply can't write a unit test that needs to be able to create an Opportunity or Quote with Products in v24 without using @SeeAllData=true. Obviously not best practice, but I can't find a work-around.

 

 

Best Regards,

 

Mike

I was sure that at some point, it was possible to use a secure site page (https://xxx.secure.force.com/sitename/) to login to the customer portal and remain encrypted. I can still use the secure site URL, however after logging in the user is redirected to the non-encrypted url (http://xxx.force.com/sitename/). 

The "workaround" I found is to change the site_login class to redirect the user the actual portal url including the username/password in the URL:

 

startUrl = 'https://na3.salesforce.com/secur/login_portal.jsp?'
   + 'orgId=00D50000000xxx&portalId=060500000000xxx'
   + '&un=' + username + '&pw=' + password;
retURL = new PageReference(startURL);

 

Though this is technically an encrypted URL, the result is different. For example, sharing a URL such as https://na3.salesforce.com/a1aW00000004D1R has a different result than sharing https://xxx.secure.force.com/sitename/a1aW00000004D1R. If a portal user clicks the first link they're taken to a standard Salesforce login page, however they'll be unable to login because their credentials are for a portal only.

 

Best Regards,

 

Mike

In the past I was able to use the pn, pc and pv parameters on report URL's to dynamically add filters via the URL. That functionality stopped working recently and I can't seem to get it to work at all anymore.

For example, this URL works but only because I have the field saved as the first filter: /00O5000000328yO?pv0=031

However, if I try to change the first parameter using pc0= all the filters are removed when the report runs: /00O5000000328yO?pc0=00N500000029a7k&pn0=eq&pv0=031. I tried using the field name as well as both the 15 and 18 character versions of the field ID. Same results. In the past I was able to pass in the 15 character field ID as the pc0 parameter.

Is there a way to do this any more?

 


 

Best Regards,

 

Mike

I am having a problem accessing the content of an encrypted field from an Apex class. According to the Encrypted Field documentation -- "When an encrypted custom field is manipulated in Apex Code, the value is always unmasked,regardless of the permissions of the user. " However, in my Apex code the field value is always masked.

 

I confirmed this by parsing the actual field value character by character, since encrypted fields are always masked in system.debug() statements.

 

Participant__c partic = [SELECT ID, Social_Security_Number__c FROM Participant__c WHERE ID = :this.recordID LIMIT 1];
if (partic.Social_Security_Number__c != null) {
	string ssn = '';
	for (integer n = 0; n < partic.Social_Security_Number__c.length(); n++) {
		string x = partic.Social_Security_Number__c.subString(n,n+1);
                if (x == '*') x= 'x';
                ssn += x;
    	}
}

 In the above code I found that the characters in the encrypted field were actually an asterik (*). I confirmed this by checking for the "*" and replacing it with a "+".  (I could have done this with a Replace(), but I wanted to actually copmare each character one at a time to be sure).

 

Shouldn't I be able to retrieve the full umasked value of the encrypted field in my Apex code?

 

Best Regards,

 

Mike


I just installed FNA for one of my clients. Overall a really great app.

 

We ran into a few  issues/questions that I wanted to check on:

 

  • When I change the "Map Address" field to "Do Not Map" and click [Save], the field immediately changes back to "Billing" and the Mapping Status changed to "Not Located Yet". I had the same problem when trying to bulk set a bunch of in-active/dormant accounts to "Do Not Map" - it just ignored the change.
  • Account Type field on Mapping visualforce page. My client does not use Account Type for most users. Even though we have the field security set to hide the field for specific profiles, it's still displayed on the Mapping page. Is there a way to either hide this entirely or have it respect field security?
  • When are new or changed accounts geocoded - immediately, scheduled, on-demand only? Can't find the answer to this. I see a trigger on Account, but being managed I can't look at the code.

 

 

Best Regards,

 

Mike

  • Setting the "Map Address" field to "Do Not Map"
  • Account Type field on Mapping visualforce page
  • When are new or changed accounts geocoded - immediately, scheduled, on-demand only?

I have a Customer Portal where I've created a Site for the users to login from. This problem only appears when logging into the Portal via the Site. If they login using the standard Portal URL there is no problem, but of course we want the users to login via the Sites page.

 

If I override the VIEW or EDIT links on a Custom Object, when the user clicks the EDIT link or the item NAME in a View, they get an error for "Page Not Found" (the error below is a VIEW link error):

 

Page Not Found: /portalpage/a1CQ0000000ouMS/e 

 

If I remove the override for the VIEW, when the user clicks the link it opens up the page properly, and it even shows the exact same URL that appeared in the error message.

 

Very bizzarre. The page exists either way, but for some reason the overridden link is creating an issue.

 

I confirmed that the VisualForce page used in the override is available to the Portal User and Sites user Profiles and checked any other security setting I can think of. Doesn't seem to be a security setting, especially given the odd page not found error, but who knows.

 

Is there a way I can override the VIEW/EDIT page for a Custom Object and have that override work for Portal Users that login via a Sites page?

 

 

Best Regards,

 

Mike

I have a Customer Portal where I've created a Site for the users to login from. This problem only appears when logging into the Portal via the Site. If they login using the standard Portal URL there is no problem, but of course we want the users to login via the Sites page.

 

If I override the VIEW or EDIT links on a Custom Object, when the user clicks the EDIT link or the item NAME in a View, they get an error for "Page Not Found" (the error below is a VIEW link error):

 

Page Not Found: /portalpage/a1CQ0000000ouMS/e 

 

If I remove the override for the VIEW, when the user clicks the link it opens up the page properly, and it even shows the same URL that appeared in the error message.

 

Very bizzarre. The page exists either way, but for some reason the overridden link is creating an issue.

 

How can I override the VIEW/EDIT page for a Custom Object and have that override work for Portal Users that login via a Sites page?

 

 

Best Regards,

 

Mike

According to the VisualForce documentation, I should be able to use the apexFacet tag along with the ApexListViews tag to override the body of the list view. However, when I try to save the page in the IDE it comes back with the following error message:

 

Save error: Unsupported attribute type in <apex:facet> at line 3 column 87

 

I've even tried removing everything between the open and close tags for the facet. As long as the facet tag appears this error comes up.

 

 

<apex:page>


<apex:ListViews type="Workshop__c" >
<apex:facet type="body">
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.Name}"/>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.ImplementationSite__c}"/>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputText value="{0,date,MM/dd}">
<apex:param value="{!Workshop__c.End_Date__c}" />
</apex:outputText>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.Number_of_Attendees__c}"/>
</apex:column>
<apex:column styleClass="dataCell">
<apex:outputField value="{!Workshop__c.Number_of_Completed__c}"/>
</apex:column>
</apex:facet>
</apex:ListViews>

</apex:page>

 

Best Regards,

 

Mike

I have a client that wants to send automated emails (that have to be done through Apex) based on specific dates. For example:

 

  • Send an eMail 2 days before the 'Close Date'
  • Send an eMail once per week between the Start Date and Close Date

 

Unfortunately I can't use standard time-dependent workflows because the eMails they want to send cannot be sent through the normal email process (apex needed to build the email).

 

My original thought was to use a Time-Dependent Workflow rule to initiate the eMail, however that has two problems:

 

  1. Can't send an Outbound Message to an Apex class
  2. Can't find a way to repeat a message every week between two dates

 

I thought about using a Trigger to schedule an Apex job, but you cannot schedule more than 10 classes at the same time, which I think means I could not have more then 10 records scheduled for an eMail (there could potentially be hundreds). Or, does this really mean that a single class can be scheduled multiple times, but no more than 10 different classes can be scheduled?

 

Anyway, not sure the best way to make this happen without writing a great deal of custom code. I really wanted to give the client as much control  as possible using Workflow Rules, but that option is looking doubtful. 

 

I'm curious how others would handle this need.

 

Thanks,

 

Mike

I installed the Chatter Combo Pack into my Chatter-Enabled sandbox mainly to use the Follow Object component that it says can be re-used on a VisualForce page. Yet, when I insert the following line into my code as described on the About Tab for the Combo Pack, I get an error for Save error: Component c:followobject does not exist.

 

 

<c:followObject oid="{!Opportunity.Id}" />

 

 

What am I missing?

 

Thanks,

 

Mike

I'm developing a custom application for a client using Custom Portal that works only with Custom Objects, no standard objects. One of the requirements is to control visibility within each Portal "Account" via the role-hierarchy. Here's the situation.

 

Account ABC has 3 contacts (portal users)

- User 1 has the standard "Account ABC Executive" profile

- User 2 has the standard "Account ABC User" profile (reports to Manager, which reports to Executive)

- User 3 has the standard "Account ABC User" profile(reports to Manager, which reports to Executive)

 

I set the Custom object default sharing to "Private" and "Grant Access using Hierarchies" is checked. I added a Sharing Rule on the Custom Object to share the object with "All Internal Users" so all non-portal users have full visibility.

 

My expectation is that if User 2 or 3 creates a record in the Custom Object, User 1 will be able to see that record because User 2 & 3 report to User 1 in the Role Hierarchy. However, I'm not seeing this behavior in my testing. Instead records created by User 2 are only visible to User 2, and so forth.

 

Is there a way I can build my sharing rules for Portal users such that there can be an account-level "Manager" that has visibility to all records created by other "Users" within that Portal Account?

 

Thanks,

 

mike

I've noticed that if I use a simple inputField tag referencing the Opportunity.StageName field, VisualForce lists ALL of the Stages in the system instead of the just the stages that are valid for the current Opportunity.RecordTypeID. Is there a way to get VisualForce/Apex to do this? I can't find any documentation on how to retrieve StageName picklist values based on the RecordType ID.

 

Thanks,

 

Mike 

I have a custom field on the Opportunity object that defaults to a value of 1, however that value is updated through other processes during the lifecycle of the Opportunity.

 

What I've found, though is that when the Opportunity is cloned the field value gets reset back to 1 instead of keeping the current value that the original Opportunity had (it was 5). Is there a way to prevent this from happening when cloning an Opportunity?

 

Thanks,

 

Mike 

I would like to have my VisualForce page display a simple "Please Wait...Processing" type message after a user clicks a commandButton on the page. I've been experimenting with the reRender attribute, assuming that it would re-render a given ID on the page, but this does not work. Actually when the Rerender attribute is used, I don't even get an hourglass on the page.

 

Clearly I'm missing something. Any help would be very much appreciated.

 

Page Sample:

 

<apex:page controller="TestPage_Controller" title="Testing" id="Testing" tabStyle="Account"> <apex:pageMessages /> <apex:form id="testForm" > <apex:pageBlock > <apex:pageBlockButtons location="top"> <apex:commandButton title="Start" value="Start" action="{!start}" rerender="status"/> </apex:pageBlockButtons> </apex:pageBlock> <apex:pageBlock > <apex:outputText value="Running: {!counter}" id="status" rendered="{!showStatus}" /> </apex:pageBlock> </apex:form> </apex:page>

 

 Controller Sample:

 

 

public class TestPage_Controller { public double counter {get; set; } public boolean showStatus {get; set; } public TestPage_Controller() { } public pageReference start() { counter = 0; showStatus = true; for (integer y = 0; y < 5; y++) { for (integer n = 0; n < 30000; n++) { counter++; } } showStatus = false; return null; } }

 

Thanks,

 

Mike

 

 

I have a fairly simple VF page with an [Undelete] button that calls a method in a controller extension. If the button action fails, I want to be able to display a message at the top of the screen while still showing the original record below the message. Unfortunately, no matter what I try I get the error message but without the original record. I must be doing something wrong in setting the return for the method, but I've tried a number of different variations each with the same result, or just displaying the original message without any error.

 

 

 

VisualForce Page:

 

<apex:page standardController="DeleteLog__c" extensions="DeleteLog_extension"> <apex:pageBlock > <apex:messages /> <apex:pageBlockButtons > <apex:form > <apex:commandButton action="{!unDeleteRecord}" title="Undelete" value="Undelete"/> <apex:outputText value="{!DeleteLog__c.ObjectID__c}" rendered="false"/> </apex:form> </apex:pageBlockButtons> <apex:detail /> </apex:pageBlock> </apex:page>

 

 

Controller Extension:

 

public class DeleteLog_extension {

 

private final DeleteLog__c delLog;
private PageReference pageRef = ApexPages.currentPage();

 

public DeleteLog_extension(ApexPages.StandardController stdController) {
this.delLog = (DeleteLog__c)stdController.getRecord();
}

 

public PageReference unDeleteRecord() { Try { List<string> IDs = New List<String>(); IDs.add(this.delLog.ObjectID__c); database.undelete(IDs); PageReference obj = new PageReference('/' + delLog.ObjectID__c); obj.setRedirect(true); return obj; } Catch(DMLException ex) { string thisid = pageRef.getParameters().get('id'); System.Debug('ID =' + thisid); System.Debug('CurrentPage =' + pageRef.getUrl()); PageReference obj = new PageReference(pageRef.getUrl() + '?ID=' + thisid); System.Debug('New URL =' + obj.getUrl()); for (Integer i = 0; i < ex.getNumDml(); i++) { ApexPages.addMessage(new ApexPages.Message ApexPages.Severity.ERROR, ex.getDmlMessage(i))); } pageRef.setRedirect(false); return pageRef; }

}

 

Thanks,

 

Mike

 

I am trying to figure out a way to effectively redirect the user to a VisualForce page after a new opportunity is created, while passing in the ID of the new Opportunity. The overall objective is to require the user to enter additional information about the Opportunity on a separate screen. I'd also like to avoid completely recreating the Opportunity edit page in VF so that the admins can still add/change fields and use the PageLayout Editor.

 

My thought was that I could use the standard Opportunity Controller on a VF page and then use <apex:detail>, however it doesn't seem like it's possible to call an Apex page for a new record unless you're manually building the form. For example:

 

  • https://na6.salesforce.com/006/e?retURL=/apex/OppPart2/id=newOppID - This would redirect the user to a specific page after the save has completed, but there's no way to know the newOppID ahead of time.
  • https://na6.salesforce.com/apex/NewOpportunity/e - Calling a VF page with the standard /e at the end fails with an error
  • https://na6.salesforce.com/apex/NewOpportunity?ID= - Calling a VF page with a blank ID parameters displays a blank screen.


Does anyone know of a way to either:

  • Override the [Save] button functionality on a New Opportunity without recreating the entire edit form in VF?
  • Create a VF page that can determine the ID of the Opportunity just created
  • Any other way to have display a specific VF page after creating a new opportunity?


Thanks for your help.

 

Mike

I created a Plug-in for FireFox and IE7+ that searches the entire SFC Developer Community. The plug-in can be found at http://mycroft.mozdev.org/search-engines.html?name=salesforce+developer.

Enjoy,

Mike
According to the documentation, to be able to browser the Viewstate of a VF page, I should be able to check a box for "Show View State in Development Mode" on the User details page for my User. Unfortunately, I do not see this option at all. 

Documentation: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_tools_edit_toolbar.htm
To enable the View State tab:
1. From your personal settings, enter Advanced User Details in the Quick Find box, then select Advanced User Details. No results? Enter Personal Information in the Quick Find box, then select Personal Information.
2. Click Edit.
3. Select the Development Mode checkbox if it isn't selected.
4. Select the Show View State in Development Mode checkbox.
5. Click Save.

Below is what I see when I check the "Developmetn Mode" checkbox on my User record. Note that the "Show View State in Development Mode" box is not there.
User-added image

I'm a full system admin and have author apex permissions. I've tried logging in as some other admins as well. No luck. Has anyone seen this issue before?

Best Regards,

Mike
Hi All, 

Maybe I am missing something but I am going around in cirlces with the Contacts without Hobbies report. I have: 

1. Created a custom report type to get Contacts without hobbies 
2. Created an Account Value bucket field
3. Create a % Open Opps Formula 
4. Added First Name, Last Name, Total Opp Value, Open Opp Value, Phone, Email, %Open Opps to the report 
5. Summarised by Account Value then Account 

And im still getting an error: 

Challenge Not yet complete... here's what's wrong: The 'Contacts Without Hobbies' report is not configured correctly.

I have added screenshots of all the pieces - hoping someone else has hit this issue 

User-added image

User-added image

User-added image

User-added image

How to avoid the new contact creation in Site.createPortalUser(u, accountId, null);Because I have the contact.I don't need to create a new one.I am updating the existing contact to the creating portal user.Is it possible?

 

My code:

 

contactId= ApexPages.currentPage().getParameters().get('conatctid');

 

Contact c = [Select c.Update_Information__c, c.Top_Investor__c, c.Top_Account__c,
c.Title, c.Temporary_Email__c, c.Tags__c, c.SystemModstamp, c.Starred__c, c.Seller__c, c.Salutation, c.Residential_Subcategory__c,
c.ReportsToId, c.Regional_Interest_s__c, c.Phone, c.OwnerId, c.Other_Geographic_Preference__c, c.OtherStreet
From Contact c
WHERE id = :contactId];

 

private User createUsers(){
User u = new User();
u.FirstName = firstName;
u.LastName = lastName ;
u.companyName = CompanyName;
u.Email = email;
u.Username = email;
if (email.length() > 40)
u.CommunityNickname = email.substring(0,39);
else
u.CommunityNickname = email;
u.FederationIdentifier = email;
u.ShareFile_Password__c = sfPassword;
u.ContactId = contact.Id;
return u;
}

 

Account acc = new Account(Name = CompanyName);
acc.ownerId = ownerId;
insert acc;
system.debug('::::acc:::::::::::::'+acc);
accountId = acc.id;

 

String userId = Site.createPortalUser(u, accountId, null);

 

But this code generate the new contact for newly created portal user.How to avoid the new contact create?How to assign the existing contact to this newly created portal user?

I've run into a very strange error trying to deploy a Change Set into Production today.

 

I uploaded a Change Set around 2pm Eastern and that deployed fine, though I had a Deployment Error. I made a small change in the Sandbox and re-uploaded the Change Set into Production. Now when I try to open the Change Set in Production I get the following error message.

"The AppExchange Application or component you have selected is not yet available on your instance of salesforce.com. Please check back in a few days to retry the installation. Press the back button of your browser now and bookmark the AppExchange Directory page so that you can find it later."

This really makes no sense. Why would the Change Set I uploaded a few hours ago "work" and the new one not work? Plus, why does the error message talk about the "AppExchange"? The absolute worst part is checking back in a few days. At this point, I'm half way through a major deployment and unable to continue.

I just wanted to check my understanding of the System.isBatch() method. Essentially if your implementing batchable would you expect System.isBatch() to be true?

 

global class myClass implements Database.Batchable<sObject>{

	global final String query;
	
	/* Constructor */
	global myClass(String q){
		query = q;
	}

	global Database.QueryLocator start(Database.BatchableContext bc){
  		System.debug('*** Batch start  ***');
		return Database.getQueryLocator(query); 
	}
	
	global void execute(Database.BatchableContext BC, List<sObject> myList) {
		
		// Run Stuff.
		System.debug(System.isBatch());
		
	}
	
	global void finish(Database.BatchableContext BC){
		System.debug('*** Batch finish ***');
	}
 
}

 

I've noticed that if you're writing a unit test using v24 of the API without the @SeeAllData=true annotation, there seems to be a catch-22 type problem with the Standard Pricebook.

 

The following unit test code will return an error because the Unit Test does not see the Standard Pricebook: 

string standardPB = [Select Id from Pricebook2 where IsStandard=true limit 1].Id;

 

If you try to create a new Standard Pricebook with the following, that code cannot be saved since the IsStandard field is not updatable (error = "Field is not writeable: Pricebook2.IsStandard"):

Pricebook2 pb = new Pricebook2(Name='Standard Pricebook', IsStandard = true);
insert(pb);

 

 

The result is that you simply can't write a unit test that needs to be able to create an Opportunity or Quote with Products in v24 without using @SeeAllData=true. Obviously not best practice, but I can't find a work-around.

 

 

Best Regards,

 

Mike

We want to use a custom font for our Support page nav bar button text - Trade Gothic.

 

Here is how we intend to implement. Is this correct before we expend resources to implement.

 

 

1. load the font files in the /staticpkg/staticresources/ folder.

 

2. load a separate .resource file with a corresponding .xml for each font file type, and code the files in the same manner as images are loaded in this folder

 

3. Edit the  CSS file that is included in our "knowledgeLayout.page" file to include the font embed CSS and point the path for each font file to the static resource folder where they live, as follows:

 

@font-face {
    font-family: 'TradeGothic';
    src: url('/support/resource/1294100226000/tradegot-webfont.eot');
    src: url('/support/resource/1294100226000/tradegot-webfont.eot?#iefix') format('embedded-opentype'),
         url('/support/resource/1294100226000/tradegot-webfont.woff') format('woff'),
         url('/support/resource/1294100226000/tradegot-webfont.ttf') format('truetype'),
         url('/support/resource/1294100226000/tradegot-webfont.svg#TradeGothicMedium') format('svg');
    font-weight: normal;
    font-style: normal;

}

@font-face {
    font-family: 'TradeGothic';
    src: url('/support/resource/1294100226000/tradegotboltwo-webfont.eot');
    src: url('/support/resource/1294100226000/tradegotboltwo-webfont.eot?#iefix') format('embedded-opentype'),
         url('/support/resource/1294100226000/tradegotboltwo-webfont.woff') format('woff'),
         url('/support/resource/1294100226000/tradegotboltwo-webfont.ttf') format('truetype'),
         url('/support/resource/1294100226000/tradegotboltwo-webfont.svg#TradeGothicBoldTwo') format('svg');
    font-weight: bold;
    font-style: normal;

}

 

4. add the "TradeGothic" attribute to ous nav button text CSS.

 

Done.

I have Sites enabled to serve as the login for our Customer Portal, and have used CNAME to re-direct traffic from
http://<customdomain>.com to the Site, where the customer then logs in using their credentials. At the site level I have the "Custom Address" field configured to <customdomain>.com.

 

All works great, EXCEPT, once the customer logs in they, unfortunately see the https URL with "...force.com" in it e.g. https://na1.salesforce.com/a02/o This is not good, since I would like to mask the fact from the customer that they are in fact running on a SFDC instance!

Would really appreciate any expert help and precise guidance on how to overcome this. Do I need to roll my own URLRewriter class or what?

 

Thanks.


--Boman.

In the past I was able to use the pn, pc and pv parameters on report URL's to dynamically add filters via the URL. That functionality stopped working recently and I can't seem to get it to work at all anymore.

For example, this URL works but only because I have the field saved as the first filter: /00O5000000328yO?pv0=031

However, if I try to change the first parameter using pc0= all the filters are removed when the report runs: /00O5000000328yO?pc0=00N500000029a7k&pn0=eq&pv0=031. I tried using the field name as well as both the 15 and 18 character versions of the field ID. Same results. In the past I was able to pass in the 15 character field ID as the pc0 parameter.

Is there a way to do this any more?

 


 

Best Regards,

 

Mike

I am loading the AJAX toolkit into a Visualforce page because the API has functionality in it that Apex does not support. Whether the user has API access or not, the script loads fine and the sforce object is created.

 

Within the sforce Javascript object, I don't see anything indicating whether a user has API access or not.  If I run a call (e.g. sforce.connection.describeGlobal()), a user without API access returns an error.

 

When the page loads I want to have a script invoked that tests whether the existing user has API access or not and result it in a true/false variable that I'll keep on the page.  I will then use the results of that variable to turn on/off functionality for the page.

 

Can anyone help with a safe function to run that accomplishes can test whether API access is turned on and return true or false?  I've tried, but have had trouble catching all the possible errors.  I need it so that no Javascript errors are thrown because that kills IE and looks ugly in the console of the other browsers.

  • January 27, 2012
  • Like
  • 0

Hi

 

My visualforce page was working fine on IE8 with ajax being used. But on IE9 it gives an error

 

 

SCRIPT16386: No such interface supported
 
3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

SCRIPT16386: No such interface supported 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

Any idea how it can be solved? 

  • March 21, 2011
  • Like
  • 0

I'm not sure what I'm missing on this code.  Any suggestions? Thanks in advance for your assistance. 

 

I keep getting this error (Save error: Non-void method might not return a value or might have statement after a return statement. ) on the update opptysToUpdate; line the end of this method:

 

public with sharing class CurrentPumpASP {

	Date currentDate = date.today();
 	Integer currentYearDate = currentDate.year();
	String currentYear = String.valueof(currentYearDate);

 Opportunity writePumpASP(){
	
	List<Opportunity> opptysToUpdate = [SELECT o.id, o.name, o.ASP__c, o.Product_Product_Group__c,
			        o.Account.Primary_GPO__c
				FROM Opportunity o
				WHERE o.Type = 'MMS' 
				AND o.ASP__c = NULL];
				
	  for(Opportunity pumpOpptys : opptysToUpdate ){
					
				pumpOpptys.ASP__c = [SELECT Year__c, Pump_ASP__c, Primary_GPO__c, DTS_Pump_Type__c, CreatedDate 
						   	 			 FROM PumpASP__c 
							 			 WHERE Year__c = :currentYear 
							 			 AND DTS_Pump_Type__c = : pumpOpptys.Product_Product_Group__c
							 			 AND Primary_GPO__c = : pumpOpptys.Account.Primary_GPO__c].Pump_ASP__c;
				opptysToUpdate.add(pumpOpptys);
				}
				
		if(!opptysToUpdate.isEmpty()){		
		update opptysToUpdate;
		}
	 }
  }	

 

 Description Resource Path Location Type

I have a client that wants to send automated emails (that have to be done through Apex) based on specific dates. For example:

 

  • Send an eMail 2 days before the 'Close Date'
  • Send an eMail once per week between the Start Date and Close Date

 

Unfortunately I can't use standard time-dependent workflows because the eMails they want to send cannot be sent through the normal email process (apex needed to build the email).

 

My original thought was to use a Time-Dependent Workflow rule to initiate the eMail, however that has two problems:

 

  1. Can't send an Outbound Message to an Apex class
  2. Can't find a way to repeat a message every week between two dates

 

I thought about using a Trigger to schedule an Apex job, but you cannot schedule more than 10 classes at the same time, which I think means I could not have more then 10 records scheduled for an eMail (there could potentially be hundreds). Or, does this really mean that a single class can be scheduled multiple times, but no more than 10 different classes can be scheduled?

 

Anyway, not sure the best way to make this happen without writing a great deal of custom code. I really wanted to give the client as much control  as possible using Workflow Rules, but that option is looking doubtful. 

 

I'm curious how others would handle this need.

 

Thanks,

 

Mike

I have these number of records in the database for the following queries:

 

Total Parent__c records = 2800

Total Child__c records  = 77,800

 

On an average, each parent has around 30 childs.

 

When I run the following piece of code, I get a governor limit error (query row). Note that I get retrieving only 10 parent records! I still get this error. I  debug log says that only 177 records out of allowed 10,000 were retrieved.  Seems like there is some issue with Childs__r.size() statement. 

 

 

 

for (Parent__c p: [select Name,
(select Name from Childs__r)
from Parent__c limit 20] {
i++;
System.debug('i is ' + i);
System.debug('Name is ' +p.Name);
Double count =p.Childs__r.size();
System.debug('Child Count is ' + count);


}

 

System Log says:

 

 

12:44:31 ERROR - Evaluation error: System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop

 

Resource usage for namespace: (default)

Number of SOQL queries: 1 out of 100

Number of query rows: 177 out of 10000

Number of SOSL queries: 0 out of 20

Number of DML statements: 0 out of 100

Number of DML rows: 0 out of 10000

Number of script statements: 51 out of 200000 

 

 

When I write a differenr query where I get 1100 Parents, the query ran for 6 minutes and and I loop through every child of it,  I am able to go through 29678 records (i=29678).  The debug log says that that number of query rows is 1267...records...what's going on? 

 

 

for (Parent__c p: [select Name,
(select Name from Childs__r)
from Parent__c limit 1100] {

for (Child__c c:p.Childs__r) {

i++;
System.Debug(‘Child Name is ‘ + c.Name);
}

}

System.debug('i is ' + i);

 

 Debug Log:

 

Resource usage for namespace: (default)

Number of SOQL queries: 1 out of 100

Number of query rows: 1267 out of 10000

Number of SOSL queries: 0 out of 20

Number of DML statements: 0 out of 100

Number of DML rows: 0 out of 10000

Number of script statements: 59362 out of 200000

Maximum heap size: 938 out of 1000000 

 

 

 

 

Message Edited by GoForceGo on 03-02-2009 12:47 PM
Message Edited by GoForceGo on 03-02-2009 12:47 PM
Message Edited by GoForceGo on 03-02-2009 12:48 PM