Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Abort the scheduled data import through Pre-script script.

ankit19
Tera Contributor

I need to abort the scheduled data import from Excel, based on checking headers of imported Excel sheet.

From Below script I'm able to get the headers name in system logs but cannot find a funtion which I can call inside the if(header1 != 'Allocation Logic') to abort the import submission.

 

ankit19_1-1683121805024.png

 

 

25 REPLIES 25

Well, that's not the condition you used in your original post. There you said

 

 

if(header1 != 'Allocation Logic') {...}

 

Did the import run? Add a return statement, and another log statement after the if-block. Then try again, and check whether the import ran or not.

 

 

Can you simply write a 

return false;

 

This will prevent further execution of the script.

Sagar Pagar
Tera Patron

Hi @ankit19,

Instead of pre-import scripts, have you tried in conditional scripts?

 

Thanks,

Sagar Pagar

The world works with ServiceNow

@Sagar Pagar 

Thanks for your response.

I have tried the same in Conditional Script, but didnt worked.

Hi @ankit19,

Can you share that scripts?

 

Thanks,

Sagar Pagar

The world works with ServiceNow