This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Variable handling

Variable handling
I am programming a script in appscript.
executes in an action in an SBM form. the execution ends in the execution of a .bat with parameters.
The first inconvenience is the value of one of these variables (description,of type text), which is a text field with spaces and the .bat receives x number of parameters, I need to send all of these as one, I tried several options but they didn't work for me. the second drawback is handling with dates. (fecha_inicio of type datetime)
and the third is the user who started the workflow(requested_byof type user)

I share my code, any contribution will be very well received. thank you

Option Explicit
' MODIFY THIS CONSTANT FOR YOUR DATABASE
' --------------------------------------
const rp_id = "ISSUEID"
const cmdb_ci = "TMPSIGLA"
const description = "DESCRIPTION"
const fecha_inicio = "TEMP_SCHEDULE_START_DATE"
const requested_by = "RLM_DEVELOPER"
' Name of the field we will work with
' MODIFY THIS CONSTANT FOR YOUR SYSTEM
' ------------------------------------
' Path to the .BAT file
const SCRIPT = "D:\Serena\Scripts\Service-now\crear.bat"


LaunchBatchFile

' Gather params from item fields, pass them to .BAT file.
Sub LaunchBatchFile()

Dim exitCode, irp_id, icmdb_ci, idescription, ifecha_inicio, irequested_by


Call Shell.Item.GetFieldValue( rp_id, irp_id)
Call Shell.Item.GetFieldValue( cmdb_ci, icmdb_ci)
Call Shell.Item.GetFieldValue( cmdb_ci, idescription)
Call Shell.Item.GetFieldValue( requested_by, irequested_by)
Call Shell.Item.GetFieldValue( fecha_inicio, ifecha_inicio)


' Run the .BAT file with params
exitCode = Ext.NewTaskWait(SCRIPT, irp_id, icmdb_ci, idescription)


End Sub

Tags: