• wesnolte
  • SMARTIE
  • 1596 Points
  • Member since 2009

  • Chatter
    Feed
  • 60
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 388
    Replies

Hey,

 

I have an application that works very well in unpackaged, or unmanaged packaged code. However if I upload it to a managed package then the JavaScript remoting calls fail. I know this because nothing happens in my app and the following appears in the console:

 

 

Here I notice that it's not prepending my package namespace, a bug from managed packaging when it originally came out! Having a look at the sourcecode confirms this:

 

 

I've FBI'ed the code out but there's no namespace to the doubleunderscores in this code.

 

This leads me to believe I've uncovered a bug which makes me sad since my app is about 80% JavaScript. Any chance I'm doing something incorrectly and this isn't a bug?

 

Wes

 

Hello...I consolidated 6 plain text email templates into 1 using conditional mark up (CASE) thus rendering the appropriate phrasing for the particular instance of the email. This worked like a charm and enabled me to have one CommandButton on a related VisualForce page instead of the 6 I had previously had.
Unfortunately the client made a follow up request: consolidate two of them further into one email but with much less content. On the surface it didn’t sound like too much work until I realized the only way to still use the same template was to obscure whole sections of text for this final scenario.
 
Below is a snippet of what I’ve been testing in the plain text template:

 
{!CASE(Session__c.Email_Notification__c, "FIRST APPOINTMENT", “START OF TEST”, “START OF TEST”)}
{!CASE(Session__c.Email_Notification__c, "FIRST APPOINTMENT", “”, “Please pay special attention to instructions below.”)}

{!CASE(Session__c.Email_Notification__c, "FIRST APPOINTMENT", “”, “Instructions:”)}
{!CASE(Session__c.Email_Notification__c, "FIRST APPOINTMENT", “”, “In lieu of a tire blow out, keep your ipad strapped in with a seat belt. Rear seating is always preferable for an ipad. But enough about Pat Metheny.”)}
{!CASE(Session__c.Email_Notification__c, "FIRST APPOINTMENT", “END OF TEST”, “END OF TEST”)}

 

The above code renders great for records that are not flagged “FIRST APPOINTMENT” e.g

START OF TEST
Please pay special attention to instructions below.

Instructions:
In lieu of a tire blow out, keep your ipad strapped in with a seat belt. Rear seating is always preferable for an ipad. But enough about Pat Metheny.
END OF TEST

But it literally puts white spaces for records that are flagged "FIRST APPOINTMENT", so they render as:
 
START OF TEST
 
 
 
 
END OF TEST

 
I am looking for a way to completely collapse white space as 75% of the template ends up rendering as white space for the FIRST APPOINTMENT scenario.
 
I also tested the following:
 
 
{!IF(ISPICKVAL(Session__c.Email_Notification__c , "FIRST APPOINTMENT"), "random1", NULL)}
{!IF(ISPICKVAL(Session__c.Email_Notification__c , "FIRST APPOINTMENT"), NULL, "random2")}
{!IF(ISPICKVAL(Session__c.Email_Notification__c , "FIRST APPOINTMENT"), "random3", NULL)}

The code above renders as:

 
random1
 
random 3

 
Suggestions greatly appreciated!

 

Hello

 

I want to authenticate Customer Portal users via the API from a Java platform, but I'd like to hand the user over to a Salesforce customer portal without having to re-authenticate. I've thought of some trickery that might work, but I wondered if there might be a direct way to pass the session id to some Force.com functionality (exposed as a web service perhaps) and have the user seamlessly continue their journey.

 

Wes

I want to write code that does stuff based on the choices in a picklist. I know all the choices in a picklist and of course I could hardcode it, but I want to be able to edit the picklist choices without breaking my code.

 

Example:

 

Let's say I have a custom object that has a picklist value named "Mood" with the options of "Happy", "Sad" and "Fine". Next I have a visualforce page with a table with totals for each mood.

 

I could easily write code in the VF controller that pulls all my records, and iterates through each with a if statement that checks the mood and totals them.

 

The problem there is if I ever add another mood to the picklist, I would then have to edit my vf page and the controller apex to reflect the additional moods.

 

It would be a lot nicer to be able, in apex, to get a list of the picklist options and then iterate through those and run the tallying code.

 

 

This is not my specific usecase, but it illustrates it nicely. Could someone out there help me out? 

Oh, and FYI, I through this code in there:

 

 

schema.describefieldresult f = schema.sobjecttype.my_custom_object__c.fields.my_custom_field__c;

 

