Runsub

The Runsub action icon, a curled piece of paper with two arrows pointing to the right next to it at the top and bottom.

Roept een subscript aan, dat wordt uitgevoerd en uiteindelijk Return action gebruikt om terug te keren naar de uitvoering van het hoofdscript. Wanneer het subscript wordt uitgevoerd, slaat het een waarde op in de eigenschap ReturnValue van de Return-actie. Deze waarde wordt vervolgens doorgegeven aan de eigenschap ReturnVariable in de Runsub-actie in het hoofdscript.

Deze actie kan vooral handig zijn als u een of meer grotere scripts hebt die u liever in kleinere, overzichtelijke scripts opsplitst.

Dependencies

  • Het hoofdscript en het subscript moeten zich in dezelfde map bevinden.

  • Het type van het hoofdscript en het subscript moet gelijk zijn. Als het hoofdscript bijvoorbeeld een telefoonscript is, moet het subscript ook een telefoonscript zijn.
  • Als u een Runsub-actie in het hoofdscript plaatst, MOET het subscript een Return-actie hebben.
  • Runsub kan meerdere variabelen van het hoofdscript naar het subscript doorgeven, maar het subscript kan slechts één waarde (via de eigenschap ReturnVariable) retourneren naar het hoofdscript.
  • Alle variabelen die in het subscript worden gedefinieerd, zijn niet langer beschikbaar wanneer het subscript wordt beëindigd.
  • Alle scripts die door RunScript , Spawn, Runsub of soortgelijke scriptacties worden aangeroepen, moeten geldig en actief zijn. Studio valideert tijdens het opslaan alle scripts die door acties worden aangeroepen. Als een van de scripts ongeldig of inactief is, geeft Studio een foutbericht weer en kunt u niet opslaan.

Supported Script Types

The icon for a Generic script type - a rectangle with < and > symbols inside it.

The icon for the Email script type - a large @ symbol in a diamond.

The icon for the Chat script type - a chat bubble with an ellipsis inside (...), in a diamond shape.

The icon for the Phone script type - an old-style phone handset with curved lines indicating sound coming out of it.

The icon for the Voicemail script type - a symbol that looks like a cassette tape - two circles sitting on a horizontal line.

The icon for the Work Item script type-a piece of paper with one corner folded down and a bullet list on it.

The icon for the SMS script type - a smart phone with a chat bubble coming out of it.

The icon for the Digital script type - a computer monitor with a smartphone next to it.

Generiek

E-mail Chat Telefoon Voicemail Werkitem SMS Digitaal

Comparison of Similar Actions

De volgende acties hebben vergelijkbare functies, maar met enkele belangrijke verschillen:

  • Runscript: wanneer Runscript een subscript triggert, is er geen manier om vanuit het aangeroepen subscript terug te keren naar het eerste script.
  • Runsub: wanneer Runsub een subscript triggert, kan het script terugkeren naar het eerste script, zolang het subscript een Return-actie heeft. De Return-actie retourneert een waarde naar de Runsub-actie wanneer het subscript is voltooid.

Input Properties

Deze eigenschappen definiëren gegevens die de actie gebruikt bij het uitvoeren.

Vertakking

Beschrijving

bijschrift toe

Voer een korte woordgroep in die deze actie in het script uniek identificeert. Het bijschrift verschijnt op het scriptcanvas onder het actiepictogram. The default is the action name.

ScriptName

Het script dat u wilt spawnen. U kunt op de link Choose Script boven aan het eigenschappenvenster van de actie klikken om een script te selecteren dat is opgeslagen voor uw bedrijfseenheid.

ReturnVariable

De waarde die wordt geretourneerd naar het hoofdscript wordt opgeslagen in deze eigenschap. Als u meerdere waarden wilt doorgeven, gebruikt u een array als variabele.
Parameters

Klik op de drie puntjes in het veld en voeg een variabele toe voor elke parameter die u naar het gespawnde script wilt sturen. Typ in het editorvenster één variabele per regel. Gebruik betekenisvolle namen voor de variabelen. Variabelenamen hoeven niet overeen te komen met de naam van de overeenkomstige variabele die wordt gebruikt in het gespawnde script.

Parameters die in een script worden verplaatst verschijnen in de trace-uitvoerwaarde van dat script in de Begin-actie.

Resultaatvertakkingsvoorwaarden

Met Resultaatvertakkingsvoorwaarden kunt u vertakkingen maken in uw script om verschillende resultaten te behandelen wanneer de actie wordt uitgevoerd.

Voorwaarde

Beschrijving

Default

Het pad dat altijd wordt gevolgd, behalve als het script voldoet aan een voorwaarde die vereist dat het een van de andere vertakkingen volgt. Dit pad wordt ook gevolgd als de andere vertakkingen van de actie niet zijn gedefinieerd.

OnError

Het pad dat wordt gevolgd als de actie niet correct is uitgevoerd. Als er bijvoorbeeld een onverwacht probleem is, zoals een slechte verbinding, syntaxfouten enz. De _ERR-variabele, met één onderstrepingsteken, moet een beknopte beschrijving van het probleem bevatten.

Script Example

Dit voorbeeld is geen volledig script. Er is extra scriptwerk vereist om deze actie te gebruiken.

In the main script below (shown top), when the script is triggered, the Runsub action immediately triggers the subscript (shown bottom). In the subscript, Voiceparams sets the Text-to-Speech settings, and the Hours action sets branches for open, closed, and holiday to three different Return actions. When the subscript is finished, the values in the ReturnValues property (in the Return action) are stored in the ReturnVariable field (Runsub action in the main script). The Case action then sets the open, closed, and holiday branches as appropriate.

Main Script

An example script, showing Studio actions with arrows connecting them. Each action has a label beneath it to indicate what the action does in the script.

Would you like to download this script?

Subscript

An example script, showing Studio actions with arrows connecting them. Each action has a label beneath it to indicate what the action does in the script.

The three Return actions provide values in the ReturnValue property so the Case action in the main script can determine which branch to follow.

Would you like to download this script?