• Claiborne
  • NEWBIE
  • 190 Points
  • Member since 2004
  • Principal
  • The Claiborne Company


  • Chatter
    Feed
  • 4
    Best Answers
  • 7
    Likes Received
  • 0
    Likes Given
  • 92
    Questions
  • 278
    Replies
There is a new critical update called Remove Instance Names From URLs for Visualforce, Community Builder, Site.com Studio, and Content Files.

DANGER! DANGER! DO NOT ACTIVATE!

This changes links for visualforce pages.  <domain name>.visualforce.com replaces <domain name>.<instancename>.visual.force.com.

For whatever reason, this does not work with Visualforce tabs or with buttons that link to visualforce pages.

With the critical update deactivated, the link for visualforce tab is https://<domain name>.<instancename>.visual.force.com/apex/TimeEntryCalendar?sfdc.tabName=01r500000003bNn.

When the critical update is activated, the link for the visualforce tab is https://<domain name>.visualforce.com/apex/TimeEntryCalendar?sfdc.tabName=01r500000003bNn.

The problem is that clicking the "activated" link yields this:
 
This site can’t be reached
<domain name>.visualforce.com’s server IP address could not be found.

In my case, it was a really big problem because the visualforce tab was the default home page. So activating the Critical Update essentially locked all of my users out of salesforce.com. 

This also fails with a simple button link to a visual force page.

If you assign a url to a button or type the link in - /apex/TimeEntryCalendar for instance, it works fine when the update is deactivated.

But activate the update, and it fails on just the simple link.

Problem exists in both Classic and Lightning.

MAJOR SNAFU!
This statement works:
        Account acct = (Account)Account.sObjectType.newSObject(null, true);

This one does not. 
        Quote newQuote = (Quote)Quote.sObjectType.newSObject(null, true);

Any ideas
Just a warning - If you have try to display a Visualforce page that contains a pick list field with global picklist values or "strict" picklist values AND the value assigned to the field is NOT on the strict list, your page will throw an "An internal server error has occurred." Be careful what you type. 

"Forewarned is forearmed."
I have an apex class that executes a for loop based on a query in the initialization class. The code is 
for (UserTerritory2Association uta : [
        select User.AccountId, User.Account.Name,
        User.Account.Regional_Manager__c,
        Territory2.Name, 
        Territory2.ParentTerritory2Id,
        Territory2.ParentTerritory2.Name
        from UserTerritory2Association 
        where user.usertype = 'PowerPartner'
        and Territory2.ParentTerritory2Id != null]) {
        .
        .
        .
    }
The code was developed in a full sandbox, and it executes without problem. And the test code works.

But when I deploy, all of the tests fail because of a failure in the class. The error is:
 
line 30, column 50: Didn't understand relationship 'Account' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
Stack Trace: null

So I shuffled the code to query the list outside of the loop. The new code is:
List<UserTerritory2Association> utaList1 = [
        select User.AccountId, User.Account.Name,
        User.Account.Regional_Manager__c,
        Territory2.Name, 
        Territory2.ParentTerritory2Id,
        Territory2.ParentTerritory2.Name
        from UserTerritory2Association 
        where user.usertype = 'PowerPartner'
        and Territory2.ParentTerritory2Id != null];
    
    for (UserTerritory2Association uta : utaList1) {
        .
        .
        .
    }
This deploys fine.

Any ideas why the first one does not work. 

Also, the query itself works fine in both the full sandbox and production.
 

 
Hi All,

Am working on salesforce Lightning, I just wanted to show Full Calander in salesforce Lightning Component. Can someone please help in this regard.

Thanks & Regards,
Ruhulla
I am trying to see if there is simpler way to disable the Create PDF button on a quote without having to create a new VF page and cutom controllers.  Create PDF button should be disabled based on field value in a quote, for example say the quote is in "Accepted" status then the Create PDF should be disabled OR other option is to display error message when the button is clicked indicating that the Create PDF function is not available when the quote is in "Accepted" status.
I have 3 different doFind's on my Pre-Chat form, one to find Accounts by Account Number (Auto Number field), one is to find customers by email field, and one is to find cases by case field.

When I had only one doFind in my prechat form for accounts by account number, it would automatically open up a sub-tab within the Service Console and display the correct account when the customer gave us their number in the form. However, when I introduced my 2 additional doFinds (customers by email and cases by case number), I expected it to give me 3 separate sub-tabs, one for each match. One account subtab, one contact subtab, and one case subtab. Instead, I am just receiving one sub-tab called "Search Results" which displays one account that matched, one contact that matched, and one case that matched:

User-added image

My user has to physically click on each of these 3 search results to open each in its own subtab.

I expected each of my 3 doFinds to open in its own tab since that was the result when my form had only one doFind. They are separate finds for different records so I figured it would work the same way - is this not the case? Is the functionality I am experiencing considered correct, or am I doing something wrong? My ideal solution would be that if the customer fills out all 3 fields, we get 3 subtabs within the Live Agent session in the console, specific to each record that we found that matched.

I hope this makes sense, please let me know if I can clarify any further.

Thanks!
Hi out there,
I an absolute Apex beginner and would like to solve a problem: Once an opportunity is closed won the products from that opportunity should automatically become assets for that customer. I know I need a trigger, a class and a test class. So in general my idea is as follows:

if opp stage = closed won
   and if opp has products
for each product (opp-line item) 
create asset
with account ID...
set asset name = product name

etc...

