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
ArpiArpi 

Salesforce to Salesforce creating read only access

Hello,

 

I have 2 queries regarding the salesforce to salesforce inbuilt functionality.

1) So i followed the steps to publish and subscribe fields of object.On the target org the record can be updated by the target user. My requirement is I just want to share specific records but do not want the other org to update any of my records. I am assuming there should be some setting we can do on our profiles but when I read more I found you cannot see the profile of this Connection User.

So is theer a way to set records to read only for Connection uSer only?

 

2)Record level sharing is manual and automatic but I couldnt find a way to autoate the process for specific records. Is there a way to automate shring of specific records and on target automate with some logic to accept it( not auto check as it accepts everything)?

 

Thanks 

 

Best Answer chosen by Admin (Salesforce Developers) 
souvik9086souvik9086

See,

 

A record in the organisation in which it is published(SOURCE).

A record in the organisation in which it is subscribed(TARGET).

 

If the record is changed in the source then it will be automatically updated in the target.

But the viceversa will not happen i.e

If the record is changed in the target, then the shared record will never reflect in the source.

 

 If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

All Answers

souvik9086souvik9086

When you share data using S2S, it is bound to automatic update on the target if there is a change in the source. You can't stop that.

 

If you want that to restrict, you can use some Data Migration Tool for that.

E.g DataLoader

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

ArpiArpi
Hi Souvik,

I am Ok with source updating the target but not the target updating the shared record as I assume its the same record shared between source and target. Is there any way for target to not change it.
I have used data loader but we wanted live feed of records shared to target and also it would be shared with muiltiple orgs too.
Thanks again.
souvik9086souvik9086

See,

 

A record in the organisation in which it is published(SOURCE).

A record in the organisation in which it is subscribed(TARGET).

 

If the record is changed in the source then it will be automatically updated in the target.

But the viceversa will not happen i.e

If the record is changed in the target, then the shared record will never reflect in the source.

 

 If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

 

This was selected as the best answer
ArpiArpi
Hi Souvik,

I had one more question , is there a way to detect the changes made by target org so the source can decide and see if target has changed any field data etc.

Thanks again
souvik9086souvik9086

You can check that through the LastModifiedDate field.

You can query in Developer Console that if the LastModifiedDate > ThatDate in which you shared the data(May be the createddate).

 

If the post helps you please throw KUDOS.

Thanks

ArpiArpi
Thanks for the reply can you clarify little bit more as the modified time in both org for the same record is different now as I changed the record in target org. How can I access the target record which is now different from source record data in my source org. How do I refer it in code?

thanks again
souvik9086souvik9086

LastModifieddate field must be different in both the orgs as it is Audit field and old org value cannot come to the new org.

LastModifiedDate and CreatedDate will take the current time of the insertion of the record.

 

In your case when you inserted the data in target org then that time is entered in CreatedDate and LastModifiedDate.

After that every time you modify the data LastModifiedDate is updated woth the modified time but the CreatedDate remains same as it is.

 

So to check whether a record is changed after it is shared you can check in SOQL query

SELECT ID, Name FROM Account WHERE LastModifiedDate > CreatedDate

 

Hope this will help.

 

If the post helps you,please throw KUDOS.

Thanks.

ArpiArpi
Awesome. Thanks for the explanation.
souvik9086souvik9086

Always Welcome :) . And if you find the post is helpful then please throw KUDOS by clicking the star icon so that other developers can be benifitted for finding out their answers.

 

Thanks

ArpiArpi
Thanks I was trying to find out how to give Kudos so now I have given to both yr posts so that other developers may also benefit from it.