How to iterate over all objects to take an action in a business process ?
Hi,
I would like to be able to iterate over all contacts (filtered of course) and generate a new GUID for a new custom column (I don't want to re-use the internal Id field externally thus created a second field)
A naive first try is to simply use a 'Modify data' actions, specify the filter and set the Formula of the column I like to modify to "Guid.newGuid()". When running the process all filtered Contacts get the same new GUID filled into the column in stead of a unique GUID per contact.
How can I make sure that each Contact get a unique value ?
Thank you,
Ron
Like
Thank you for this reply Oliver. It does give inspiration on how to solve this.
It does seem an overly complex means to do something to all objects individually :(
I can live with it, but if anyone can think of another solution that would still be welcome.
Best regards,
Ron Geens
Dear Ron,
Indeed, if you modify the data the formula will generate new Guid and will simply insert this Guid into all contacts according to filter.
The best option will be generating new Guid for each Contact individually per Business-process iteration. You can either make a timer for starting a business-process, reading one contact (that has no guid yet) and making new guid for it. Although, business-process will be executed with errors once all contacts will get guids.
You can also create a trigger (starting signal) for modify data/add data with filter "YourFieldwithGuid is not filled in" and again simply read contact and generate the guid. In this case the business-process will be launched only if needed and will not be falling with errors.
You can simply combine these options and make it work. Simply set up the business-process to generate guid for each existing Contact and then adjust the business-process to generate for each new contact or contact having no guid in your field.
With best regards,
Oliver Wingston
Thank you for this reply Oliver. It does give inspiration on how to solve this.
It does seem an overly complex means to do something to all objects individually :(
I can live with it, but if anyone can think of another solution that would still be welcome.
Best regards,
Ron Geens
Dear Ronald,
I can suggest the alternative. You may use the custom query similar to the following to add 1 to every following record GuId:
declare @num int = 0; update TableName set ColumnName = @num, @num=@num+1
Lisa
Lisa Brown,
Thank you Lisa, but I am only a user of the BPM processflows, not a programmer.
No idea where your code would have to be put.