Skip to main content

Hi,


I have created a table which uses a custom object to which is attached an approval process. I’ve got a button that submits the approval. All that works fine. Users are able to approve by email and the table updates perfectly.


However, users would like to also be able to approve directly from the table. I’ve tried adding buttons to approve or reject (with the proper action through Salesforce) but no matter what I do it won’t work. I’ve created a drawer with two tables that contain information (through models) on the ProcessInstance and on the ProcessInstanceWorkItem, as I cannot do that through the original table. I have the ProcessInstance model linking to the row record id of the first table. And I have the ProcessInstanceWorkItem linking to the ProcessInstance id.

I was hoping this would work but the approve/reject buttons remain passive. Am I trying the impossible? Has anyone been able to do this before?


Many thanks in advance!!!

off the top of my head, you might now have all the fields required to accomplish your action loaded into the model of the table. For example, if you need a record Id to make it happen, that field might be in the model on your detail page, but not in the model on your table.


I have added the field to the table just to make it clear it should pick up but the fields don’t come populate and the button is still mute. Do you know anything else I might be missing?


**update: it worked once 🥳 but it won’t pick up the second approval (i.e. the second row)


So if it works for the first row but no other rows that means that it isn’t recognizing the context so it is just acting on the first row of the model.

You could try to fix it so it recognizes the row that you are on (not sure if this will work), or you can create another model on the same object as your table called “selected row”. Then as part of your action sequence, you would activate at set the value of a condition on that model that sets the record ID to the record ID of the record in the row you are working on. Then you would query that model as part of the action sequence. That would give you a model with only one row in it which is for the record that you want to work on. Then you can do your operations on that model and since there is only one row it “should” work.


Best solution, not mine, was to create a pop up that contains a page. This page references 4 models (ProcessInstance, ProcessInstanceWorkItems, ProcessInstanceSteps and the original table model). It is then a case of trickling the Ids through.


Sorry to be late to the party. Approvals are tricky - in that they require the buttons to be targeting the correct record for the approvals to work.


You should check out the sample page we built that shows an approval process. I think it will help.


Reply