1

Dear reader of this question,

I have a problem using flows in conjunction with flows so that the admin can tweek the flow withouth have any apex programming skills.

I have an account before update trigger containing just this bit of code:

list<Account> accounts = newObjects;
for (Account acc: accounts) {
    Map<String, Object> params = new Map<String, Object>();
    params.put('Acc', acc);
    Flow.Interview.Account_update accFlow = new Flow.Interview.Account_update(params);
    accFlow.start();
    acc = (account) accFlow.getVariableValue('Acc');
    system.debug('account: ' + acc.Description);
}

My flow has a Sobject variable called "Acc" that is ofcourse an account.

My flow only has one assignment block that does the following: Flow assignment block

Now here is the problem: the code executes without having any errors but doesn't update the account value!

the result from my system.debug statement is "Account: het werkt", this leads me to conclude the assignment is done properly and since this is a before update trigger no furter action would be required...

Does anyone have any experience with doing something like this and if so, what am I doing wron or isn't possible?

7
  • Are you sure that account is updated later in your flow? Also for such purpose I often use custom settings so that admin/whoever can customize the setting and then you can grab it in your code and do what you need. As far as I remember flows are hard to debug... Commented Sep 22, 2016 at 16:24
  • is newObjects the same as Trigger.new? I'd be looking for a binding issue between the variable acc that points at an object returned by getVariableValue that is no longer the object in Trigger.new and hence why nothing is updated when the trigger completes
    – cropredy
    Commented Sep 23, 2016 at 5:06
  • @Oles: The flow consist only of the component shown in the picture, you can't do an update in this flow because of the before update context.
    – Henk3000
    Commented Sep 26, 2016 at 12:39
  • @cropredey: Yes it is the same, I was looking for this as well but since the system.debug(acc) has the right information in it (all of the old + the new info) I assumed this was fine
    – Henk3000
    Commented Sep 26, 2016 at 12:40
  • @Henk3000 Can you please post the full trigger code here. Commented Sep 26, 2016 at 13:25

0

You must log in to answer this question.

Browse other questions tagged .