Java Script Console error

shivani42
Tera Contributor

 

Hi All,

 

I have created a record producer where i am giving the SAM user to import multiple user allocation facility. I am using script section, adding the script which will create a transform map and load the data> transform the data to target table. But when i click on submit button, it is giving me  "There is a JavaScript error in your browser console" error. I am not able to understand why i am getting this error even there is no client script attaches to my record producer.

 

Script- 

var transformsysid = 'XXXXXXXXXXXX';
current.name = gs.getUserName() + " Import in User Allocation";
current.import_set_table_name = 'u_user_allocation_import';
current.file_retrieval_method = 'Attachment';
current.type = 'File';
current.format = 'Excel';
current.header_row = 1;
current.sheet_number = 1;
current.insert();

var loader = new GlideImportSetLoader();
var importsetrec = loader.getImportSetGr(current);
var ranload = loader.loadImportSetTable(importsetrec, current);
importsetrec.state = "loaded";
importsetrec.update();
//var setsysid = importsetrec.sys_id;
gs.addInfoMessage(importsetrec.sys_id);


var Transformworker = new GlideImportSetTransformerWorker(importsetrec.sys_id, transformsysid);
Transformworker.setBackground(true);
Transformworker.start();

current.setAbortAction(true);
 
Screnn Shot-
shivani42_0-1740654770551.png

 

Anyone has any idea?

Thanks,

Shivani

 
7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@shivani42 

why are you using record producer for this? You are not creating any target record so it doesn't look like a good user experience

Why not use catalog item and then use workflow run script

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,

I am using record producer because with catalog item we need a specific table to define where our request item gets inserted. probably, incident or change request. We don't need to monitor a request. We need just simple solution, don't want to process with request item. I have one more question if you can help me on that, would be very helpful for me. Everything is working as expected but whenever I am trying to import the allocations for Microsoft it is importing the data, but the entitlement filed is getting inserted as empty even the data for the filed is available in source table. It is working fine with another vendor like TechSmith.

shivani42_0-1740742134155.png

It is saying the warning message "Insert of reference field value for licensed_by - SOFEXXXXX - Microsoft Planner and Pro failed. Probably cancelled by a business rule on alm_entitlement". I have disabled all the BR to test it. but it still remains same, and entitlement filed is getting inserted as empty. I feel this is not related the BR.

One more thing, when I tried load data function and tried to transform the same MS allocation. It worked.

 

Regards,

Shivani

@shivani42 

when you load the data in transform map there is a checkbox of Run business rule.

Please uncheck that and see again.

The error clearly says it's cancelled by business rule on alm_entitlement table

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

shivani42
Tera Contributor

Hi Ankur,

I tried that also, but did not work.

Regards,

Shivani