• E.J.R
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
I've searched hours for a solution or even just someone with the same problem, to no avail. Any help would be greatly appreciated. To illustrate the problem, I've created a very simple test.

In SF Classic, I added a home page component to the home page layout, like so:

User-added image

When I click the "Edit" button, the iframe redirects to a new page (the only difference being a GET parameter I add to the URL called "edit"). You can see the address bar in both screenshots holds the same URL. The page itself does not reload, just the iframe.

User-added image

Now I want this same behavior to happen on Lightning Experience. To start, I add the VF page as a component within the Lightning App Builder, and here's the initial result:

User-added image

After clicking "Edit", the entire page gets redirected (rather than just the iframe), as seen below:

User-added image
I'm brought to a completely new page altogether. How can I prevent this from happening? I want the iframe to reload seamlessly, while remaining on the home page.

VF Page:
<apex:page controller="TestRedirect">
    <apex:pageBlock >       
        <apex:pageBlockButtons location="top">
            <apex:form >          
                <apex:commandButton action="{!test}" value="Edit" />                      
            </apex:form>                            
        </apex:pageBlockButtons>
    </apex:pageBlock>
    <apex:outputPanel rendered="{!editing}">
        Editing
    </apex:outputPanel>   
</apex:page>

Controller:
public class TestRedirect
{
    public Boolean editing {get;set;}
    public TestRedirect()
    {
        editing = ApexPages.currentPage().getParameters().get('edit') == 'true';
    }
    public PageReference test()
    {
        PageReference pageRef = Page.TestRedirect;
        pageRef.getParameters().put('edit', 'true');
        pageRef.setRedirect(true);        
        return pageRef;
    }
}
  • May 18, 2021
  • Like
  • 0
On our website, we have a form that customers use to update some of their information. The page uses a custom controller. The information is stored in a custom object. The customer presses a CommandButton to initiate any updates. In preparation for the Spring release, when Edit and Delete permissions are removed from our ORG, I manually removed these permissions ahead of time to see the impact on that page. For some reason, the object is still able to be updated by the Site Guest User, despite the profile having no Edit permissions to do so. In what situations could this be allowed to happen?
  • February 05, 2021
  • Like
  • 0
This has been happening a lot recently. I write some code and it seems to work perfectly, but only when I have the developer console open. Below is a simple example of this happening again today:

I have a custom visualforce page that plots opportunities on the map, and color codes the map markers based on the driver's assigned color.

When I load the page with the developer console closed, the map markers don't get colored in:
Not working

To fix this, all I need to do is open the developer console, and voila, the colors show up:
Working

I assume this is some kind of coding issue, but I don't want to confuse things by posting sample code. My main interest is how this is even possible. What effect does the developer console have on the execution of code? Any info would be helpful and speculation is welcome.Thanks!
 
  • October 15, 2018
  • Like
  • 0
This has happened on several occasions in the past and it's happening again today.

I created a fairly simple 'before insert' trigger for opportunity products. When I test the trigger under the administrator account, with the developer console on, the code runs perfectly as intended. But when I close the developer console window, the trigger no longer fires.

The same thing happens for different users as well. If I set a trace flag for a particular user, the trigger fires just fine when logged in as that user. But after deleting the trace flag, the trigger stops firing. I can duplicate this behavior back and forth over and over.

If anyone could point me in the right direction, I would really appreciate it. Right now it's a struggle finding any relevant info.

