You need to sign in to do that
Don't have an account?

Pass a vlalue from a trigger to a class and return a value from the class back to the trigger
Is this possible?
from the trigger:
//call out to the class
returnStateAbbreviations f = new returnStateAbbreviations();
f.returnStateAbbreviations(stateName);
//attempt to return from class
public with sharing class returnStateAbbreviations
{
public string returnState(string stateName)
{
String abbr;
String stateAbbr;
if(stateName=='Alabama')
{
stateAbbr = 'AL';
} //
// etc
abbr = stateAbbr;
return abbr;
}
}
how would I then receive abbr back at the trigger?
from the trigger:
//call out to the class
returnStateAbbreviations f = new returnStateAbbreviations();
f.returnStateAbbreviations(stateName);
//attempt to return from class
public with sharing class returnStateAbbreviations
{
public string returnState(string stateName)
{
String abbr;
String stateAbbr;
if(stateName=='Alabama')
{
stateAbbr = 'AL';
} //
// etc
abbr = stateAbbr;
return abbr;
}
}
how would I then receive abbr back at the trigger?
These should be the lines of code to be used.
Trigger -
Class -
Thanks
AR
If you found the reply useful that solved your problem then please mark it as best answer.
All Answers
Yes you can do that.
Please refer below link.
http://www.embracingthecloud.com/2010/07/08/ASimpleTriggerTemplateForSalesforce.aspx
These should be the lines of code to be used.
Trigger -
Class -
Thanks
AR
If you found the reply useful that solved your problem then please mark it as best answer.