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.

Avoid new record submission to trigger reload of record data via contextual sidepanel

Vegard S
Kilo Sage

Not sure how to explain this, but my issue is the following. 
On the record page of Service Operations Workspace I've added a contextual sidepanel. 

This sidepanel contains a form which displays data from a related record. 
I can update this record just fine by using the save event of the record controller. 
I did notice that whenever the new form controller loads it's data it refreshes the title of the page and the main tab. Interfering with the original record I actually have opened. I managed to get around this by manually updating the title using helpers.screen.updateStatus.

So far so good...
But when the sysId is -1, aka a new record, it submits and reloads the whole thing, including the url and everything. 

I just need it to save the record and stay where it was without refreshing anything. 
So far I've been looking into several options, such as trigging a UI Action which includes current.insert(), but the current is this context is the new record, and I have no reference to the original record I'm actually on.

I've also looked at binding a script to the Form Controllers Form status changed event. 
And in that event I can see that event.payload.status == 'inserted' and maybe via that I can abort everything else. 

Does anyone have any ideas?
I know I could run my own Data Broker Transform script, but I need the validation of the form to make sure mandatory fields are taken care of. And the form has all the data necessary, I just want to abort all additional actions after the record is inserted.

0 REPLIES 0