DEV Community


Posted on • Updated on

"Assign to me" declarative action in workspace

Let's be fancy and not use the old ui action for our assigned to me button, lets use the new declarative actions.

To do that you first need to create an action bar declarative action same as in my previous post (
Use the implement as 'UXF Client Action' and create a new Action Payload Definition. Tell the payload definition that it is applicable to 'form'. As we will make everything dynamic, we don't need to add a payload (we can if we want to).

Do the same as in the previous post with the UX Form Action Layout so the button shows up in the action bar on your workspace.

Lets go back to our workspace and lets create on our page level a handled event. That is our container were we put in other events. I called mine ThomsEvent :)

Image description

Now we need to got to 'sys_ux_addon_event_mapping', our UX Add-on Event Mapping table, to connect our declarative action to our handled event. So when we click on the button, our handled event gets fired and we can do a good old setValue from our gform data broker.

Image description
Please be aware, that the handled event just shows up on the record page that is used in our workspace.

Now we will see our handled event on the page level event mappings.

Image description

Here we can now add a SET_VALUE event from our gform data broker.

We can then use the script mode to create our dynamic payload and use the context.session object to get dynamically the user sys_id.

function evaluateEvent({api, event}) {
    return {
        fieldName: 'assigned_to',
        value: api.context.session.user.sys_id,
        displayValue: api.context.session.user.fullName

Enter fullscreen mode Exit fullscreen mode

Thats it! :) We could now also add a save event from our gfrom data broker, if we want to.
Have fun!

Top comments (0)