Add a column and get data

Singh3
Tera Contributor

Hey guys,
I need help with a certain requirement.

The requirement is as follows:
1. I have to create a catalog item with an attachment variable where the user can upload a CSV file (containing user records)

2. After uploading the file, I need to process it somehow to add another column (user manager) and get the details of the manager in that added column for every user record.

3. Get the new file and send it to a certain group.

I am out of ideas how to process it. 
Can anybody help?

Thanks in advance.

1 REPLY 1

Community Alums
Not applicable

Hi @Singh3 ,

 

There is no direct way to create a CSV file, but I can see an alternate.

 

Create a data source.

Create a staging table.

Create a target table. Create all the fields as per the CSV file column. Create extra field for User Manager.

Create a transform map and do the field mapping.

 

  1. When you Order Now in catalog item, in the workflow write a script to copy the attachment to data source using GlideSysAttachment class.
  2. Once the attachment is copied, in the workflow, using the script, load all the data from CSV file which will add data to Staging table.
  3. In the same workflow, using the script transform the data to target table and via transform script you can add the User Manager data.
  4. Once these steps are completed you will have proper data in the target table including User Manager.
  5. Now you can copy the script from Export CSV UI Action (List Context Menu) and make changes to the script and add the script in workflow.

 

Please mark the answer as correct and helpful, if I was able to answer your query. It will be helpful for others who are looking for similar questions.

 

Thank you,

Santosh Poudel