Coping an attachment from RITM to Data source
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-28-2018 06:05 AM
Hi Folks ,
I have a requirement like ----> When a user uploads attachment from catalog form with asset details . I have fetch the data and add the information to asset table . I followed below steps
1. Create a data source for that attachment --> Created a data source
2. Load data using related link --> 1st time i loaded data manually
3. Create Transform map and field mappings. --> Done with transform map and field mappings
4. Create a scheduled import of type 'On Demand' --> Created one scheduled import for the data source which we created earlier in step 1 . But the attachment which was uploaded by user via catalog form is not attaching to data source . Below is the BR which I wrote to copy the attachment automatically to data source by using scheduled import .
Table : sys_attachment
When to run : After insert
Script :
(function executeRule(current, previous /*null when async*/) {
gs.info("===== BR running =====");
var rec = new GlideRecord('scheduled_import_set');
rec.get('name', 'Scheduled Data Import for this data source');
SncTriggerSynchronizer.executeNow(rec);
})(current, previous);
Please let me know where exactly I am mistaken , Thanks in advance .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-28-2018 06:56 AM
Hi Kiran,
I wrote same logic on RITM table but its not working , I can clearly see the file is falling in RITM table , but I am not able to understand why this attachment is coping to data source . Below is the code that my BR has
Table : RITM
When : After Insert
Script :
(function executeRule(current, previous /*null when async*/) {
var dataSourceSysId = 'c52aee08db03130094649b81ca961974';
var schImp_GR = new GlideRecord('scheduled_import_set');
schImp_GR.addQuery('data_source',dataSourceSysId);
schImp_GR.query();
if(schImp_GR.next()){
gs.executeNow(schImp_GR);
// use this if it is in scoped app
//SncTriggerSynchronizer.executeNow(schImp_GR);
// if in non-scope app i.e. global// the above 2 lines will start the import process, etc automatically
}
})(current, previous);
Can you please suggest me with correct process , If I am doing wrong.
Thanks for knowledge sharing,
Dinesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-28-2018 09:38 PM
Hi Kiran ,
Any suggestions ?
Regards,
Kumar