Scripting

Agenty script is a C# program, written for a special run-time environment that automate the modification of agent output result or the input data entered by user, either by manually or selecting a URL list or source_agent. Scripts are often interpreted (rather than compiled). There are two types of scripts available to add with each agent:

  1. Pre-Processing
  2. Post-Processing

Pre-Processing

Script to modify input on the fly : This script executes before the agent job starts the task and should be used to manipulate the agent input  : -

//Get the agent default input as DataTable

var table = Agenty.Cloud.GetAgentInput("YOUR AGENT ID HERE");


// Write your code here to modify the input as DataTable
// Programming language : C#


table.SetAgentInput(); //Set the modified input

The Pre-Processing script helps to modify the agent input automatically. For example, if we want to extract the data from an airline website which require the Check In as current date and Check Out as plus 7 days in current date in query-string - We can write a Pre-processing script to modify the static input URL http://example.com/flight-search into dynamically generated url with current date and +7 days automatically on manual jobs or on scheduled jobs and can write a script to generate URL in format like:- http://example.com/flight-search?check-in=01\05\2018&check-out=01\12\2018

Post-Processing

Script to modify output on the fly : This script executes after the agent job has been completed and before trigger, this script should be used to manipulate the output table : -

//Get the agent default output as DataTable

var table = Agenty.Cloud.GetAgentResult("YOUR AGENT ID HERE");


// Write your code here to modify the result from DataTable
// Programming language : C#


table.SetAgentResult(); //Set the modified output

The Post-Processing script helps to modify the output automatically. For example, if we have an Amount column in our agent result which has the USD word in it, but we wanted to replace the USD word with $. So, we can write a simple post-processing script to replace the USD with $.