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
greentruck55greentruck55 

how to prevent recursion

I am interested in using streaming to replace my trigger/future or outbound messaging integration with another system.

 

but the soql says select x,y,z from object where flag=true

 

the remote system will update object whenever there are returning changes.. this will cause the soql to fire I think,

and then the streaming client will be notified of changes.   but I don't want THESE changes sent back to the remote,

as the remote is the one that made them.  .

 

in my trigger I compare a flag set ONLY on the remote update to cancel the trigger.

 

in my outbound message I use workflow rules to check the same flag set only by the remote system.

 

how do I prevent this loop with the streaming api? or does the callback get fired and I have t check the flag in the

client system, and hope that the notification time interval doesn't mask a SF UI sourced change.(as compared to the incoming web service api sourced change)

 

Thx

sdetweilsdetweil

maybe its the same approach

 

select id, field1, field2 from object__c where remote_update__c ==false

 

remote_update__c is only true from the remote system posting updates.

 

still requires a trigger to clear the flag on UI generated changes.

 

blacknredblacknred

I guess your integration runs on a user of it own, so something like this might work:

 

select x, y, z from object where LastModifiedById <> '005XXXXXX'

 

being 005XXXXXX the integration user's id.