Export Specific User Records in XML Format

jmiskey
Kilo Sage

Occasionally, we have need to copy certain User Records from our Production system to our Test system.  This usually happens when testing teams need to run some tests on users who have been added to Production after the last time we ran a clone down to the Test system (i.e. onboarding testing, etc).

 

I created a Catalog Item, where they can select the users they need to copy down to the Test system.  What I would really like to do is have my Flow export the necessary XML records from the User table for the selected users.  Then all I would have to do is import that created XML file into our Test system to complete the request.  I am just not sure how to do that (export specified records from User table in XML format).

 

Can anyone provide details on how I would do that in a Flow (or older Workflow, if necessary)?

 

Thanks

4 REPLIES 4

Slava Savitsky
Giga Sage

With an XML import set or a scripted REST API, you should be able to automate your use case even further.

 

By the way, one XML file may not be enough. You would probably need to export/import group membership and role assignment information from [sys_user_grmember] and [sys_user_has_role] as well.

Sorry if I wasn't clear.  What I actually need to know is how to export the User records to an XML file from the Flow/Workflow.  I assume it may be a Run Script command.  But what exactly would that code look like?

Satishkumar B
Giga Sage
Giga Sage

Hi @jmiskey 

Create a Catalog Item
- Create a catalog item for selecting users to copy.

Create a Flow in Flow Designer
- Create a new Flow.
- Set the trigger for the catalog item submission.

Add Actions to the Flow
- Get Records:
- Use 'Get Records' action to retrieve user records from `sys_user` table.
- Run Script:
- Add a 'Run Script' action to generate XML for selected records.
- Create Attachment (Optional):
- Attach the XML to the catalog task.

Test the Flow
- Submit a request using the catalog item.
- Verify XML is generated and attached correctly.

Import into Test System
- Download the generated XML file.
- Navigate to System Import Sets > Load Data in the Test system.
- Upload the XML and import the data.

……………………………………………………………………………………………………

Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand. 



OK, it appears that I wasn't really clear on what part I needed help with.  I already know how to do 90-95% of what you posted (I have been created Catalog Item/Record Producers with Workflows/Flows for 8 years).  What I need help with is the part in yellow:

jmiskey_0-1721649069009.png

Generalities aren't that helpful.  What exactly would that code look like?  I have written lots of code over the years, but never code to create the XML data you would typically get from manually exporting records from a table like the user table.

 

Thanks