Need to automate the single action click from the Guidance

sreeshsurendran
Tera Guru

Hi all,

 

The requirement is to automate my single click action that's running on my guidance. So, when we initiate the Playbook experience, after a certain set of questions are answered, the case goes to awaiting info with Agreed with customer. The user will be filling the expected end/date. I've added the update case action in the subflow, but seems like not working. Attaching below the client script from the UI Builder.

 

/**
* @Param {params} params
* @Param {api} params.api
* @Param {any} params.event
* @Param {any} params.imports
* @Param {ApiHelpers} params.helpers
*/
function handler({api, event, helpers, imports}) {

console.log(event.payload.data.record.state)
    if(event.payload.data.record.state && event.payload.data.record.state.value == 18 )
    {
    
   helpers.timing.setTimeout(function () {
        // this here is globalThis, which is equal to window
        console.log(this.document);
    });

        api.emit('GUIDANCE_ACTION_CLICKED',{ 
        model: {
               fields: [{'name': 'u_state',
               'value': api.context.props.guidanceInputs.u_state.value}],
               },
             
        action: api.context.props.guidanceActions[2]
       // action: api.context.props.guidanceActions[1] 
    } 
        );
        //api.setState('showInputMessage',true); 
    }

}

 

The above client script is triggered by a record watcher with the following config.

{
  "isActive": false,
  "effectiveChannelId": "/rw/default/null/null",
  "channelParameters": {
    "table": null,
    "filter": null
  }
}

 

 

Thanks,

Sreesh Surendran

ServiceNow Developer - Integrations & CSM.

 

 

 

 

 

0 REPLIES 0