• Serghei Sleptov
  • NEWBIE
  • 50 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 18
    Replies

Hello Community,

I have a trigger for a custom object . I need  to update a field of that custom object based on Product Entry UnitPrice.

Unfortunatelly, I can't find a way how to get a UnitPrice of a product of selected Price Book

Can anybody point me to a right derection?

here is my trigger:
 

trigger CPBXdeployment102 on Hosted_PBX_Deployment__c (before insert, before update) {

Set<Id> oppIds = new Set<Id>(); 

for(Hosted_PBX_Deployment__c newHPBX : Trigger.new)
{if(newHPBX.Opportunity__c !=null){oppIds.add(newHPBX.Opportunity__c);}}
List<Opportunity> hpbxOpportunity = [SELECT Id,OwnerId, Pricebook2Id FROM Opportunity WHERE id in :oppIds];

Map<Id, Opportunity>OppToHPBXMap = new Map<Id,Opportunity>();
for (Opportunity o :hpbxOpportunity) {OppToHPBXMap.put(o.Id,o);}




for(Hosted_PBX_Deployment__c newHPBX : Trigger.new){Opportunity OName = OppToHPBXMap.get(newHPBX.Opportunity__c); if(OName!=null){newHPBX.Opportunity_Name__c =  OName.Id;newHPBX.Opportunity_Owner__c =  OName.OwnerId;newHPBX.Price_Book__c = OName.Pricebook2Id;}}


}

Hi Everyone,

I've created a simpletrigger that creates a new record of custom object: Hosted_PBX_Deployment__c when a new Opportunity is created.
Now I need to set a value to a fiield: Rack_4_19_two_post_Qty__c in custom object that depends on a value of an Account field: All_Network_Devices_Qty__c
so if Account.All_Network_Devices_Qty__c <=11 then Rack_4_19_two_post_Qty__c =1 

what is the best way to reffer to an Account field from Hosted_PBX_Deployment__c trigger?

this is my trigger:

trigger AutoCreateHPBXdeployment on Opportunity (after insert) {


List<Hosted_PBX_Deployment__c> newHPBX = new List<Hosted_PBX_Deployment__c>();
  for (Opportunity opp : Trigger.new) {
      if(opp.Hosted_PBX__c=='Yes'){
    Hosted_PBX_Deployment__c hpbx = new Hosted_PBX_Deployment__c();
    hpbx.Opportunity__c  = opp.Id;
    hpbx.Opportunity_Account__c = opp.AccountId;
   
 
    newHPBX.add(hpbx);
      }
  }
  insert newHPBX;

}

Thank you!

Hi Folks,

Does anyone have an example of trigger that recalculates UnitPrice of an Opportunity Line Item on insert/update based on a filed value of a related opportuniuty?
 
Thank you.

HELLO COMMUNITY,

I need to create  a report  that shows what changed in a pipeline reports since last week - what was the beginning $ total? Then why did it change - how much $ was Closed Won, how much $ was Closed Lost, How much $ was added (new pops, moved up in probability, etc..), How much was removed (deleted opps, downgraded in probability, the $ amount decreased, etc..)

Can enybody advise?
Is it possible at all via Salesforce?

Thank you!

Hi Folks,

I have a custom object BOM__C  that is related to Opportunity
There are custom fields: Prod1_Price__C,  Pprod2_Price__Cis in BOM__C is it possble to create a trigger that will update the fields when BOM is crested based on Product Price from the Price Book that is curently selected for the Opportunity?

Thank you,
Serghei
I need a trigger that if there is a change on Account record gets all the Opportunities and Opportunity Products belong to that Account refreshed (edit and saved) using the updated information from parent Account record.
Can anybody advise?

Thank you,
Serghei
How to created an email alert if total amount of opened cases reaches lets say 100 per day?

Hello Community,

I have a trigger for a custom object . I need  to update a field of that custom object based on Product Entry UnitPrice.

Unfortunatelly, I can't find a way how to get a UnitPrice of a product of selected Price Book

Can anybody point me to a right derection?

here is my trigger:
 

trigger CPBXdeployment102 on Hosted_PBX_Deployment__c (before insert, before update) {

Set<Id> oppIds = new Set<Id>(); 

for(Hosted_PBX_Deployment__c newHPBX : Trigger.new)
{if(newHPBX.Opportunity__c !=null){oppIds.add(newHPBX.Opportunity__c);}}
List<Opportunity> hpbxOpportunity = [SELECT Id,OwnerId, Pricebook2Id FROM Opportunity WHERE id in :oppIds];

Map<Id, Opportunity>OppToHPBXMap = new Map<Id,Opportunity>();
for (Opportunity o :hpbxOpportunity) {OppToHPBXMap.put(o.Id,o);}




for(Hosted_PBX_Deployment__c newHPBX : Trigger.new){Opportunity OName = OppToHPBXMap.get(newHPBX.Opportunity__c); if(OName!=null){newHPBX.Opportunity_Name__c =  OName.Id;newHPBX.Opportunity_Owner__c =  OName.OwnerId;newHPBX.Price_Book__c = OName.Pricebook2Id;}}


}

Hi Everyone,

I've created a simpletrigger that creates a new record of custom object: Hosted_PBX_Deployment__c when a new Opportunity is created.
Now I need to set a value to a fiield: Rack_4_19_two_post_Qty__c in custom object that depends on a value of an Account field: All_Network_Devices_Qty__c
so if Account.All_Network_Devices_Qty__c <=11 then Rack_4_19_two_post_Qty__c =1 

what is the best way to reffer to an Account field from Hosted_PBX_Deployment__c trigger?

this is my trigger:

trigger AutoCreateHPBXdeployment on Opportunity (after insert) {


List<Hosted_PBX_Deployment__c> newHPBX = new List<Hosted_PBX_Deployment__c>();
  for (Opportunity opp : Trigger.new) {
      if(opp.Hosted_PBX__c=='Yes'){
    Hosted_PBX_Deployment__c hpbx = new Hosted_PBX_Deployment__c();
    hpbx.Opportunity__c  = opp.Id;
    hpbx.Opportunity_Account__c = opp.AccountId;
   
 
    newHPBX.add(hpbx);
      }
  }
  insert newHPBX;

}

Thank you!

HELLO COMMUNITY,

I need to create  a report  that shows what changed in a pipeline reports since last week - what was the beginning $ total? Then why did it change - how much $ was Closed Won, how much $ was Closed Lost, How much $ was added (new pops, moved up in probability, etc..), How much was removed (deleted opps, downgraded in probability, the $ amount decreased, etc..)

Can enybody advise?
Is it possible at all via Salesforce?

Thank you!

Hi Folks,

I have a custom object BOM__C  that is related to Opportunity
There are custom fields: Prod1_Price__C,  Pprod2_Price__Cis in BOM__C is it possble to create a trigger that will update the fields when BOM is crested based on Product Price from the Price Book that is curently selected for the Opportunity?

Thank you,
Serghei
I need a trigger that if there is a change on Account record gets all the Opportunities and Opportunity Products belong to that Account refreshed (edit and saved) using the updated information from parent Account record.
Can anybody advise?

Thank you,
Serghei
How to created an email alert if total amount of opened cases reaches lets say 100 per day?