Yes Shivani.

I want to automate loading and tranformin on  form button(UI Action)

How data is fetching into system and what type of file will it be? ..CSV

It can be done through data source and schedule this data source on demand basis.

In UI Action, you can call the script to run this scheduled data source basically you can call "Execute Now" ui action script for this data source.

Mark helpful if it resolves the purpose.

Ankur Bawiskar
Tera Patron

@Super 

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

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

View solution in original post

Supriya Waghmod
Kilo Contributor

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 ??

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

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