The first thing to do is get the IDs in a return delimited list. You can either build it that way, instead of the comma or Use substitute ( ID_List ; "," ; ¶ )
You will need 2 variables
$CT = # of IDs
$CTR = counter
Then from here you can access them using GetValue ( ID_List ; x )
SO a loop would be something like this...
Set Variable ( $CT ; PatternCount ( ID_List ; ¶ ) + 1 ] (add the +1 if there is no trailing return)
Set Variable ( $CTR ; 1 )
create records script
set field [ ParentID ; GetValue ( ID_List ; $CTR ) ]
Exit Loop If [ $CTR >= $CT ]
Set Variable ( $CTR ; $CTR + 1 )
I agree with John's answer. FWIW, I like to construct loops slightly differently, with the exit conditions at the top (and I like using $i as a counter):
Set Variable[ $i; 0 ]
Set Variable[ $i ; $i + 1 ]
Exit Loop If[ $i > $CT ]
if you put the Exit below the $i increment make sure it's > not >=
One problem is your statement:
Set Variable[ $count; Value: $count = $count+1]
This should be written as:
Set Variable[ $count; Value: $count+1]
Let's say $count = 1.
As written, your statement says, what is the result of 1=2
Set $count to that.
The result of asserting that 1 = 2 is false.
1 does NOT = 2.
So $count is now 0.
Thanks I have that loop working now, however I tested with just 2 user ids, and it inserted only one record with this in the userid:62;58
That's because you didn't add +1 to the patterncount
Set Variable [ $EmailIds ; PatterCount ( $EmailIdPar ; ¶ ) + 1
Just changed it, but still the same result
can you repost the new script?
the only thing I can think of is the Exit Loop If  is not evaluating correctly
try putting GetAsNumber () around $Count and $EmailIds
I am guessing you don't have advanced to run this with the script debugger?
In lieu of that you could add a custom dialog just above the Exit Loop...and display both variables to make sure that are correct.
The two user Ids I am using are 62 and 56
It only ran the custom dialog just before the exit loop if
My custom dialog shows $$EmailId;$$EmailIdPar;$EmailIds;$Count
each are separated with the & symbol and the ; just to show the differences
I debugged it more looks like it is putting 62;56 for $$EmailId, then 62;56 for the EmailIdPar, then 1 for the EmailIds, then 2 for the Count
I think the changing semicolon to paragraph symbol failed
Then the substitute has to reference the semi colon instead of the comma