You need to sign in to do that
Don't have an account?
Component For Trigger
Hi All,
I have two triggers for two different Objects
trigger AirlineConfAirlineUrlTrigger on Airline_Conf__c (before insert, before update) {
for(Airline_Conf__c ac : Trigger.New)
{
ac.Airlines_Url__c = '';
if(ac.Airline__c =='Virgin Australia')
{
ac.Airlines_Url__c = '<a href="http://www.virginaustralia.com/Personal/Bookings/Managebookings/index.htm">Virgin Australia</a>';
}
}
}
trigger ETicketAirlineUrlTrigger on E_Ticket__c (before insert, before update) {
for(E_Ticket__c etNew : Trigger.New)
{
etNew.Airlines_Url__c = '';
if(etNew.Airline__c =='Virgin Australia')
{
etNew.Airlines_Url__c = '<a href="http://www.virginaustralia.com/Personal/Bookings/Managebookings/index.htm">Virgin Australia</a>';
}
}
}
both above triggers does same thing but on different Objects.
I need above trigger to use a component (if possible) or someting , so for any future changes , i only have to change it in one place and so it will refelect in both triggers
Any help would be appreciated
Thanks
Hi,
You can create a custom object inside the custom setting and create a field which will store this URL value. Now you can make the SOQL inside the trigger to get this value. So once you get this value you will be able to use as per your requirement. One advantage the SOQL limit is not count in governor limit if this is on Custom Setting Object.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Hi,
You can create a custom object inside the custom setting and create a field which will store this URL value. Now you can make the SOQL inside the trigger to get this value. So once you get this value you will be able to use as per your requirement. One advantage the SOQL limit is not count in governor limit if this is on Custom Setting Object.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Hello Ankit,
Thanks for your reply
I tried adding Custom Object but there is no option to Add a Picklist
I think a picklist will be helpful in my case where i need a value against a check like this
if(etNew.Airline__c =='Virgin Australia')
{
etNew.Airlines_Url__c = '<a href="http://www.virginaustralia.com/Personal/Bookings/Managebookings/index.htm">Virgin Australia</a>';
}
So if Picklist text ='Virgin Australia' then i will return URL
so i need to check first Name and the take its value
hope you got my point
is there any way do to above?
thanks
Ankit , you are great , just see using Manage i can add multiple values with name
Thanks
Hi,
Well in this you have to create the custom object. Custom setting object will not help you to meet the requirement. So instead create a Custom Object with desired fields.
Now will you please provide SOQL to get data from New Custom object and compare it in trigger
That will be so nice of you
Ankit,
Please check this
http://blog.jeffdouglas.com/2010/01/07/using-list-custom-settings-in-salesforce-com/
this is what i need....
just want to know how can i use where clause in SOQL something like
AirlineUrl__c[] acc = AirlineUrl__c.getAll().values().where('Name= Scandanavian Airlines');
where AirlineUrl__c i newly created Custom Object
Also can i use Custom Setting Object in Trigger of some custom object?
Like this
trigger AirlineConfAirlineUrlTrigger on Airline_Conf__c (before insert, before update) {
for(Airline_Conf__c ac : Trigger.New)
{
ac.Airlines_Url__c = '';
Airline__c au = Airline__c.getInstance(ac.Airline__c);
ac.Airlines_Url__c = au.url;
}
}
I m getting following error when trying above
AirlineConfAirlineUrlTrigger Not of type Custom Settings
Thanks
Hi Anil,
error says the u need to create Custom Setting for the " AirlineConfAirlineUrlTrigger "
To create Custom Setting please follow below steps:
Your Name| Setup | Develop| Custom Settings --- >
Need to create custom setting for required object.
Hope this helps U.Mark as solution if this helps U.
Ankit,
your suggestion works
i was doing something wrong
Thanks for all help