- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 01:49 AM
Hi,
When i am tring to create a catalog task through workflow getting an error
Create a Task: org.mozilla.javascript.Wrapped ConversionError:The undefined value has no properties
Any solutiion for this
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2020 02:50 AM
Did you check the property name is proper?
I could see spaces in between
Is it group _ name or group_name
Also does it contain group sys_id or group name
If sys_id then this is fine
task.assignment_group = gs.getProperty('group_name');
If group name then this should work
task.assignment_group.setDisplayValue(gs.getProperty('group_name'));
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 05:37 AM
Hi Ankur,
I have to generate CSV file (semi colon seperated ) on a RITM with all the variables. For this I have used the script which you have posted in community. Earlier it worked as expected. Now I am getting same error message which you people are discussed aforementioned. All the implementation is done under scoped app. Can you please go through this and please let me know, what went wrong.
Any help would be appreciated.
Thanks in Advance !!!
Script :
var csvHeader = [];
var valuesArray = [];
var gr = new GlideRecord('item_option_new');
gr.addEncodedQuery('cat_item=' + current.cat_item);
gr.query();
while(gr.next()){
var label = gr.question_text;
var value = current.variables[gr.name]
csvHeader.push(label.toString());
valuesArray.push(value.toString());
}
var csvHeaderRow = csvHeader.toString();
var valueRow = valuesArray.join(';');
var sa = new GlideSysAttachment();
var document = csvHeaderRow + "\n" + valueRow;
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.get(current.sys_id);
sa.write(ritmRec, "catalog_variables.csv", "text/csv", document);
Error I am getting :
Wrapped conversationError: The undefined value has no properties. (<refname>; line17)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 05:50 AM
Hi,
seems to be issue for the write function
did you print what came in the content i.e. variable document?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 06:21 AM
Hi Ankur,
Sorry, I missed one point, I have added time stamp to my filename. I have used this in Run script activity of Workflow.
Attching here again the complete script :
var gr = new GlideRecord('item_option_new');
gr.addEncodedQuery('cat_item=' + current.cat_item);
gr.query();
while(gr.next()){
var label = gr.question_text;
var value = current.variables[gr.name]
csvHeader.push(label.toString());
valuesArray.push(value.toString());
}
var csvHeaderRow = csvHeader.toString();
var valueRow = valuesArray.toString();
var sa = new GlideSysAttachment();
var document = csvHeaderRow + "\n" + valueRow;
var ritmRec = new GlideRecord('sc_req_item');
ritmRec.get(ritmSysId);
var filename = 'catalog_variables'+new GlideDateTime().getDisplayValue()+".csv";
sa.write(ritmRec, filename , "text/csv", document);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 06:26 AM
Glad to know.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2021 06:46 AM