Skip to main content
deleted 4 characters in body
Source Link
Caspar Harmer
  • 20.6k
  • 4
  • 35
  • 69

This is probably doable in a flow... but the to do this in a trigger, there are some generic steps that you can follow.

  1. Get get all the carrier product ids. Put them in a list or a set by looping Trigger.new

  2. Query the Carrier_Product__c object to get the checkbox field that you want. eg [SELECT Id, Rebalance__c FROM Carrier_Product__c WHERE Id IN :carrierProductIdList ];

  3. Put the results of this query into a Map<Id,Carrier_Product__c>

  4. Loop Trigger.new and use the product id to get the correct carrier product out of the map.

  5. Examine the value and set/unset the checkbox.

  6. This should be a before trigger, so you don't need to update.

This is probably doable in a flow... but the to do this in a trigger, there are some generic steps that you can follow.

  1. Get get all the carrier product ids. Put them in a list or a set by looping Trigger.new

  2. Query the Carrier_Product__c object to get the checkbox field that you want. eg [SELECT Id, Rebalance__c FROM Carrier_Product__c WHERE Id IN :carrierProductIdList ];

  3. Put the results of this query into a Map<Id,Carrier_Product__c>

  4. Loop Trigger.new and use the product id to get the correct carrier product out of the map.

  5. Examine the value and set/unset the checkbox.

  6. This should be a before trigger, so you don't need to update.

This is probably doable in a flow... but to do this in a trigger, there are some generic steps that you can follow.

  1. Get get all the carrier product ids. Put them in a list or a set by looping Trigger.new

  2. Query the Carrier_Product__c object to get the checkbox field that you want. eg [SELECT Id, Rebalance__c FROM Carrier_Product__c WHERE Id IN :carrierProductIdList ];

  3. Put the results of this query into a Map<Id,Carrier_Product__c>

  4. Loop Trigger.new and use the product id to get the correct carrier product out of the map.

  5. Examine the value and set/unset the checkbox.

  6. This should be a before trigger, so you don't need to update.

Source Link
Caspar Harmer
  • 20.6k
  • 4
  • 35
  • 69

This is probably doable in a flow... but the to do this in a trigger, there are some generic steps that you can follow.

  1. Get get all the carrier product ids. Put them in a list or a set by looping Trigger.new

  2. Query the Carrier_Product__c object to get the checkbox field that you want. eg [SELECT Id, Rebalance__c FROM Carrier_Product__c WHERE Id IN :carrierProductIdList ];

  3. Put the results of this query into a Map<Id,Carrier_Product__c>

  4. Loop Trigger.new and use the product id to get the correct carrier product out of the map.

  5. Examine the value and set/unset the checkbox.

  6. This should be a before trigger, so you don't need to update.