function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SilkcutzSilkcutz 

How do you assign a new value and update with sObject Collections/Variables

We are using the "Launch Flows from Workflow Rules” pilot program. We grab a collection through FastLook Up which includes just 1 boolean field which we want to change from False to True.
 
How do you assign a new value to that field, to then run a FastUpdate. 

This really confuses me. You seem to only be able to assign a collection to a collection. But how do you set the value! 
Ashish_SFDCAshish_SFDC
Hi , 


See the sample for set method for Lists, 

set Integer i
Any type e
Void Assigns e to the position at list index i. For example:
List<Integer> myList = new Integer[6];
myList.set(0, 47);
myList.set(1, 52);
system.assertEquals(myList.get(1), 52);
To set an element of a one-dimensional list of primitives or sObjects, you can also follow the name of the list with the element's index position in square brackets. For example:
List<String> colors = new String[3];
colors[0] = 'Red';
colors[1] = 'Blue';
colors[2] = 'Green';

See more information in the doc below, 

http://www.salesforce.com/us/developer/docs/dbcom_apex250/Content/apex_methods_system_list.htm

Similarly there are methods for other collection variables. 


Regards,
Ashish
SilkcutzSilkcutz
Thanks Ashish
However, I can't believe the answer is to develop code. One of the strongest featues of Visual Workflow is click over code. We have built some very powerful functionality in Visual Workflow without code so am surprised it would require it for this new feature.I thought it would be as simple as get list (fast lookup) then cycle through each item in the list (loop) and assign a change (assignment) to update (fast update). Its the assigning of change i am struggling with.