You need to sign in to do that
Don't have an account?
SFDC n12
Approval comments from approval process to a custom field
Hi,
I am having a approval process which is having 4 stages of approver
i want to capture the comments enterd by the 3 level of approver alone (not any other apperover) in a custom field
I have written the following controller, but its not updating my field ADR COMMENTS__C with the comments
public class ApprProcess {
public static void ProcessInst(AccountExceptions__c [] o1) {
for(AccountExceptions__c o2:o1) {
ProcessInstance [] op = [SELECT Id, (SELECT Id, StepStatus, Comments FROM StepsAndWorkitems)
FROM ProcessInstance];
for (ProcessInstance op1 : op) {
for (ProcessInstanceStep pis : op1.Steps) {
if(op1.Status == 'Approved') {
o2.ADR_Comments__c = pis.Comments;
}
}
}
}
}
}
Help me how to achieve it
Thanks in Advance
I am having a approval process which is having 4 stages of approver
i want to capture the comments enterd by the 3 level of approver alone (not any other apperover) in a custom field
I have written the following controller, but its not updating my field ADR COMMENTS__C with the comments
public class ApprProcess {
public static void ProcessInst(AccountExceptions__c [] o1) {
for(AccountExceptions__c o2:o1) {
ProcessInstance [] op = [SELECT Id, (SELECT Id, StepStatus, Comments FROM StepsAndWorkitems)
FROM ProcessInstance];
for (ProcessInstance op1 : op) {
for (ProcessInstanceStep pis : op1.Steps) {
if(op1.Status == 'Approved') {
o2.ADR_Comments__c = pis.Comments;
}
}
}
}
}
}
Help me how to achieve it
Thanks in Advance
SELECT Id, (SELECT Id, StepStatus, Comments FROM Steps) FROM ProcessInstance
in your code here:
for(AccountExceptions__c o2:o1) {
ProcessInstance [] op = [SELECT Id, (SELECT Id, StepStatus, Comments FROM StepsAndWorkitems)
FROM ProcessInstance];
SELECT Id, (SELECT Id, StepStatus, Comments FROM Steps) FROM ProcessInstance in my controller
for(AccountExceptions__c o2:o1) {
ProcessInstance [] op = [SELECT Id, (SELECT Id, StepStatus, Comments FROM Steps)
FROM ProcessInstance];
as I think the value of comments field might not be coming thru.
i am just using the controller , i need to call the controller in a trigger to update t he value right ?
just the controller without used in a trigger wont update the field isint ?
ApprProcess process = new ApprProcess();
process.ProcessInst();
but i am getting this error
Error: Compile Error: Method does not exist or incorrect signature: [ApprProcess].ProcessInst() at line 88 column 7
do i need to pass any parameters in
process.ProcessInst();
if so what parameters should i call
public static void ProcessInst(AccountExceptions__c [] o1)
You should be passing an array of AccountExceptions__c records which you have in the apporval process.