Note sure if this will help but here's the code for the trigger:
trigger OpportunityProductInsert on OpportunityLineItem (before insert)
{
    // List of all line items IDs before being inserted
    List<Id> oliIds = new List<Id>();
    
    // List of all opportunity IDs of the line items
    List<Id> oliOppIds = new List<Id>();
    
    // List of all product IDs associated to the line items
    List<Id> oliProductIds = new List<Id>();
    
    for ( OpportunityLineItem newOli : trigger.new )
    {
        oliIds.add(newOli.Id);
        oliOppIds.add(newOli.OpportunityId);
        oliProductIds.add(newOli.Product2Id);
    }

    // Map to retrieve the account ID for each opportunity
    Map<Id, Id> oliAccountIdMap = new Map<Id, Id>();    
    List<Opportunity> opps = [SELECT Id, AccountId FROM Opportunity WHERE Id IN: oliOppIds];
    for ( Opportunity opp : opps )
    {
        oliAccountIdMap.put(opp.Id, opp.AccountId);
    }
    
    // List of all product IDs that are inventory items
    List<Id> inventoryProductIds = new List<Id>();    
    List<Product2> products = [SELECT Id FROM Product2 WHERE IsNonInventory__c = false AND Id IN: oliProductIds];
    for ( Product2 product : products )
    {
        inventoryProductIds.add(product.Id);
    }
    
    // Map to retrieve a list of available products for each account
    Map<Id, List<Id>> accProductMap = new Map<Id, List<Id>>();
    List<Id> accProductIds;
    List<AccountProduct__c> accProducts = [SELECT Account__c, Product__c FROM AccountProduct__c WHERE Account__c IN: oliAccountIdMap.values()];
    for ( AccountProduct__c accProduct : accProducts )
    {
        accProductIds = new List<Id>();
        if ( accProductMap.containsKey(accProduct.Account__c) )
        {
            accProductIds = accProductMap.get(accProduct.Account__c);
        }
        accProductIds.add(accProduct.Product__c);
        accProductMap.put(accProduct.Account__c, accProductIds);
    }
    
    // Check that the product is available on the account
    for ( OpportunityLineItem checkOli : trigger.new )
    {
        accProductIds = new List<Id>();        
        Id accId;
        
        // Retrieve the account ID from the line item ID        
        if ( oliAccountIdMap.containsKey(checkOli.OpportunityId) )
        {
            accId = oliAccountIdMap.get(checkOli.OpportunityId);            
        }    
            
        if ( accId != null )
        {
            // If the product ID on the line item is in the list of inventory items
            if ( inventoryProductIds.contains(checkOli.Product2Id) )
            {                
                accProductIds = new List<Id>();
                
                // Retrieve list of available products on the account
                if ( accProductMap.containsKey(accId) )
                {
                    accProductIds = accProductMap.get(accId);         
                }
                
                // If the product ID is not in the list of account product IDs            
                if ( !accProductIds.contains(checkOli.Product2Id) )
                {
                    checkOli.addError('This product isn\'t available for this account.');
                }                                    
            }
        }
    }
}
  • September 04, 2018
  • Like
  • 0

Hi,

I'm looking for some general advice. I've been desperately trying to uninstall this package from production for a few days. I started with 50 component conflicts and have gotten the list down to just 2, which are listed next. In bold are the components relying on the package, however I have not been able to locate them and there's no direct link like there was for the other conflicts.

Component Type: Package
Name: ServiceMax
Problem:This extension depends on the package you are trying to uninstall. ExpressCustomConfig


Component Type: Package
Name: ServiceMax
Problem: This extension depends on the package you are trying to uninstall. Email Service Report


Steps taken so far:

If you could point me in the right direction or if you have any advice at all it would be greatly appreciated!

Thanks for your time.

  • August 16, 2016
  • Like
  • 1

Hi,

I'm looking for some general advice. I've been desperately trying to uninstall this package from production for a few days. I started with 50 component conflicts and have gotten the list down to just 2, which are listed next. In bold are the components relying on the package, however I have not been able to locate them and there's no direct link like there was for the other conflicts.

Component Type: Package
Name: ServiceMax
Problem:This extension depends on the package you are trying to uninstall. ExpressCustomConfig


Component Type: Package
Name: ServiceMax
Problem: This extension depends on the package you are trying to uninstall. Email Service Report


Steps taken so far:

If you could point me in the right direction or if you have any advice at all it would be greatly appreciated!

Thanks for your time.

  • August 16, 2016
  • Like
  • 1
I've searched hours for a solution or even just someone with the same problem, to no avail. Any help would be greatly appreciated. To illustrate the problem, I've created a very simple test.

In SF Classic, I added a home page component to the home page layout, like so:

User-added image

When I click the "Edit" button, the iframe redirects to a new page (the only difference being a GET parameter I add to the URL called "edit"). You can see the address bar in both screenshots holds the same URL. The page itself does not reload, just the iframe.

User-added image

Now I want this same behavior to happen on Lightning Experience. To start, I add the VF page as a component within the Lightning App Builder, and here's the initial result:

User-added image

After clicking "Edit", the entire page gets redirected (rather than just the iframe), as seen below:

User-added image
I'm brought to a completely new page altogether. How can I prevent this from happening? I want the iframe to reload seamlessly, while remaining on the home page.

VF Page:
<apex:page controller="TestRedirect">
    <apex:pageBlock >       
        <apex:pageBlockButtons location="top">
            <apex:form >          
                <apex:commandButton action="{!test}" value="Edit" />                      
            </apex:form>                            
        </apex:pageBlockButtons>
    </apex:pageBlock>
    <apex:outputPanel rendered="{!editing}">
        Editing
    </apex:outputPanel>   
</apex:page>

Controller:
public class TestRedirect
{
    public Boolean editing {get;set;}
    public TestRedirect()
    {
        editing = ApexPages.currentPage().getParameters().get('edit') == 'true';
    }
    public PageReference test()
    {
        PageReference pageRef = Page.TestRedirect;
        pageRef.getParameters().put('edit', 'true');
        pageRef.setRedirect(true);        
        return pageRef;
    }
}
  • May 18, 2021
  • Like
  • 0
