- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-14-2020 10:15 AM
How we can load , data on UI action .
Data source, Transform map created to transfrom,
On form - UI action is added.
Issue- 1.How to check attachment added on click of UI action ?
2. How to load data on Click to target table
Solved! Go to Solution.
- Labels:
-
Task Communications Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-15-2020 03:01 AM
Refer my blog
Something similar to that you can use and enhance it as per your need
Data load and transform via Catalog Item
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
ā10-15-2020 03:01 AM
Refer my blog
Something similar to that you can use and enhance it as per your need
Data load and transform via Catalog Item
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
ā10-15-2020 03:12 AM
Thanks its helpful.
But in my case , its custom table form -- I am adding attachment on it.
How do I attach the workflow - on which condition ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-15-2020 03:15 AM
Hi,
Since that is your custom table and attachment you can use that same script in the UI action itself
your UI action code would look something like this
GlideSysAttachment.copy(current.getTableName(), current.sys_id, 'sys_data_source', '<dataSourceSysId>');
var exportGr = new GlideRecord("scheduled_import_set");
exportGr.addQuery("sys_id", "<RecordSysId>"); // sys_id of the record which you will be creating for scheduled import in step (a)
exportGr.query();
if (exportGr.next()) {
gs.executeNow(exportGr); // this is for scoped app
// SncTriggerSynchronizer.executeNow(schImp_GR); // this is for non scoped app
}
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
ā10-15-2020 03:41 AM
Now attachment , attached to Data source while auto load but tranformation process not happing.
Do I need to timer kind of think?? Or I missed any think
Ui action Script:
function importQC(){
var answer = confirm('Have you attached spreadsheet');
if(answer==true)
{
gsftSubmit(null, g_form.getFormElement(), "fj_import_qc");
}
}
var gr2 = new GlideRecord("sys_attachment");
gr2.addQuery("table_sys_id", current.sys_id);
gr2.addQuery("table_name", "x_fdrbl_business_p_bpm_task");
gr2.query();
if (!gr2.next()) {
gs.addErrorMessage("You must attach a file to submit. Your import submission has been aborted.");
current.setAbortAction(true);
}
else{
GlideSysAttachment.copy(current.getTableName(), current.sys_id, 'sys_data_source', 'a5226c1e1b7f181069e7a9342a4bcbdf');
var exportGr = new GlideRecord("scheduled_import_set");
exportGr.addQuery("sys_id", "bd553cf2db7f9810b22061f74b9619ec"); // sys_id of the record which you will be creating for scheduled import in step
exportGr.query();
if (exportGr.next()) {
//gs.executeNow(exportGr); // this is for scoped app
SncTriggerSynchronizer.executeNow(schImp_GR); // this is for non scoped app
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-15-2020 04:34 AM
Hi,
Yes I think after adding the attachment kindly add wait for 5 seconds
updated script
function importQC(){
var answer = confirm('Have you attached spreadsheet');
if(answer==true)
{
gsftSubmit(null, g_form.getFormElement(), "fj_import_qc");
}
}
var gr2 = new GlideRecord("sys_attachment");
gr2.addQuery("table_sys_id", current.sys_id);
gr2.addQuery("table_name", "x_fdrbl_business_p_bpm_task");
gr2.query();
if (!gr2.next()) {
gs.addErrorMessage("You must attach a file to submit. Your import submission has been aborted.");
current.setAbortAction(true);
}
else{
GlideSysAttachment.copy(current.getTableName(), current.sys_id, 'sys_data_source', 'a5226c1e1b7f181069e7a9342a4bcbdf');
var ms = 5000; // 5 seconds
var endSleep = new GlideDuration().getNumericValue() + ms;
while ( new GlideDuration().getNumericValue() < endSleep) {
//wait
}
var exportGr = new GlideRecord("scheduled_import_set");
exportGr.addQuery("sys_id", "bd553cf2db7f9810b22061f74b9619ec"); // sys_id of the record which you will be creating for scheduled import in step
exportGr.query();
if (exportGr.next()) {
//gs.executeNow(exportGr); // this is for scoped app
SncTriggerSynchronizer.executeNow(schImp_GR); // this is for non scoped app
}
}
regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader