Monday, July 1, 2019

Workflow: How to format the Text in Show message to enter carriage returns

Use case:
A workflow has been defined on Sales Orders with Show Message Action in one of its state to display a message whenever the Memo field has been changed.
How to display newlines(enter carriage returns) in the Message Text of the Workflow's Show Message Action?

Answer: Currently it is not possible to format the message to include carriage returns in it (Enhancement 235040).

Alternate solution:
Use SuiteScript: Client Script with Field Changed Function where the message can be formatted to include newlines.

  1. Sample code:
    function clientFieldChanged(type, name){if(name == 'memo')	{    var memo = nlapiGetFieldValue('memo');    if (memo != null)    {          var message = 'The value of the memo field will be displayed on next line: ' + 
    '\n' + memo; alert(message); } }}
  2. Create the Client Script record in NetSuite through  Customization > Scripting > Scripts > New > Client Script.
    - Scripts tab: select the Script File = the name of the script you have created in step 1 and in Field Changed Function = clientFieldChanged
    - Deployments tab: Applies To = Sales Order, Status = Released, Select Audience

For more information about Client Scripts please visit SuiteAnswers Article 19194 Running Scripts in NetSuite Overview .

No comments:

Post a Comment