but I get an error page saying, System.Exception: Too many fields describes: 11 

 

 

We have a Visual Force page which contains three tabs and each tab has 3-4 tabPanels. Here in each tabPanel we have invoked one component which has some custom functionality. We have used actionRegion, switchType, re-render (Ajax) attributes also and tried to debug our code, there I found that when I am doing some action on one component queries of other components are also getting fired. And getting a exception Too many SOQL queries.

 

Any pointer or suggestion for get rid of this problem.

I created a custom object AccountContactAssociation that servers as a many-to-many join. It has two custom Master-Detail fields. 

 

One is named Account and is a Master-Detail(Account).

One is named Contact and is a Master-Detail(Contact).

 

I'm trying to create a trigger as follows:

 

 

trigger AccountContactAssociationTrigger on AccountContactAssociation__c (after insert) {

AccountContactAssociation__c ac = Trigger.new[0];

 

  

  ac.Contact.FirstName = ac.Account.Name;

 

 

 

 

What I am basically trying to do is to access a field in the Account that is referenced by the junction object (in this case string Name) and assign it to a FirstName field in the referenced Contact object.

 

 

The above code does not compile, and I have a hard time figuring how to access the abovementioned fields.

 

 

I would greatly appreciate any suggestions.

 

Thanks! 

Hello,

 

Sometimes my System Log does not connect to my Org. Meaning, nothing prints. I try to load a page with a controller that simply writes a debug statement out to the log but nothing shows up at all.

 

It's as if the log is not even connected.

 

Does anyone have any idea why this is happening? Is there a setting somewhere I need to turn on?

 

Thanks!

 

Kevin

I'm getting this error:

System.DmlException: Insert failed. First exception on row 0; first error: STRING_TOO_LONG, Subject: data value too large: Review final judgement; Teleconference with opposing counsel to correct Final Judgement (max length=80): [Subject]

Why is this error occurring, how can I fix these errors? Do I have to manually put a Check for Field length in APEXclasses when saving records? If so, That would be very tedious :( .. is there amny better idea to fix this issue? :)

Hi,

I have created a before insert trigger on a custom object Object1__c which will create records for another custom object Object2__c. There is a before insert trigger in Object2__c that will create records for the 3rd custom object Object3__c. Earlier I used to get governor limit errors on SOQL queries as they were inside a loop. Now I keep getting error on List size being above 1000. Could I catch and exception and show it as an error in the visualforce page. How do I caluclate for the limit.

Thanks

Krishnadas

www.steadfastglobal.com 

I am trying to get a handle on how to get past an error when trying to build a package.  The error is:

 

Package upload error. There are problems that prevent this package from being uploaded.
Average test coverage across all Apex Classes and Triggers is 27%, at least 75% test coverage is required.

 

I am puzzled about the 27% because when I run my packaged Apex Classes (I don't have any Triggers) individually I get 85% coverage.  See below.

 

WSContoller2 - 81%
setInTestMethod - 100%
wwwMyWebService - Can't run a test here.  This is a WSDL generated web service call out.

 

Is the 27% all Classes on my development site?  even if they aren't included in my package?

 

Besides the 3 classes above that I wrote, I show the following two Apex Classes that where on my development account when it was first established.  I think they are used for the "Start Here" tab.  Do they count against my code coverage percentages?
    startHereController
    XMLDom

Message Edited by George1313 on 08-11-2009 07:22 PM

Hello everyone!!

 

I'm trying to do a select. I have the object person, where I have two text fields; howAmI__c and SuperWord__c

 

 by default: SuperWord__c='pro-active'

 

 

 I want to select people with the SuperWord inside of the field  howAmI__c

 

for instead, a person with howAmI__c='I am a really pro-active person'

 

I think It's something like:

 

select  howAmI__c, SuperWord__c from Person__c where howAmI__c=%SuperWord__c%

 

but it doesn't work!!

 

Any Idea?!?!?

 

 

Thanks in advance!!!

Hi,

 

I'm totally newbie on Sales force, and I'm trying something that should be easy.

From a Case, I want to manage a new type of object, named SMS

I created the object and now I want to customize the page, with APEX

 

So, I created a class

 

global class NetsizeClass { private SMS__c currentSms; public SMS__c getSms() { return currentSms; } public NetsizeClass(ApexPages.StandardController controller) { if (currentSms == null) currentSms = new SMS__c(); string sms_id = System.currentPageReference().getParameters().get('id'); if (sms_id == null || sms_id == '') { // New SMS currentSms.message__c = 'New SMS '; } else currentSms= [select message__c, status__c, case__c, contact__c from SMS__c where id = :sms_id]; } public void SendSMS() { if (currentSms.id == null || currentSms.id == '')
// New SMS
else
// Existing SMS

upsert currentSms;
... } }

 

and a Page, that overload the 'New' button in my SMS object

 

<apex:page standardController="SMS__c" extensions="NetsizeClass"> <apex:sectionHeader title="New SMS" subtitle=""/> <apex:form> <apex:pageBlock title="SMS information"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Send SMS" action="{!SendSMS}"/> </apex:pageBlockButtons> <TABLE> <TR> <TD><B>Message</B></TD> <TD><apex:inputField value="{!sms.Message__c}" id="smsMsg"/></TD> </TR> <TR> <TD><B>Contact</B></TD> <TD><apex:inputField value="{!sms.Contact__c}" id="smsContact"/></TD> </TR> <TR> <TD><B>Case</B></TD> <TD><apex:inputField value="{!sms.Case__c}" id="smsCase"/></TD> </TR> <TR> <TD><B>Case 2</B></TD> <TD><apex:inputField value="{!SMS__c.Case__c}" id="smsCase2"/></TD> </TR> </TABLE> <br/> </apex:pageBlock> </apex:form> </apex:page>

 

It works fine, when I am on a Case, I see the button 'New SMS' (I customized the layout), that open my custom APEX page.

But I just don't know how to retreive the parent Case information (I'm using the 2 fields Case for my tests):

- the field smsCase is empty, and it's normal as it is linked to {!sms.Case__c} and sms is created in the constructor. But I read in some forums that it's the only way to retreive later the updated values (I want to customize the Edit and View page)

- the field smsCase2 is filled with the id of my Case, but I don't know how to retreive this data from my page.

 

I also would like to retreive automatically the contact linked in the parent Case, to link it to the SMS. But I think it should be easy to do when I'll have the ID of my Case.

 

I'm sure that I'm missing something but I searched in so much forums that I'm starting to mix-up everything.

Any help will be welcome :)

 

Thanks

Hervé

 

 

Hello,

 I am using the below code to redirect to the standard salesforce pages as:

 

    public PageReference Save()

    { 

String newPageUrl = 'https://ap1.salesforce.com/701/o';

   PageReference newPage = new PageReference(newPageUrl);

   newPage.setRedirect(true);

   return newPage; 

    } 

 This piece of code helps in navigating the page to campaign default page.Here the url-"https://ap1.salesforce.com/701/o" is the campaigns default page url for my account.

 

Instead of passing the complete url is there any way to redirect to sandard campaign page in pageReference method. 

 

Thanks,

shaan 

I have Product object in salesforce and there are some products like 'MQX', 'ARC 600' etc

 

I am trying to get records through LIKE query like:

 

results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);

 

