You need to sign in to do that
Don't have an account?
Scott M - SFDC Fan
How to properly invoke an apex class through visual flow
Hi,
I am almost there. Despite SF visualflow's shortcomings with working with DateTime fields, I have a visual flow almost there where it sets up two dateTime fields called startDateTime and endDateTime. My problem is with calculating and saving a time, which works properly with the dataTime fields, because they always recalculate to GMT.
What I am trying to accomplish is an Apex class, which recalls the user's timezone offset for two different times.
Here is the code.
The issue is, how can I get the offsets back into the flow.
Scott
I am almost there. Despite SF visualflow's shortcomings with working with DateTime fields, I have a visual flow almost there where it sets up two dateTime fields called startDateTime and endDateTime. My problem is with calculating and saving a time, which works properly with the dataTime fields, because they always recalculate to GMT.
What I am trying to accomplish is an Apex class, which recalls the user's timezone offset for two different times.
Here is the code.
public class UserTimezoneOffsets { public class inputVariables { @InvocableVariable(required=true) public DateTime startDateTime; @InvocableVariable(required=true) public DateTime endDateTime; } @InvocableMethod( label='Get user timezone offset' description='Returns the users timezone offset in minutes for the given dates.') public static List<Integer> getOffsets (List<inputVariables> dateTimes ) { TimeZone tz = UserInfo.getTimeZone(); List<Integer> offsets = new List<Integer>(); for (inputVariables dateTimeX : dateTimes) { offsets.add(tz.getOffset( dateTimeX.startDateTime )); offsets.add(tz.getOffset( dateTimeX.endDateTime )); } return offsets; } }
The issue is, how can I get the offsets back into the flow.
Scott