{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1071,"path":"api-reference/server-api-reference/c_NotifyActionApi.md","title":"NotifyAction - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# NotifyAction- Global\n\nThe NotifyAction API allows you to define actions to send to a telephony provider.\n\nYou add actions to a NotifyAction object by calling the respective add function for each type of action. Each add function returns an Action object, such as a SayAction object for the addSay\\(\\) method. Refer to each method example for information about returned objects.\n\n**Note:** The NotifyAction API is only valid within global applications. To utilize this type of functionality within scoped applications, you must create custom Notify workflow activities. For additional information on creating these activities, see [Notify workflow activities](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/servicenow-platform/c_NotifyActivities.md).\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## NotifyAction - addConference\\(\\)\n\nAdds a conference action to move the current call into the current conference call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|ConferenceAction|Action added to the NotifyAction object. Use the ConferenceAction object to define the conference call name, and the behavior of the conference call when a participant joins or leaves.|\n\nThis example demonstrates how to add a conference action and set the name of the conference.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a conference call action and set its name\nvar conference = notifyAction.addConference();\nconference.setName('Brown Bag: Week 3');\n```\n\n## NotifyAction - addConference.setEndOnExit\\(Boolean endOnExit\\)\n\nDefines whether the conference call should end when a specified caller exits the conference call.\n\n<table id=\"table_j33_tmc_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nendOnExit\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the conference call should end when the specified caller exits the current conference call.-   true: end the conference call when the specified caller exits the conference call\n-   false: Default. End the conference call once all participants exit\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to add a conference call action and then set it so the conference call ends when the specified caller exits.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a conference call action and set the caller that starts the meeting\nvar conference = notifyAction.addConference();\n\n// retrieve the participant for which the conference call should exit when they leave\nvar notifyParticipantGr = new GlideRecord('notify_participant');\nnotifyParticipantGr.get('active participant sys id');\n \nif (notifyParticipantGr.isValid) {\nconference.setEndOnExit(true);\n}\n```\n\n## NotifyAction - addConference.setHangupOnStar\\(Boolean hangupOnStar\\)\n\nDefines whether the conference call should end when a participant presses the star \\(\\*\\) key.\n\n<table id=\"table_kjb_jkc_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nhangupOnStar\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the conference call should end when a participant presses the star \\(\\*\\) key.Valid values:\n\n -   true: end the conference call\n-   false: Default. Don't end the conference call\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to add a conference action and then record the conference call.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a conference call action and set the hang up action\nvar conference = notifyAction.addConference();\nconference.setHangupOnStar(true);\n```\n\n## NotifyAction - addConference.setMuted\\(Boolean muted\\)\n\nDefines whether the specified caller should be muted in the current conference call.\n\nIf you do not call this method, the caller is not muted by default.\n\n<table id=\"table_zws_qgc_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nmuted\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the specified caller should be muted in the current conference call.-   true: caller should be muted\n-   false: Default. Caller should not be muted\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to add a conference action and then mute a specified caller.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a conference call action and set it to mute the specified participant\nvar conference = notifyAction.addConference();\n\nvar notifyParticipantGr = new GlideRecord('notify_participant');\nnotifyParticipantGr.get('active participant sys id');\n \nif (notifyParticipantGr.isValid) {\nconference.setMuted(true);\n}\n```\n\n## NotifyAction - addConference.setName\\(String name\\)\n\nSets the name of the current conference call to the specified name.\n\n|Name|Type|Description|\n|----|----|-----------|\n|name|String|Name to associate with the current conference call.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to add a conference action and set the name of the conference call.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a conference call action and set its name\nvar conference = notifyAction.addConference();\n\nconference.setName('Brown Bag: Week 3');\n```\n\n## NotifyAction - addConference.setRecord\\(Boolean record\\)\n\nDefines whether the associated conference call should be recorded.\n\nIf you do not call this method, the conference call is not recorded by default.\n\n<table id=\"table_bz2_ffc_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nrecord\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the current conference call should be recorded.-   true: start recording the conference call\n-   false: Default. Conference call is not recorded. Recording is stopped if it is currently being recorded.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to add a conference action and then record the conference call.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a conference call action and set it to be recorded\nvar conference = notifyAction.addConference();\nconference.setRecord(true);\n```\n\n## NotifyAction - addConference.setStartOnEnter\\(Boolean startOnEnter\\)\n\nDefines whether the conference call should start when the specified caller joins the conference call.\n\nBy default, whenever there are two or more callers, the conference call starts. To make it so the conference call only starts when a specific caller joins, you must call this method for each of the other callers and set the value to \"false\". By doing this, the conference call will not start until the desired person joins the conference call.\n\n<table id=\"table_dps_43c_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nstartOnEnter\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the conference call should start when the selected caller joins the current conference call.-   true: Default. Start the conference call when the specified caller joins the conference call.\n-   false: start the conference call once it is added\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to add a conference action and then set it so the conference call does not start until the specified caller joins.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a conference call action and set the caller that starts the meeting\nvar conference = notifyAction.addConference();\n\n// retrieve the participant for which the conference call should start when they arrive\nvar notifyParticipantGr = new GlideRecord('notify_participant');\nnotifyParticipantGr.get('active participant sys id');\n \nif (notifyParticipantGr.isValid) {\nconference.setStartOnEnter(true);\n}\n```\n\n## NotifyAction - addDial\\(\\)\n\nForwards a call to a specified phone number or Notify Client.\n\nOnce the addDial action is created, the associated phone number \\(setPhoneNumber\\(\\)\\) or Notify Client \\(setClientRecord\\(\\)\\) must also be set.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|DialAction|Action added to the NotifyAction object.|\n\nThis example shows how to make an outbound call and record the call.\n\n```\n// Initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addDial() to connect to another party – this returns an object of type DialAction\nvar dialAction = notifyAction.addDial();\n \n// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial\ndialAction.setPhoneNumber('+919765xxxxxxx');\n \n// Invoke setRecord(Boolean record) to record the call to this new number +919765xxxxxxx\ndialAction.setRecord(true);\n```\n\n## NotifyAction - addDial.setCallerID\\(String callerID\\)\n\nDefines the caller ID for the outgoing call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|callerID|String|Caller identifier to set for the outgoing call.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to make an outbound call and set a call timeout.\n\n```\n// Initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addDial() to connect to another party – this returns an object of type DialAction\nvar dialAction = notifyAction.addDial();\n \n// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial\ndialAction.setPhoneNumber('+919765xxxxxxx');\n \n// Set the caller ID\ndialAction.setCallerID('Planning Conf Call');\n```\n\n## NotifyAction - addDial.setClientRecord\\(String tableName, String sysID\\)\n\nSets the current caller to a Notify caller by specifying the table in which to find the Notify caller record and the caller's unique identifier.\n\n|Name|Type|Description|\n|----|----|-----------|\n|tableName|String|Name of the table that contains the desired caller's information.|\n|sysID|String|Unique identifier \\(sys\\_id\\) of the desired Notify caller.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to set the current caller to a Notify caller using setClientRecord\\(\\).\n\n```\n// set up a dial action to forward the\n// call to the specified client\nvar action = new SNC.NotifyAction();\nvar dial = action.addDial();\ndial.setClientRecord(notifyClientRecord.getTableName(), notifyClientRecord.getUniqueValue());\ndial.setTimeout(activity.vars.timeout);\ndial.setRecord(activity.vars.record);\n```\n\n## NotifyAction - addDial.setDTMF\\(String value\\)\n\nDefines the DTMF tones to play when the call connects.\n\n|Name|Type|Description|\n|----|----|-----------|\n|value|String|Valid DTMF digits to play when the call connects.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to make an outbound call and defines the DTMF tones to play when the call connects.\n\n```\n// Initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addDial() to connect to another party - this returns an object of type DialAction\nvar dialAction = notifyAction.addDial();\n \n// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial\ndialAction.setPhoneNumber('+919765xxxxxxx');\n \n// DTMF tones to play when call connects\ndialAction.setDTMF(\"1246AF\");\n```\n\n## NotifyAction - addDial.setHangupOnStar\\(Boolean hangupOnStar\\)\n\nDefines whether the call should end when the star \\(\\*\\) key is pressed.\n\n<table id=\"table_uns_2gd_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nhangupOnStar\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the call should end when the star \\(\\*\\) key is pressed.-   true: end the call\n-   false: don't end the call\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to make an outbound call and set the hang up key to star.\n\n```\n// Initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addDial() to connect to another party – this returns an object of type DialAction\nvar dialAction = notifyAction.addDial();\n \n// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial\ndialAction.setPhoneNumber('+919765xxxxxxx');\n \n// End call by pressing star\ndialAction.setHangupOnStar(true);\n```\n\n## NotifyAction - addDial.setPhoneNumber\\(String phoneNumber\\)\n\nDefines the phone number to call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|phoneNumber|String|E.164-compliant phone number to call.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to make an outbound call and set a call timeout.\n\n```\n// Initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addDial() to connect to another party – this returns an object of type DialAction\nvar dialAction = notifyAction.addDial();\n \n// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial\ndialAction.setPhoneNumber('+919765xxxxxxx');\n\n```\n\n## NotifyAction - addDial.setRecord\\(Boolean record\\)\n\nDefines whether the outgoing call should be recorded.\n\n<table id=\"table_hbp_sdd_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nrecord\n\n</td><td>\n\n \n\n</td><td>\n\nFlag that indicates whether the outgoing call should be recorded.Valid values:\n\n -   true: record the outgoing call\n-   false: do not record the outgoing call\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to make an outbound call and record the call.\n\n```\n// Initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addDial() to connect to another party – this returns an object of type DialAction\nvar dialAction = notifyAction.addDial();\n \n// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial\ndialAction.setPhoneNumber('+919765xxxxxxx');\n \n// Record the call\ndialAction.setRecord(true);\n```\n\n## NotifyAction - addDial.setTimeout\\(Integer timeout\\)\n\nSets the number of seconds after which the outgoing call times out.\n\n|Name|Type|Description|\n|----|----|-----------|\n|timeout|Integer|Number of seconds after which the outgoing call times out. Default: 30|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to make an outbound call and set a call timeout.\n\n```\n// Initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addDial() to connect to another party – this returns an object of type DialAction\nvar dialAction = notifyAction.addDial();\n \n// Call setPhoneNumber(String phoneNumber)in DialAction.java to specify the phone number to dial\ndialAction.setPhoneNumber('+919765xxxxxxx');\n \n// Set the number of seconds to wait before timing out\ndialAction.setTimeout(45);\n```\n\n## NotifyAction - addGather\\(\\)\n\nPresents a specified interactive phone menu to the caller.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|GatherAction|Action added to the NotifyAction object. Use the GatherAction object to define the menu settings and options to present to the user.|\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// present the user with a menu\nvar gather = notifyAction.addGather();\ngather.setNumberOfDigits(1);    // the user can type 1 digit\ngather.setFinishKey('#');       // # or *, useful for > 1 digit\ngather.setTimeout(10);          // time to enter answer, in seconds\n\n// add first menu item\nvar usSay = gather.addSay();\nusSay.setText('Press 1 for english');\nusSay.setLanguage('en-US');\n\n// add second menu item\nvar nlSay = gather.addSay();\nnlSay.setText('Kies 2 voor Nederlands');\nnlSay.setLanguage('nl-NL');\n\n// add third menu item\nvar frSay = gather.addSay();\nfrSay.setText('Choisissez 3 pour le français.');\nfrSay.setLanguage('fr-FR');\n\n// and finish off with an applause\nvar play = gather.addPlay();\nplay.setURL('http://www.wavsource.com/snds_2015-04-12_5971820382841326/sfx/applause_y.wav');\n```\n\n## NotifyAction - addGather.addPlay\\(\\)\n\nPlays an audio file on the call.\n\nRefer to the NotifyAction addPlay\\(\\) method for a description of the supported child methods.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|PlayAction|Action added to the NotifyAction object. Use the PlayAction object to define the audio file URL and the number of times to loop the audio.|\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// Create the gather action object\nvar gather = notifyAction.addGather();\n\n// Play an audio file\nvar play = gather.addPlay();\nplay.setURL('http://www.wavsource.com/snds_2015-04-12_5971820382841326/sfx/applause_y.wav');\n```\n\n## NotifyAction - addGather.addSay\\(\\)\n\nDefines the text-to-speech to read on the call.\n\nRefer to the NotifyAction addSay\\(\\) method for a description of the supported child methods.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|SayAction|Action added to the NotifyAction object. Use the SayAction object to define the text and language to read.|\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// present the user with a menu\nvar gather = notifyAction.addGather();\ngather.setNumberOfDigits(1);    // the user can type 1 digit\ngather.setTimeout(20);          // time to enter answer, in seconds\n\n// add first menu item\nvar gatherSay = gather.addSay();\ngatherSay.setText('Press 1 for english');\ngatherSay.setLanguage('en-US');\n\n```\n\n## NotifyAction - addGather.setFinishKey\\(String finishKey\\)\n\nDefines the key that the caller inputs to denote the end of their input.\n\n<table id=\"table_pk1_hmd_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nfinishKey\n\n</td><td>\n\nString\n\n</td><td>\n\nKey that denotes the end of caller input.Valid values:\n\n -   0-9\n-   \\# \\(default\\)\n-   \\*\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to add a gather action and define the key that denotes the end of the caller input.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\nvar gather = notifyAction.addGather();\ngather.setNumberOfDigits(4);    // the user can type four digit\ngather.setFinishKey('#');       // # or *, useful for > 1 digit\n```\n\n## NotifyAction - addGather.setNumberOfDigits\\(Integer numberOfDigits\\)\n\nDefines the number of digits to collect.\n\n|Name|Type|Description|\n|----|----|-----------|\n|numberOfDigits|Integer|Number of digits to collect. Zero is an invalid value.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to add a gather action and define the number of key strokes to collect.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// present the user with a menu\nvar gather = notifyAction.addGather();\ngather.setNumberOfDigits(4);    // the user can type four digit\ngather.setFinishKey('#');       // # or *, useful for > 1 digits\ngather.setTimeout(20);          // time to enter answer, in seconds\n\n```\n\n## NotifyAction - addGather.setTimeout\\(Integer timeout\\)\n\nDefines the amount of time after which gathering of input will timeout.\n\n|Name|Type|Description|\n|----|----|-----------|\n|timeout|Integer|Number of seconds to wait for caller input before timing out. Default: 10|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to add a gather action and define the input timeout value.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// present the user with a menu\nvar gather = notifyAction.addGather();\ngather.setNumberOfDigits(4);    // the user can type 1 digit\ngather.setFinishKey('#');       // # or *, useful for > 1 digits\ngather.setTimeout(20);          // time to enter answer, in seconds\n\n```\n\n## NotifyAction - addHangUp\\(\\)\n\nEnds an active phone call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|HangUpAction|Action added to the NotifyAction object.|\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// hang up\nnotifyAction.addHangUp();\n```\n\n## NotifyAction - addQueue\\(\\)\n\nQueues the call, which puts the call on hold.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|QueueAction|Action added to the NotifyAction object. Use the QueueAction object to define the queue name, and queueing or dequeueing behavior.|\n\nThis example shows how to add the call to the specified queue.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// queue the call\nvar queue = notifyAction.addQueue();\nqueue.setName('my queue');\n```\n\nThis example shows how to remove the call from the queue.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// dequeue the call\nvar queue = notifyAction.addQueue();\nqueue.setDequeue(true);\n```\n\n## NotifyAction - addQueue.setDequeue\\(Boolean dequeue\\)\n\nRemoves the call from the current call queue \\(takes it off of \"hold\"\\).\n\n<table id=\"table_enw_wwd_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ndequeue\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether to remove the current call from the queue.-   true: remove the call from the queue\n-   false: call is put in the queue\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to remove the call from the queue.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// dequeue the call\nvar queue = notifyAction.addQueue();\nqueue.setDequeue(true);\n```\n\n## NotifyAction - addQueue.setName\\(String name\\)\n\nDefines the name associated with a queue.\n\n|Name|Type|Description|\n|----|----|-----------|\n|name|String|Name to associate with the queue.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to define the name of a queue.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// queue the call\nvar queue = notifyAction.addQueue();\nqueue.setName('my queue');\n```\n\n## NotifyAction - addPlay\\(\\)\n\nPlays an audio file on the call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|PlayAction|Action added to the NotifyAction object. Use the PlayAction object to define the audio file URL and number of times to loop the audio.|\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a play action\nvar play = notifyAction.addPlay();\nplay.setURL('http://www.moviesounds.com/2001/imsorry.wav');\nplay.setLoop(1);\n```\n\n## NotifyAction - addPlay.setLoop\\(Integer loop\\)\n\nDefines the number of times to play \\(loop through\\) the audio file.\n\n|Name|Type|Description|\n|----|----|-----------|\n|loop|Integer|Number of times to play the audio file.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a play action\nvar play = notifyAction.addPlay();\nplay.setURL('http://www.moviesounds.com/2001/imsorry.wav');\nplay.setLoop(2);\n```\n\n## NotifyAction - addPlay.setURL\\(String url\\)\n\nDefines the URL where to obtain the audio file to play.\n\n|Name|Type|Description|\n|----|----|-----------|\n|url|String|URL of the audio file to play.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a play action\nvar play = notifyAction.addPlay();\nplay.setURL('http://www.moviesounds.com/2001/imsorry.wav');\nplay.setLoop(1);\n```\n\n## NotifyAction - addRecord\\(\\)\n\nAdds an action to record the call to the current NotifyAction object.\n\nThe recording automatically ends when the call is completed or when a specified terminate is pressed \\(setFinishKey\\(\\)\\). The recording is then placed in the notify\\_record table for the associated call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to record a call.\n\n```\n// First we initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Call addRecord() of NotifyAction – This returns an object of type RecordAction\nvar recordAction = notifyAction.addRecord();\n \n// Optional. Define the key that callers use to stop the recording\nrecordAction.setFinishKey('#'); // Stop the call recording when caller presses the '#' key.\n```\n\n## NotifyAction - addRecord.setFinishKey\\(String finishKey\\)\n\nDefines the key that terminates the recording.\n\n<table id=\"table_t1r_fhd_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nfinishKey\n\n</td><td>\n\nString\n\n</td><td>\n\nKey that terminates the recording.Valid values:\n\n -   0-9\n-   \\# \\(default\\)\n-   \\*\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to record a call and set the call termination key.\n\n```\n// First we initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Then we call addRecord() of NotifyAction \nvar recordAction = notifyAction.addRecord();\n \n// Set the key that terminates the recording\nrecordAction.setFinishKey('#'); // This means that we stop the call recording when user presses the '#' key.\n```\n\n## NotifyAction - addRecord.setMaxDuration\\(Integer seconds\\)\n\nDefines the maximum length of the recording.\n\n|Name|Type|Description|\n|----|----|-----------|\n|seconds|Integer|Maximum length of the recording in seconds. Default: 3600|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to record a call and set the call termination key.\n\n```\n// First we initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Then we call addRecord() of NotifyAction \nvar recordAction = notifyAction.addRecord();\n \n// Set the maximum length of the recording\nrecordAction.setMaxDuration(4800); \n```\n\n## NotifyAction - addRecord.setTimeout\\(Integer timeout\\)\n\nSets the number of seconds of silence, after which, the recording ends.\n\n|Name|Type|Description|\n|----|----|-----------|\n|timeout|Integer|Number of seconds of silence on the call, after which the recording ends. Default: 10|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates how to record a call and set the recording timeout value.\n\n```\n// First we initialize NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n \n// Then we call addRecord() of NotifyAction \nvar recordAction = notifyAction.addRecord();\n \n// Set the recoding timeout value\nrecordAction.setTimeout(360); \n```\n\n## NotifyAction - addReject\\(\\)\n\nRejects an incoming call.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|RejectAction|Action added to the NotifyAction object. Use the RejectAction object to define the reason for rejecting the call.|\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// reject the call\nvar rejectAction = notifyAction.addReject();\nrejectAction.setReason('busy'); // 'busy' or 'rejected'\n```\n\n## NotifyActon - addReject.setReason\\(String reason\\)\n\nDefines the reason why the call was rejected.\n\n<table id=\"table_fdf_bzd_cgb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nreason\n\n</td><td>\n\nString\n\n</td><td>\n\nReason why the call was rejected.Valid values:\n\n -   busy\n-   rejected\n\nAll other values are ignored.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// reject the call\nvar rejectAction = notifyAction.addReject();\nrejectAction.setReason('busy'); // 'busy' or 'rejected'\n```\n\n## NotifyAction - addSay\\(\\)\n\nDefines the text-to-speech to read on the call.\n\nMultiple languages are supported with text-to-speech. Available languages depend on the telephony provider.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|SayAction|Action added to the NotifyAction object. Use the SayAction object to define the text and language to read.|\n\nThis example demonstrates reading text in several languages.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a say action to say something in US English\nvar usSay = notifyAction.addSay();\nusSay.setText('Welcome. I can speak english');\nusSay.setLanguage('en-US');\n\n// add a say action to say something in Dutch\nvar nlSay = notifyAction.addSay();\nnlSay.setText('Ik spreek ook vloeiend nederlands');\nnlSay.setLanguage('nl-NL');\n\n// and german\nvar deSay = notifyAction.addSay();\ndeSay.setText('Und ich kan auch deutsch sprechen');\ndeSay.setLanguage('de-DE');\n```\n\n## NotifyAction - addSay.setLanguage\\(String language\\)\n\nDefines the language in which to speak the text.\n\nUse this method in conjunction with the setText\\(\\) method to define the verbiage to speak.\n\n|Name|Type|Description|\n|----|----|-----------|\n|language|String|ISO 3166 language code that defines the language in which to speak the associated text. For example, \"en-US\" or \"nl-NL\".|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates reading text in several languages.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a say action to say something in US English\nvar usSay = notifyAction.addSay();\nusSay.setText('Welcome. I can speak english');\nusSay.setLanguage('en-US');\n\n// add a say action to say something in Dutch\nvar nlSay = notifyAction.addSay();\nnlSay.setText('Ik spreek ook vloeiend nederlands');\nnlSay.setLanguage('nl-NL');\n\n// and german\nvar deSay = notifyAction.addSay();\ndeSay.setText('Und ich kan auch deutsch sprechen');\ndeSay.setLanguage('de-DE');\n```\n\n## NotifyAction - addSay.setText\\(String text\\)\n\nDefines the text to be read within the current call.\n\nUse this method in conjunction with the setLanguage\\(\\) method to define the language in which to speak the provided text.\n\n|Name|Type|Description|\n|----|----|-----------|\n|text|String|Text to read aloud within the current call.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates reading text in several languages.\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// add a say action to say something in US English\nvar usSay = notifyAction.addSay();\nusSay.setText('Welcome. I can speak english');\nusSay.setLanguage('en-US');\n\n// add a say action to say something in Dutch\nvar nlSay = notifyAction.addSay();\nnlSay.setText('Ik spreek ook vloeiend nederlands');\nnlSay.setLanguage('nl-NL');\n\n// and german\nvar deSay = notifyAction.addSay();\ndeSay.setText('Und ich kan auch deutsch sprechen');\ndeSay.setLanguage('de-DE');\n```\n\n## NotifyAction - addSMS\\(\\)\n\nSends an SMS message.\n\n**Note:** When using this function with an active call, you do not need to call the setTo function on the returned SMSAction object. The SMS is automatically sent to the caller.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|SMSAction|Action added to the NotifyAction object. Use the SMSAction object to define the message text and the phone number to which to send the message.|\n\n```\n// Instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// Define where to send the SMS to\nvar number = new GlideElementPhoneNumber();\nnumber.setPhoneNumber('+31612345678', true);\n\n// Add an SMS action\nvar sms = notifyAction.addSMS();\nsms.setMessage('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');\nsms.setTo(number);\n```\n\n## NotifyAction - addSMS.setMessage\\(String message\\)\n\nDefines the text of the SMS message to send.\n\n|Name|Type|Description|\n|----|----|-----------|\n|message|String|Text of the SMS message to send.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// define where to send the sms to\nvar number = new GlideElementPhoneNumber();\nnumber.setPhoneNumber('+31612345678', true);\n\n// add a SMS action\nvar sms = notifyAction.addSMS();\nsms.setMessage('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');\nsms.setTo(number);\n```\n\n## NotifyAction - addSMS.setTo\\(String to\\)\n\nSets the phone number to which to sent the SMS message.\n\n|Name|Type|Description|\n|----|----|-----------|\n|to|String|E.164-compliant phone number to which to send the SMS message.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\n// instantiate NotifyAction\nvar notifyAction = new SNC.NotifyAction();\n\n// define where to send the sms to\nvar number = new GlideElementPhoneNumber();\nnumber.setPhoneNumber('+31612345678', true);\n\n// add a SMS action\nvar sms = notifyAction.addSMS();\nsms.setMessage('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');\nsms.setTo(number);\n```\n\n## NotifyAction - append\\(NotifyAction action\\)\n\nAppends the specified NotifyAction object to the current client's NotifyAction object.\n\nThere are two types of NotifyActions: terminal and non-terminal. Once you append a terminal action to a client's NotifyAction object, you cannot append any additional actions. Non-terminal actions include:\n\n-   PlayAction\n-   RecordAction\n-   SayAction\n-   SMSAction\n\nAll others NotifyActions are terminal. If you try to add another NotifyAction after a terminal action, the call will fail.\n\n|Name|Type|Description|\n|----|----|-----------|\n|action|NotifyAction|NotifyAction object to append to the NotifyAction object of the current caller.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## NotifyAction - fromJson\\(String json\\)\n\nDeserialize a NotifyAction object from a JSON string.\n\n|Name|Type|Description|\n|----|----|-----------|\n|json|String|A JSON string representation of a NotifyAction object.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example demonstrates deserializing a NotifyAction object.\n\n```\nvar json = \".... some json obtained from toJson ....\";\n\n// instantiate notify action\nvar notifyAction = new SNC.NotifyAction();\n\n// deserialize and reconstruct the notify action instance\nnotifyAction.fromJson(json);\n```\n\nThis example demonstrates both serializing and deserializing a NotifyAction object.\n\n```\n// instantiate notify action\nvar notifyAction = new SNC.NotifyAction();\n\n// add a queue\nvar queue = notifyAction.addQueue();\nqueue.setName('myQueueName');\nqueue.setDequeue(false);\n\n// serialize to json\nvar json = notifyAction.toJson();\ngs.log('serialization result: ' + json);\n\n// instantiate a new notify action\nvar newAction = new SNC.NotifyAction();\n\n// deserialize the json generated above\nnewAction.fromJson(json);\n\n// serialize the new object and log the result\nnewJson = newAction.toJson();\ngs.log('new serialization result: ' + newJson);\ngs.log('the same: ' + (json == newJson));\n```\n\nOutput: \\*\\*\\* Script: serialization result: \\{\"fClassName\":\"NotifyAction\",\"fActions\":\\[\\{\"fClassName\":\"QueueAction\",\"fDequeue\":true,\"fQueueName\":\"myQueueName\"\\}\\]\\} \\*\\*\\* Script: new serialization result: \\{\"fClassName\":\"NotifyAction\",\"fActions\":\\[\\{\"fClassName\":\"QueueAction\",\"fDequeue\":true,\"fQueueName\":\"myQueueName\"\\}\\]\\} \\*\\*\\* Script: the same: true\n\n## NotifyAction - setCallRecord\\(GlideRecord callRecord\\)\n\nDefines the Notify call record in which to add subsequent actions.\n\n|Name|Type|Description|\n|----|----|-----------|\n|callRecord|GlideRecord|GlideRecord containing the record of the caller \\(within the notify\\_call table\\) for which to add actions. This caller stays in affect until this method is called again with a different caller.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example shows how to set the caller to which you want to add actions.\n\n```\npublic NotifyAction runIncomingCallWorkflow(NotifyPhoneNumber notifyPhoneNumber, GlideRecord callRecord) throws NoWorkflowConfiguredException, NoSuchNotifyGroupRecordException {\n   NotifyAction notifyAction = runWorkflow(notifyPhoneNumber, COL_INCOMING_CALL_WF, callRecord);\n   notifyAction.setCallRecord(callRecord);\n   return notifyAction;\n}\n```\n\n## NotifyAction - toJson\\(\\)\n\nSerialize the NotifyAction object to a JSON string.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|JSON representation of this NotifyAction object.|\n\nThis example demonstrates serializing a NotifyAction object.\n\n```\n// instantiate notify action\nvar notifyAction = new SNC.NotifyAction();\n\n// add one or more notify actions\n// ...\n\n// and serialize to json\nvar json = notifyAction.toJson();\n```\n\nThis example demonstrates both serializing and deserializing a NotifyAction object.\n\n```\n// instantiate notify action\nvar notifyAction = new SNC.NotifyAction();\n\n// add a queue\nvar queue = notifyAction.addQueue();\nqueue.setName('myQueueName');\nqueue.setDequeue(false);\n\n// serialize to json\nvar json = notifyAction.toJson();\ngs.log('serialization result: ' + json);\n\n// instantiate a new notify action\nvar newAction = new SNC.NotifyAction();\n\n// deserialize the json generated above\nnewAction.fromJson(json);\n\n// serialize the new object and log the result\nnewJson = newAction.toJson();\ngs.log('new serialization result: ' + newJson);\ngs.log('the same: ' + (json == newJson));\n```\n\nOutput: \\*\\*\\* Script: serialization result: \\{\"fClassName\":\"NotifyAction\",\"fActions\":\\[\\{\"fClassName\":\"QueueAction\",\"fDequeue\":true,\"fQueueName\":\"myQueueName\"\\}\\]\\} \\*\\*\\* Script: new serialization result: \\{\"fClassName\":\"NotifyAction\",\"fActions\":\\[\\{\"fClassName\":\"QueueAction\",\"fDequeue\":true,\"fQueueName\":\"myQueueName\"\\}\\]\\} \\*\\*\\* Script: the same: true\n\n"}}