Can you create records in Sys UI Messages table [sys_ui_message] using BR or Flow Designer?

Javier Tirado1
Tera Guru

I need to store custom group descriptions that certain users can create in different languages. I decided to try to approach from UI Messages using localization, but it's impossible to insert data from Flows or Business Rules, it's like the table is super protected.

Anyone have a clue of how to override this?

1 ACCEPTED SOLUTION

Javier Tirado1
Tera Guru

I managed to find a way to overcome this obstacle. You can access a protected global table through a flow triggered in a scoped application.

First you create a Script Include in global scope where you perform the record insertion in the desired table (in my case, sys_ui_message).

var PassInfoToMessage = Class.create();
PassInfoToMessage.prototype = {
    initialize: function() {
    },
	passData: function (key, lang, msg){
		var gr = new GlideRecord('sys_ui_message');
		gr.initialize();
		gr.setValue('key', key);
		gr.setValue('language', lang);
		gr.setValue('message', msg);
		gr.insert();
	},

    type: 'PassInfoToMessage'
};

Then, you create a custom action in Flow designer, stablishing the inputs and with a Scripted step calling this Script Include.

Then it's just a matter of putting the action in your flow and everything should work fine.

View solution in original post

4 REPLIES 4

Ian Mildon
Tera Guru

There is a "create" level ACL that restricts the action to "admin" role

But BR and Flows interact with data as the System right?

Flows can run as anyone you specify...so make sure to set it to Run As "system user". And you can also specify a role to run the Flow under.

Javier Tirado1
Tera Guru

I managed to find a way to overcome this obstacle. You can access a protected global table through a flow triggered in a scoped application.

First you create a Script Include in global scope where you perform the record insertion in the desired table (in my case, sys_ui_message).

var PassInfoToMessage = Class.create();
PassInfoToMessage.prototype = {
    initialize: function() {
    },
	passData: function (key, lang, msg){
		var gr = new GlideRecord('sys_ui_message');
		gr.initialize();
		gr.setValue('key', key);
		gr.setValue('language', lang);
		gr.setValue('message', msg);
		gr.insert();
	},

    type: 'PassInfoToMessage'
};

Then, you create a custom action in Flow designer, stablishing the inputs and with a Scripted step calling this Script Include.

Then it's just a matter of putting the action in your flow and everything should work fine.