Ui button on workspace

Rosy14
Tera Guru

I want to create a button visible only workspace such taht after clicking it make additional comment madetory and after filing it, it will go to next state . How to proceed?

1 ACCEPTED SOLUTION

Najmuddin Mohd
Mega Sage

Hi @Rosy14 ,
Create a UI Action, 
In the workspace client script, 

 

function onClick(g_form) {
    g_modal.showFields({
        title: "Enter your reason",
        fields: [{
            type: 'textarea',
            name: 'comments',
            label: getMessage('Reason'),
            mandatory: true
        }],
        size: 'lg'
    }).then(function(fieldValues) {
        g_form.setValue('comments', fieldValues.updatedFields[0].value);
        g_form.setValue('state',[Backend value of the state];
        g_form.save();
    });
}

 

 

On clicking of the UI action, a popup will populate to fill mandatory Additional comments.
Clicking Ok will map it to additional comments and state changes to state mapped in. (Add the state from the last 4th line of the code).

NajmuddinMohd_1-1724243327106.png

 

NajmuddinMohd_0-1724243297624.png

 



If this information helps you, kindly mark. it as Helpful and Accept the solution.

Regards,
Najmuddin.

View solution in original post

10 REPLIES 10

Hi @Rosy14 ,
Move the incident state to InProgress and according to my code, it changes back to New state.
g_form.setValue('state',1); // 1 is the backend value of New.

NajmuddinMohd_0-1724248852180.png



Regards,
Najmuddin.

I tried that way. I tried to update description also, this is updating only state is not

Hi @Rosy14 ,

can you share the code that you have written, the table on which it is written and what's your exact requirement. (which state should be changed).

Happy to help.

Regards,
Najmuddin

Workspace client script 

function onClick(g_form) {
    g_modal.showFields({
        title: "Enter Additional comments",
        fields: [{
            type: 'textarea',
            name: 'comments',
            label: getMessage('Reason'),
            mandatory: true
        }],
        size: 'lg'
    }).then(function(fieldValues) {
		
        g_form.setValue('state',18);
		g_form.setValue('description',"Test");
        g_form.setValue('comments', fieldValues.updatedFields[0].value);
        g_form.save();
    });
}

 

Rosy14_0-1724253858382.png

 

Hi @Rosy14 ,

One thing to consider is make sure to have State and Description field on the form. Since we are updating using g_form which is client side, the fields need to be on the form. Sharing the images and also attaching the update set xml.

NajmuddinMohd_0-1724260716116.png

NajmuddinMohd_1-1724260754606.png

NajmuddinMohd_2-1724260935652.png

NajmuddinMohd_3-1724261555181.png

UI Action name : Awaiting Info community.

I hope it will help you.

Regards,
Najmuddin.