0

We are experimenting with the new process builder using an apex class attached to it. It is fired by simply updating a field. In our case clicking completed on one object, in turns updates another object through the apex code written for it. It works beautifully.

However, it only works within the salesforce system (using all of the standard controllers, and standard pages is the best way I can explain it). However, it will not work if you are using a custom controller for updating records. In our case, our records are taken from the standard set controller, and passed into a custom controller to be displayed to the user. There is a new wrapper made for the new view, records are updated, pulled back out the wrapper, and Update is run. ---

The records update just fine, however the workflow does not trigger? Why? Shouldn't the process builder fire, it was an update to the field I changed.

I know I can fix this with a trigger, and I will, however, I still want to know what gives, and do I need to do something within the custom controller to make it fire?

2 Answers 2

1

Ok, I figured it out. If you are calling this from a custom set list, then you need to make sure you re-initiate your list in the loop. I set it up to be a list for error handling, however, I did not consider that the process builder would pass it a list. Duh, I was wrong, and it is working as it should now.

The code is now:

for (Registration_Request__c rr :RegReq){
            list<Registration__c> completeList = new list<Registration__c>();

before:

list<Registration__c> completeList = new list<Registration__c>();
for (Registration_Request__c rr :RegReq){

It was using the complete list over, not initiating a new process, (like I was thought it was) on each update.

Problem solved.

0

@nic-mcbride if this is actually not an issue anymore it would be good to flag the Idea you created about this as being not an idea and that it should be deleted now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .