Hi How can I automatically extract all the variables from a catalo item on an excel document?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 02:44 AM
Hi Guys,
I have a requirement to extract all the variables from a catlog item on an excel document and then transfer it to a 3rd party tool. I am writing workflow for the catalog item and I want to build this functionality within workflow. What should be my approach for it?
i thought of following solution: (i am not sure if solution is feasible or not)
1. I'll build a report on request variables and then that report can be used for excel extract. But catalog variables are saved on a separate table sc_item_option_mtom. If i run a custom report on it, it shows sysId for the reference type of variable. How can I get display values on report?
2. I'll write a script in workflow to map variables to a custom table and then use that data for excel data transfer.
Please let me know the correct approach to build this functionality.
Thanks,
Ashwani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 04:04 AM
Hi Ashwani,
I guess you mean that the reference values come up as sys_ids?
If that's the case, I suggest adding a string field on the sc_item_option_mtom table the populate the value, depending on the missing value.
For instance, if the ref value is a username, run a br to search and populate the string field.
You can add the field you created the report (variabe ownership table).
Example UI action which can be converted to a br:
pop();
function pop(){
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id', current.sc_item_option.value);
usr.query();
while(usr.next()){
current.u_refval = usr.name;//u_refval is the string field I created to populate the ref value
current.update(); //get rid of this on a before br
}
}
action.setRedirectURL(current);
I added the field directly onto the Variable Ownership table, although I guess you can do it on another custom table.
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2017 05:30 AM
Hi Ashwani,
To get the values for the request variables, you can create a report on task table and choose "Question", in that you can choose the required catalog item and the variables to be displayed in the list.
This will give you the vales for reference fields too.
Try this approach for your issue.
Thanks,
Priyadarshini
PS: Hit like, Helpful or Correct depending on the impact of the response