Below is a piece of code I am trying to run.
global class TriggerClass {
@future (callout=true)
public static void ifMethod(String sessionId, String ifcondition) {
ToolingAPI.SforceService x = new ToolingAPI.SforceService();
x.SessionHeader = new ToolingAPI.SessionHeader_element();
x.SessionHeader.sessionId = UserInfo.getSessionId();
x.SessionHeader.sessionId = sessionId;
System.debug('inside myMethod...');
Integer a;
x.executeAnonymous(ifcondition+'{a=4;}');
System.debug('Result of if-------------' +ifcondition);
System.debug('Result of a-----------------'+a);
System.debug('exiting myMethod...');
}
}
Inside the x.executeAnonymous
statement, I want to write code which executes when the if condition evaluates to true and also I want a else condition.My ifcondition
contains a string something like "if(22>21 && 8000<9000)".