Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Unable to run the BR while importing the records using import option in list header of my table

Priyanka666
Tera Contributor

using the Import option on list header, while importing the records into table that creates temporary import set table and transform map for every import load, so cannot create the transform map script over there to update the fields on target table like state to published and isimported to true.
I want to use the import option only and should be able to update the RBIA table record fields

for before insert/update script:

if (gs.getSession().isInteractive() == false) {
current.u_state = '1b6cc7f03b5b3e504eb91624c3e45af5';
current.u_is_imported = true;
//gs.info("Updated the RBIA records");
}


log is not being created in the logs. Could you anyone help me on this how to achieve this to update the target table fields?

Thank you.

4 REPLIES 4

PankajK75582456
Tera Contributor

Hi @Priyanka666 ,

 

Please try pasting below snippet in your BR to debug if this falls in the correct condition.

 

if (gs.getSession().isInteractive()) {

    gs.info("Record created from UI");

} else {

    gs.info("Record created from background process");

}

 

If this helped you, please mark this helpful and accepted.

Hi @PankajK75582456 ,

Thanks for the reply!!

For both directly creating the record from table and using the import excel, it shows the in the logs - "Record created from UI".

Tanushree Maiti
Giga Sage

Hi @Priyanka666 

 

Could you please confirm whether you are running the script from BR or background script.

When you run something in Scripts - Background, even if you are logged in as a human user, the execution context is not a user-interactive session . So it will return false always.

 

It returns true only when the script is executed within the context of an actual user session through the user interface, such as when a user interacts with a form, list, or UI action in the browser.

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Hi @Tanushree Maiti ,

I am using the before insert/update BR script to update the fields in target table using which is not working even I import the records from import option in list header from the target table. End user wants to use the import option only and need to set few fields in the imported records using the import excel.

Thanks