To copy the view to a new user you will need the ID for the user you wish to copy the view to. This can be obtained through the Folio app as well by querying for all periscope user records with:
readAll(periscope and user) |
The user you are copying to must have logged in first to exist in the Folio database |
Now, with the new user ID: invoke the following command (where id_of_user is the fully qualified ID of the other user you are copying to - like @p:demo:r:otherUser
- and the with the id of the view you're trying to copy):
copyViewInstanceToUser(readById(@id_of_viewInstance), readById(@id_of_user)) |
Understanding how the AXON view copying works isn't required, but for the curious - here is a breakdown of it step by step:
readAll(id==viewInstance->id or viewInstanceRef==viewInstance->id) // 1 .swizzleRefs // 2 .removeCol("mod") // 3 .map(r => // 4 if (r.has("userRef")) // 5 r.merge({userRef: otherUser->id}) else r ) .each(r => diff(null, r, { add }).commit) // 6 |
@p:project:r:user
in the wild. In our case, the only record with a userRef is our viewInstance.