When I set filterby variable to "MQX" its not returning records :smileysad:... When I tried tro get records for "ARC"also givinig me NULL but when I ask for "600" then its returning fine also when I requested " MQX"  mean with one space as prefix also getting result but not getting exact match but getting like "Prodcut of MQX" etc......please have a look on following code

 

private void BindData(Integer newPageIndex)
    {
        try
        {
                string sortFullExp = sortExpression  + ' ' + sortDirection;
                searchText=sortFullExp;
                if(filterby == null || filterby == '')
                {                    
                      //searchText='Coming';
                }
                else if(filterby != '')    
                {
                       
                        results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);
                      
                      
                    
                }                         
    
            pageResults = new List<Product2>();
            Transient Integer counter = 0;
            Transient Integer min = 0;
            Transient Integer max = 0;
            if (newPageIndex > pageNumber)
            {
                min = pageNumber * pageSize;
                max = newPageIndex * pageSize;
            }
            else
            {
                max = newPageIndex * pageSize;
                min = max - pageSize;
                //min = (min <>
            }
            for(Product2 a : results)
            {    
                counter++;
                if (counter > min && counter <= max)
                    pageResults.add(a);
            }
            pageNumber = newPageIndex;
            if (pageResults == null || pageResults.size() <= 0)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Data not available for this view.'));
               results=null;
               pageResults=null;
            }
        }
        catch(Exception ex)
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,ex.getMessage()));
        }
    }

 

I have 7000 products in my object. Please help me in this. I want to get actual records for LIKE query.. Please reply ASAP Thanks in advance.