You need to sign in to do that
Don't have an account?
salesforce instance
adding formula in trigger
Hello
I have one workflow in which i have updated the formula as
IF( TEXT( SBQQ__SubscriptionPricing__c ) = "" , Net_Unit_Price_Monthly_WFR__c * SBQQ__Quote__r.Exchange_Rate_to_EUR_WFR__c *
IF(TEXT( SBQQ__PricingMethod__c) = 'Block',1,SBQQ__Quantity__c) , Net_Unit_Price_Monthly_WFR__c * SBQQ__Quote__r.Exchange_Rate_to_EUR_WFR__c * 12 * IF(TEXT( SBQQ__PricingMethod__c) = 'Block',1,SBQQ__Quantity__c)) it is working now but i want to populate this formula field in below trigger.
trigger QuoteLineupdate on SBQQ__QuoteLine__c (before insert, before update) {
for (SBQQ__QuoteLine__c QL: Trigger.new) {
if (false && trigger.oldMap != null && trigger.newMap != null){ // debugging aid Wim van Beek
List<String> Flds = new List<String>();
For (Schema.SObjectField FieldInfo : Schema.getGlobalDescribe().get('SBQQ__QuoteLine__c').getDescribe().fields.getMap().values()){
String FieldName = string.valueOf(FieldInfo.getDescribe().getName());
Flds.add(FieldName);
}
SBQQ__QuoteLine__c OldQ = trigger.oldMap.get(QL.id);
SBQQ__QuoteLine__c NewQ = trigger.newMap.get(QL.id);
for (String Fld: Flds){
if (OldQ.get(Fld) != NewQ.get(Fld)){
system.debug('------ Fld Line '+ Fld + ' : ' + OldQ.get(Fld) + ' ==> '+NewQ.get(Fld));
}
}
}
QL.Sales_Price_Term_translation_for_ACV__c=QL.Sales_Price_Term_for_ACV__c;
QL.Sales_Price_Term_translation_for_MCV__c=QL.Sales_Price_Term__c;
QL.Sales_Price_Term_translation_for_TCV__c=QL.Sales_Price_Term_for_TCV__c;
QL.sbFamily_Grouping_in_Template__c = QL.Quote_Line_Grouping_in_Template__c;
system.debug('QL.SBQQ__Quote__r.SBQQ__CustomerDiscount__c'+QL.SBQQ__Quote__r.SBQQ__CustomerDiscount__c);
// QL.Sales_Price_with_header_discount__c = String.valueOf(QL.Sales_Price__c * (1 - QL.SBQQ__Quote__r.SBQQ__CustomerDiscount__c/100));
}
}
Could anyone help on this.
I have one workflow in which i have updated the formula as
IF( TEXT( SBQQ__SubscriptionPricing__c ) = "" , Net_Unit_Price_Monthly_WFR__c * SBQQ__Quote__r.Exchange_Rate_to_EUR_WFR__c *
IF(TEXT( SBQQ__PricingMethod__c) = 'Block',1,SBQQ__Quantity__c) , Net_Unit_Price_Monthly_WFR__c * SBQQ__Quote__r.Exchange_Rate_to_EUR_WFR__c * 12 * IF(TEXT( SBQQ__PricingMethod__c) = 'Block',1,SBQQ__Quantity__c)) it is working now but i want to populate this formula field in below trigger.
trigger QuoteLineupdate on SBQQ__QuoteLine__c (before insert, before update) {
for (SBQQ__QuoteLine__c QL: Trigger.new) {
if (false && trigger.oldMap != null && trigger.newMap != null){ // debugging aid Wim van Beek
List<String> Flds = new List<String>();
For (Schema.SObjectField FieldInfo : Schema.getGlobalDescribe().get('SBQQ__QuoteLine__c').getDescribe().fields.getMap().values()){
String FieldName = string.valueOf(FieldInfo.getDescribe().getName());
Flds.add(FieldName);
}
SBQQ__QuoteLine__c OldQ = trigger.oldMap.get(QL.id);
SBQQ__QuoteLine__c NewQ = trigger.newMap.get(QL.id);
for (String Fld: Flds){
if (OldQ.get(Fld) != NewQ.get(Fld)){
system.debug('------ Fld Line '+ Fld + ' : ' + OldQ.get(Fld) + ' ==> '+NewQ.get(Fld));
}
}
}
QL.Sales_Price_Term_translation_for_ACV__c=QL.Sales_Price_Term_for_ACV__c;
QL.Sales_Price_Term_translation_for_MCV__c=QL.Sales_Price_Term__c;
QL.Sales_Price_Term_translation_for_TCV__c=QL.Sales_Price_Term_for_TCV__c;
QL.sbFamily_Grouping_in_Template__c = QL.Quote_Line_Grouping_in_Template__c;
system.debug('QL.SBQQ__Quote__r.SBQQ__CustomerDiscount__c'+QL.SBQQ__Quote__r.SBQQ__CustomerDiscount__c);
// QL.Sales_Price_with_header_discount__c = String.valueOf(QL.Sales_Price__c * (1 - QL.SBQQ__Quote__r.SBQQ__CustomerDiscount__c/100));
}
}
Could anyone help on this.