You need to sign in to do that
Don't have an account?
Rajan
Trigger Problem for Opportunity object
Hi friends,
I am facing problem for writing a trigger. Condition is as below:
This is for Apportunity object. Whenever I am creating an apportunity and saving the record then The Product detail should display with price under Product section of detail page. I have created Price book for all items as below.
Picklist field is -- Business category and values are Product and Service.
Dependent picklist (on business category) field is - Select product is - Product (BPMS and Lhetto) and for service (Java, Dot Net, salesforce)
For product, there is another field Licence which contains Unit Licence and Enterprise.
After saving the selected items in all these 3 fields, then the respective product or service with price shoud displace in Product section of the record detail page.
I am facing problem for writing a trigger. Condition is as below:
This is for Apportunity object. Whenever I am creating an apportunity and saving the record then The Product detail should display with price under Product section of detail page. I have created Price book for all items as below.
Picklist field is -- Business category and values are Product and Service.
Dependent picklist (on business category) field is - Select product is - Product (BPMS and Lhetto) and for service (Java, Dot Net, salesforce)
For product, there is another field Licence which contains Unit Licence and Enterprise.
After saving the selected items in all these 3 fields, then the respective product or service with price shoud displace in Product section of the record detail page.
For example, if Business Category is Business_Category__c, Select Product is Select_Prodct__c, and License is License__c, then your code may look something like this.
if (Business_Category__c == 'Product') {
// do product-specific code here
if (Select_Product__c == 'BPMS') {
// do something else special here
}
}
if (Business_Category__c == 'Service') {
// do same thing for services
}
Note: strings also can use string1.equals("Test String") or string1.equalsIgnoreCase("Test STRING") if you run into issues.
Remember at the trigger level you already have the data going to the database, so the fact that the picklists are dependent does not matter as much (if your worry is how to handle when they are visible). You just care to only check a field if it is proper condition, so you avoid nulls or blanks.
Hope that makes sense.