• Tushar Tyagi 45
  • NEWBIE
  • -1 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
Hi, we have a button on visualforce page which has been called from community portal which is used to navigate from one visualforce page to other visualforce page with the help of the page reference class. The button is not responding.
Hi,

I have written this apex class to update prices on Product Interest Line Item, when price on Price book enteries changes.. However, the new price is not reflcting.. Can someone please help
Also, I want the new price to come basis the pricebook selected on the Product Interest level.

So , If A pricebook has 20 , and B pricebook has 30 , and If selected pricebook is 20. I want to update the New price field with changes in Pricebook A.
,

Also, I need to understand is a batch required for this or it will work everytime a price gets changed. Reason of asking is , I need to send a mail, when price on Price book entry is lower than Product Interest line item



public class UpdateRecentPriceOnProductInterest {
    
     public void updateList()

{ List<Product_Interest_Line_Item__c> pliobj;

   pliobj=[select Id, name,Product_Code__c,    New_Price__c,CSP_Edit__c from Product_Interest_Line_Item__c];
 
  for(Product_Interest_Line_Item__c pli :pliobj)
  {

Map<Id,PricebookEntry> mapPe=new Map<Id,PricebookEntry>([select id, UnitPrice from PricebookEntry and Productcode = : pli.Product_code__c]);
  for(Id id : mapPe.keySet())
    {  

 pli.New_Price__c=mapPe.get(pli.Product_code__c).unitprice;
 }
}
   update pliobj;
}

}
Hello,
My trigger :

trigger stopTaskDelete on Task (before delete) {
    Id profileid = Userinfo.getProfileId();
    profile profilename = [select Name from Profile where id=:profileid];
    for(Task T1:Trigger.old){
        if(profilename.Name != 'System Administrator'){
            T1.adderror('You can not delete task');
        }
    }
}

How can I make this trigger work via Handler class? and how do I write test class for this?

when a Product is added to Opportunity, Check for previous Orders related to Opportunity account and
and if no orders exists then update a picklist field on Opportunity as (New).

if any Orders exists then check for the latest orders price and compare it with our new product price that we are adding.

if it is greater than new product's price then update  picklist on opportunity as Loss
if less then update as WOn.

I have Written a trigger to achieve this and was stuck at this point. Needed help to proceed further..!



trigger triggeronopportunity on Opportunity (before insert,before update) {
    List<opportunity> oppo = new List<opportunity>();
    List<Account> acc = new List<Account>();
    List<OpportunityLineItem> oppl = new List<OpportunityLineItem>();
    List<PricebookEntry> pb = new List<PricebookEntry>();
   Set<ID> OppIds = new Set<ID>();
    Set<ID> accIds = new Set<ID>();
    for(Opportunity opp : trigger.new){
        if(oppl.size() == 0){
            opp.Revenue_Type__c = 'New ';
            }
        for(Account a : [Select Id, Order_Product__c FROM Account Where Id in :OppIds ]){
            
========== Struck Here ==============
       
        }   
    }
}



 
  • April 12, 2016
  • Like
  • 1

Hi,

I am new to salesforce.pl anyone can help me how to implement trigger for the following

        When a number is inserted, how to find that number is even/odd or prime number or armstrong or a palindrome.

Thanks in advance