On our website, we have a form that customers use to update some of their information. The page uses a custom controller. The information is stored in a custom object. The customer presses a CommandButton to initiate any updates. In preparation for the Spring release, when Edit and Delete permissions are removed from our ORG, I manually removed these permissions ahead of time to see the impact on that page. For some reason, the object is still able to be updated by the Site Guest User, despite the profile having no Edit permissions to do so. In what situations could this be allowed to happen?
  • February 05, 2021
  • Like
  • 0
This has happened on several occasions in the past and it's happening again today.

I created a fairly simple 'before insert' trigger for opportunity products. When I test the trigger under the administrator account, with the developer console on, the code runs perfectly as intended. But when I close the developer console window, the trigger no longer fires.

The same thing happens for different users as well. If I set a trace flag for a particular user, the trigger fires just fine when logged in as that user. But after deleting the trace flag, the trigger stops firing. I can duplicate this behavior back and forth over and over.

If anyone could point me in the right direction, I would really appreciate it. Right now it's a struggle finding any relevant info.

Note sure if this will help but here's the code for the trigger:
trigger OpportunityProductInsert on OpportunityLineItem (before insert)
{
    // List of all line items IDs before being inserted
    List<Id> oliIds = new List<Id>();
    
    // List of all opportunity IDs of the line items
    List<Id> oliOppIds = new List<Id>();
    
    // List of all product IDs associated to the line items
    List<Id> oliProductIds = new List<Id>();
    
    for ( OpportunityLineItem newOli : trigger.new )
    {
        oliIds.add(newOli.Id);
        oliOppIds.add(newOli.OpportunityId);
        oliProductIds.add(newOli.Product2Id);
    }

    // Map to retrieve the account ID for each opportunity
    Map<Id, Id> oliAccountIdMap = new Map<Id, Id>();    
    List<Opportunity> opps = [SELECT Id, AccountId FROM Opportunity WHERE Id IN: oliOppIds];
    for ( Opportunity opp : opps )
    {
        oliAccountIdMap.put(opp.Id, opp.AccountId);
    }
    
    // List of all product IDs that are inventory items
    List<Id> inventoryProductIds = new List<Id>();    
    List<Product2> products = [SELECT Id FROM Product2 WHERE IsNonInventory__c = false AND Id IN: oliProductIds];
    for ( Product2 product : products )
    {
        inventoryProductIds.add(product.Id);
    }
    
    // Map to retrieve a list of available products for each account
    Map<Id, List<Id>> accProductMap = new Map<Id, List<Id>>();
    List<Id> accProductIds;
    List<AccountProduct__c> accProducts = [SELECT Account__c, Product__c FROM AccountProduct__c WHERE Account__c IN: oliAccountIdMap.values()];
    for ( AccountProduct__c accProduct : accProducts )
    {
        accProductIds = new List<Id>();
        if ( accProductMap.containsKey(accProduct.Account__c) )
        {
            accProductIds = accProductMap.get(accProduct.Account__c);
        }
        accProductIds.add(accProduct.Product__c);
        accProductMap.put(accProduct.Account__c, accProductIds);
    }
    
    // Check that the product is available on the account
    for ( OpportunityLineItem checkOli : trigger.new )
    {
        accProductIds = new List<Id>();        
        Id accId;
        
        // Retrieve the account ID from the line item ID        
        if ( oliAccountIdMap.containsKey(checkOli.OpportunityId) )
        {
            accId = oliAccountIdMap.get(checkOli.OpportunityId);            
        }    
            
        if ( accId != null )
        {
            // If the product ID on the line item is in the list of inventory items
            if ( inventoryProductIds.contains(checkOli.Product2Id) )
            {                
                accProductIds = new List<Id>();
                
                // Retrieve list of available products on the account
                if ( accProductMap.containsKey(accId) )
                {
                    accProductIds = accProductMap.get(accId);         
                }
                
                // If the product ID is not in the list of account product IDs            
                if ( !accProductIds.contains(checkOli.Product2Id) )
                {
                    checkOli.addError('This product isn\'t available for this account.');
                }                                    
            }
        }
    }
}
  • September 04, 2018
  • Like
  • 0

Hi,

I'm looking for some general advice. I've been desperately trying to uninstall this package from production for a few days. I started with 50 component conflicts and have gotten the list down to just 2, which are listed next. In bold are the components relying on the package, however I have not been able to locate them and there's no direct link like there was for the other conflicts.

Component Type: Package
Name: ServiceMax
Problem:This extension depends on the package you are trying to uninstall. ExpressCustomConfig


Component Type: Package
Name: ServiceMax
Problem: This extension depends on the package you are trying to uninstall. Email Service Report


Steps taken so far:

If you could point me in the right direction or if you have any advice at all it would be greatly appreciated!

Thanks for your time.

  • August 16, 2016
  • Like
  • 1