- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 08:44 PM
Hello Experts,
I have created a transform map which is linked to the import set table, in the run as script section I have written code to populate some fields at the time of ticket creation except company, script is taking every other field value,
Since I am working in MSP env, the script is automatically taking random field value for the company field which is a dot walked field from the user table, Could anyone suggest to me how should I fix that up?
Table Transform map: Data upload for tickets
Target table: Incident[incident]
run script : yes
script:
var cafe = new GlideRecord('u_store');
cafe.addQuery('u_store_number', source.u_store_name);
cafe.addQuery('sys_domain', '');
cafe.query();
if (cafe.next()) {
var sys_id = cafe.sys_id;
var gr=new GlideRecord('sys_user');
gr.addQuery('active',true);
gr.addQuery('sys_domain','');
gr.addQuery('company','');
gr.query();
if(gr.next())
{
target.company = '';
target.sys_domain = '';
target.u_store = sys_id;
target.short_description = "Testing Tickets";
target.category = "";
target.u_type = "";
target.u_item = "";
target.assignment_group = "";
target.contact_type = "email";
}
}
Any kind of help here is much much appreciated!
Thanks & Regards,
Ujjwala
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 09:36 PM
Hi, can you clarify your issue, you are trying to prevent company from being populated? or it is being populated but by wrong value?
You indicate that you are running your script in the 'Run script section of the transform map?
To populate data into your target table I would move the script to a beforeTransfrom() script, so that it runs once for each row in your import, if that doesn't fix your issue then I would recommend adding some logging to confirm\validate your script functionality and the values set by the transform.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 08:59 PM
Hello
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 09:29 PM
Hi
I have tried like that, still not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 09:43 PM
if not after can you try onBefore script?
can you share the script also once here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 09:36 PM
Hi, can you clarify your issue, you are trying to prevent company from being populated? or it is being populated but by wrong value?
You indicate that you are running your script in the 'Run script section of the transform map?
To populate data into your target table I would move the script to a beforeTransfrom() script, so that it runs once for each row in your import, if that doesn't fix your issue then I would recommend adding some logging to confirm\validate your script functionality and the values set by the transform.