• Enara Marcos
  • NEWBIE
  • 15 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
We have an opportunity line custom button in the opportunity line related list of the opportunity page layout. This button must be showed only when the country of the oportunity is one of a list (list indicated in a custom setting). This dependency is not corresponds to profiles (because some profiles can manage more than one country).

Our solution is the create an html home page component to put it as a narrow component. We can hide the button thanks to jquery, but we need to do 2 queries to known if the button should be hidden or not. We can't achieve it.

So, we decided to do the same with visualfoce home page component as a narrow componet, however, it is not possible to hide the button (we can't get elements outside the visualforce) or we don't know how to do it.

Is there any solution for this goal?
In Approval History related list in Opportunity page layout there are some buttons that apear which are not customized (submit for approval, recall,...)

We have a component in which we hide buttons with jquery. But it is impossible to hide the Submit for approval button in production (in Sandbox it is possible, and in production another button is possible).

We use some custom buttons in the opportunity that first validate it and then call the approval process. The buttons depends on the page layout. The Submit for approval button in the Approval History Related list, automatically call the approval process without the validations we need.
So, we need hide the Submit for approval button of the Approval History related list (because we are not allowed to customize the buttons in the related list to select the one that corresponds to the page layout). The Approval History related list must be showed in the page layouts.

The matter is that the code works properly in sandbox but not in production environment. This issue has nothing to do with our code, as it is the same in both environments. It has something to do with SFDC source code of approval history related list which is different in sandbox and production.
Since Winter 15 was developed (this monday) in sandbox we have the following error in SF internal code, but not our code. We will explain you an example.

We have a controller class with pricebookentryid in an opportunitylineitem update. We triggered the update in opportunitylineitem with a value in pricebookentryid.
Then, opportunitylineitem before update trigger started without pricebookentryid (=null).

We have found out that when the code executes a line with an update on an opportunity line item in a controller class, right before the OpportunityLineItem Before Update trigger gets executed, the pricebookEntry value gets lost (it becomes null). That doesn't happen with other OpportunityLineItem fields nor any other objects.

We have not got this problem before and now in production there is not any problem about it. We haven't change the code. There is the same code in sandbox an production. The code was deployed to production and it works. This only happens in sandbox.
We have an opportunity line custom button in the opportunity line related list of the opportunity page layout. This button must be showed only when the country of the oportunity is one of a list (list indicated in a custom setting). This dependency is not corresponds to profiles (because some profiles can manage more than one country).

Our solution is the create an html home page component to put it as a narrow component. We can hide the button thanks to jquery, but we need to do 2 queries to known if the button should be hidden or not. We can't achieve it.

So, we decided to do the same with visualfoce home page component as a narrow componet, however, it is not possible to hide the button (we can't get elements outside the visualforce) or we don't know how to do it.

Is there any solution for this goal?
Hi,

I am getting null pointer exception while retrieving PricebookEntry value from OpportunityLineItem and code details are below:

I am getting error for the venet if(Trigger.isBefore && Trigger.isUpdate)  and it was working fine eralier sudeenly satrted throwing error today:

Trigger:
trigger OpportunityLineItemTriggers on OpportunityLineItem (after insert, 
			after update, after delete ,before insert, before update ) {

	OLIClass OLineItemClass  = new OLIClass();

	if(Trigger.isBefore && Trigger.isInsert) {    
		OLIClass.updateOppLineItem_Field(Trigger.New);       
	}

	if(Trigger.isBefore && Trigger.isUpdate) {    
		OLIClass.updateOppLineItem_Field(Trigger.New);  
	}
}

Apex Class:
public without sharing class OLIClass {
	// Function to copy Offer Field Value from Product to OpportunityLineItem  P
	public void updateOppLineItem_Field(List<OpportunityLineItem> newList) {
		Set<Id> PBEIds = new Set<Id>();

		for(OpportunityLineItem oli: newList) {        
			PBEIds.add(oli.PricebookEntryId);
		}

		Map<ID,PricebookEntry> pbeMap = new Map<ID,PriceBookEntry>([Select p.Product2.Offer__c, p.Product2Id, p.Id From PricebookEntry p where ID IN : PBEIds]);
		for(OpportunityLineItem oli: newList) {
			oli.Offer__c  = map_PBE.get(oli.PricebookEntryId).Product2.Offer__c;
		}
	}
}

Can any one please help me to overcome this error.

Regards,
Rajesh Meti
A new problem has suddenly appeared this week in our sandboxes. When I update an OpportunityLineItem, my "before update" trigger sees a null value in the PricebookEntryId field. But this is an update to an existing OpportunityLineItem, so it should have an associated PricebookEntry. When I extract the record in the data loader, it does in fact have a PricebookEntryId. This worked flawlessly last week. Our sandboxes run on CS17, and I can see that Winter 15 is released this weekend, so I guess it is related to that release. It seems like a bug in the platform. Does anybody know of a workaround? We are in the finishing phase of a large project, and our UAT testing is heavily impacted by this, since users are no longer able to make any updates to existing OpportunityLineItems.