Getting Wrapped Conversion Error:The undefined value has no properties error when trying to create a catalog task through workflow

Gowtham Kodali
Tera Contributor

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

1 ACCEPTED SOLUTION

@Gowtham Kodali 

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

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)

 

Hi,

seems to be issue for the write function

did you print what came in the content i.e. variable document?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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);

 

 

Glad to know.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I have printed. Record got inserted in sys_attachment table. I am not getting what exactly the issue is. Please suggest me any resolution for it.

Thanks!!

Attaching here test results in Background script :

find_real_file.png