How can I solve this? Where could I find appropriate code samples? Any help is pretty welcome...
So thanks in advance...

best regards Thomas
Hey everyone,

Let me briefly explain the trigger I wrote (my frist trigger actually). On the opportunity, we have a look-up field to other opportunities called 'Renewed Opportunity'. The idea is that when you create an opp that is a renewal, you use that field to reference the previous opportunity that is being renewed.

The trigger looks at the stage of the new renewal opp and updates a field on the referenced 'Renewed Opporunity' called 'Renewal Status'. The goal is to be able to see if an opp ended up renewing or not.

The issue here is that many of our older opportunities don't meet the validation rules we currently have in place. So if you populate that look-up field with an opp with missing data, you'll get an error message preventing you from updating the new, renewal opp you're creating.

Obviously, one solution would be to go back and update all our older opps, but that's practically impossible. So here is my question:

1) Is there something I can write in either the trigger or the validation rules to set up a bypass? For the validation rules, I tried writing in 'NOT(ISCHANGED(Renewal_Status__c))', but it seems that as long as a record is referenced, the validation rules will be required. The trigger doesn't even have to update the record.

2) If option 1 is not possible, is there a way to write an error message in the trigger that at least explains to the user in a clear manner that they have to update the referenced opp? I'd also like to list in the error the validation rules that must be met, but that would be a bonus.

In case you want to take a look at my trigger, here it is:


trigger RenewalProcess on Opportunity (after insert, after update) {
   
   Set<String> allOpps = new Set<String>();
    for(Opportunity renewalOpp : Trigger.new) {
        if (renewalOpp.Renewed_Opportunity__c != null) {
            allOpps.add(renewalOpp.Renewed_Opportunity__c);
         }
    }

    List<Opportunity> potentialOpps = [SELECT Id FROM Opportunity WHERE Id IN :allOpps];

    Map<String,Opportunity> opportunityMap = new Map<String,Opportunity>();
        for (Opportunity o : potentialOpps) {
            opportunityMap.put(o.id,o);
        }
     
     List<Opportunity> oppsToUpdate = new List<Opportunity>();
       
        for (Opportunity renewalOpp : Trigger.new) {
            if (renewalOpp.Renewed_Opportunity__c != null && renewalOpp.StageName.equals('Closed Won')) {
                Opportunity renewedOpp = opportunityMap.get(renewalOpp.Renewed_Opportunity__c);
                renewedOpp.Renewal_Status__c = 'Renewed';
                oppsToUpdate.add(renewedOpp);
            }
            else if(renewalOpp.Renewed_Opportunity__c != null && !renewalOpp.IsClosed) {
                Opportunity renewedOpp = opportunityMap.get(renewalOpp.Renewed_Opportunity__c);
                renewedOpp.Renewal_Status__c = 'In Negotiations';
                oppsToUpdate.add(renewedOpp);
            }
            else if(renewalOpp.Renewed_Opportunity__c != null && (renewalOpp.StageName.equals('Closed Lost') || renewalOpp.StageName.equals('Closed Stalled'))) {
                Opportunity renewedOpp = opportunityMap.get(renewalOpp.Renewed_Opportunity__c);
                renewedOpp.Renewal_Status__c = 'Did Not Renew';
                oppsToUpdate.add(renewedOpp);
            }
           
           
        }
   
    update oppsToUpdate;
   
}



Let me know if you need anymore info from me!
-Greg

Can anyone suggest, how ca we delete apex class from production.

please provide step-step process to delete it from prod. through Force.com Eclipse.

Hi guys,

I'm experiencing some unexpected behavior when trying to use the apex:repeat function to render tabs....

Basically it seems that tabs cannot be created on demand?  My controller is definitely returning data... as the second page block in my sample will show... repeat works - just the tabs are not rendered..

I'm sure any of you guys can see where I was going with this - and I guess I can achieve a similar result by dropping down to boring old html - just trying to use the standard components (as per best practice)

Any assistance greatly appreciated - as the purist coder me is seriously disturbed at the moment...

here is my 'simplified' and easily testable page & controller

Code: VF PAGE
<apex:page controller="clsRecordType">
    <apex:pageBlock >
        <apex:tabPanel id="theTabPanel">
            <apex:tab label="Account Types"/>
            <apex:repeat value="{!RecordTypes}" var="types">
                <apex:tab label="{!types.Name}"/>     
            </apex:repeat>
        </apex:tabPanel>
    </apex:pageBlock>

    <apex:pageBlock >
        <apex:repeat value="{!RecordTypes}" var="types">
            {!types.Name}<br/>       
        </apex:repeat>
    </apex:pageBlock>
</apex:page>

and the controller

Code:
public class clsRecordType {

    list<RecordType> lrecordtypes;

    public list<RecordType> getRecordTypes() {
        if(lrecordtypes==null) lrecordtypes = [Select Name, Id, Description From RecordType  where SobjectType = 'Account' and IsActive=True];
        return lrecordtypes;
        }
   }

 
 

In salesforce.com, several entities (contact, account, lead, etc.) have one or more "address" fields. When you look at the wsdl, you can see that the "address" is actually comprised of several fields - street1, street2, street3, city, state/province, postal code, and country.
 
The problem is that the wsdl does not tell you the maximum field lengths for the various components. During some importing, I have discovered that the city field can only be 40 characters.  Short of running a series of tests, can anyone provide the limits on the various fields that make up an address.
 
It is the sort of thing that should be published somewhere.