Data Feed XML To Get List Of All Users In A Record Permissions Field That Only Has A Group Selected
I have a data feed that copies the content from a Record Permissions field in application A to a Record Permissions field in application B. The Record Permissions field in application A has a list of groups that can be selected, and only one group can be selected (note - users are not selected in the Record Permissions field, only a group).
Currently I am using the following XML and this works fine.
<xsl:for-each select="Field[@guid = 'b5288bea-e215-4bfc-b428-c477db2cea3f']/Groups/Group">
In addition to copying the group selected in the Record Permissions field from application A, I would also like to copy the users that are in the group, to be placed in a different Record Permissions or Users Groups field in application B.
So let's say in Group A there is is one user (User1). In the Record Permissions field Group A was selected. Using XML, I would like in the Data Feed to get User1 from Group A to write to a Record Permissions field or Users Group field in application B. Is this possible?
If this can't be done, is there a way using a custom object to get User1 from the Record Permissions field that contains the group and to populate User1 in another Record Permissions field or Users Group field?
I could think of two approaches.
Consider the following as segments in code.
- Input 1 - get session id of the data feed user.
- get metadata of the records in Application A using content API,
- for each record in Application A,
- Input 2 - get users for the selected group in the particular RPF field(Field A) using RESTful API
- finally, for each related record, i.e Application B - prepare a JSON object with Inputs 1,2 and tracking ID of App B - use Content API to update the User/Group or RPF Field in App B.
The second approach could be using a custom object in Application A and build a custom logic behind Save/Save and close button with segments 1,4 and 5 listed above.
Both approaches has their own pros and cons.
for e.g - With data feed approach, it runs on scheduled basis,complex coding and with Custom object End user,also with data feed approach, needs read access to Access Control Users and Groups pages.
May be there could be a better approach too.