0

I have been working on a project to clone an existing user to create a new user. I need to be able to pull all the information from the existing user's record, including permission sets. I have a basic flow created that functions like this:

  1. Screen prompts user to enter the email address of the user to clone
  2. Record Lookup element finds the user record based on matching email address and pulls configurations (role/profile, is Marketing User checked?, etc.)
  3. Another record lookup takes the userid and looks for permission sets
  4. A screen prompts collection of info for new user (Name, email, etc.)
  5. a record lookup gets managerid based on manager's email address entered in step 4
  6. Record Create element to create the new user
  7. Another record create element to add permission sets found in step 3

ScreenshotofFLow

I am extremely inexperienced with flows and I am trying to learn as I go, but I am pretty sure that I am NOT going about this the right way. The flow is working, in terms of finding the user to mirror, and is pulling some info like role/profile and creates a new user, but it is not pulling all of the information needed. The most pressing questions I have now are:

  1. What is the most efficient/proper way to accomplish this?

  2. How do I pull all permissionSetIds assigned to the user being mirrored so that I can assign them to the new user?

  3. How do I configure variables for checkbox fields to carry over? (Marketing User, Service Cloud User, etc.)? I have variables created but I've noticed when testing the boxes aren't being checked on the new records.

  • I'm pretty sure that Flows are not "expressive" enough to adequately perform this task, and even if it were, I strongly suspect it would take you less time to learn Visualforce and Apex Code and hack together a solution that way. Flows are notoriously hard to work with, and even harder to debug. – sfdcfox Apr 4 '18 at 19:01
  • Off of the top of my head, I'd guess this is going to be something like a 14 step Flow, minimum, more if you want to copy feature licenses and other stuff as well. – sfdcfox Apr 4 '18 at 19:05
  • I am trying to learn VF and Apex Code, but I don't think it's going to happen fast enough. I don't mind a 14 step Flow lol. What I'm really asking is how to configure a Loop element to capture multiple record Ids for assignment. – R Hilton Apr 4 '18 at 19:12
1

I am sure this can be done with a flow, and it will be faster to learn a flow than trying to create test classes.

I believe you are trying to Lookup the PermissionSet object when you really need the PermissionSetAssignment object. (because User to Permission Set is a Many-to-Many relationship, it needs a Join object between them)

After lookup the original User, then Fast Lookup the PermissionSetAssignment object with the criteria:

AssigneeId = OriginalUserIDVariable

(Fast Lookup returns a collection rather than a single record. But it's not fast)

Save the PermissionSetId 's in a collection variable, and then Loop through that variable to populate a an sObject Collection variable of sObject PermissionSetAssignment for the newly created User.

  • Hey Brian, I am able to pull the userid and set AssigneeId = varuserId, however, I am not understanding how to pull and save multiple permission sets to assign to the new user. When you say "Save the PermissionSetIds in a collection variable, am I to enter the values of the permission sets in the system? – R Hilton Apr 10 '18 at 15:23
  • I'm so confused with this Loop and sObject collection stuff. I can get it to pull multiple permission set Ids, but I can't figure out to store them all/assign them so that later in the process I can assign those values to a new user record. – R Hilton Apr 10 '18 at 15:31
  • See sample of a loop and collection variable here: help.salesforce.com/… – Brian Oconnell Apr 10 '18 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.