Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

"Primary button clicked" handler doesn't update record

ronro2
Tera Contributor

Hey guys! 

I have a problem with updating the state of a record from a specific table in our instance. 

 

Here comes a screenshot of my Primary Button Clicked handler script: 

ronro2_3-1764939618704.png

Here comes the code for you to be able to copy: 

/**
* @Param {params} params
* @Param {api} params.api
* @Param {any} params.event
*/
function evaluateEvent({api, event}) {
	return {
		table: "x_vgll_rail_request",
		recordId: api.state.selectedRecord,
		templateFields: "state=7",
		useSetDisplayValue: null
	};
}

 

The client script called "Update Record" is empty, like this: 

ronro2_1-1764939419909.png

 

So why doesn't the records' state get updated when I click on the button here in front-end? I cannot see that there is anything wrong. Here is the primary button: 

ronro2_2-1764939510024.png

So when "Ja" (Yes) is clicked, the state should change to closed. But nothing happens. 

I hope you can help me. 🙂 

0 REPLIES 0