need help for assign and reassign ui action

Are Kaveri
Tera Contributor

we have a requirement as below

 

we have developed a scoped application.

for our custom table we need to add assign and reassign button on our form.

we have assigned_to field on our form.

Assign - on click of assign user able to change assigned_to .

if user want to reassign back to original assigned to user. on click of reassign it should assign to previous user.

Reassign - onclick of reassign . it will automatically assign back to original assigned to.

 

i tried creating 2 UI action assign and reassign .

i am unable to achieve the below requirements. please let me know how can i achieve below scenarios.

 

Please let me know if anyone have idea.

 

Thanks in advance

4 REPLIES 4

amaradiswamy
Kilo Sage

I would suggest you to create a new custom field called Previous Assigned to so that you can determine who is the previous assigned to. so, when you click reassign the script can be

 

current.assigned_to = current.u_previous_assigned_to;

 

And, create a business rule to update this field when assigned to changes

 

BR: Before -- update

conditions: Assigned to changes

Script:

current.u_previous_assigned_to = previous.assigned_to;

Are Kaveri
Tera Contributor

when i write above script the below issue i am facing:

previous.assigned_to should not change everytime i update. it should only change for first time.

 

Then you can add condition to the business rule like

Assigned to changes and Previous Assigned to is empty

 

This will make sure the BR works only one time when assigned to changed for the first time

Causeymacken
Giga Contributor

To achieve the assign and reassign functionality for your custom table in the scoped application, you'll need to configure the UI actions properly. Here's a step-by-step guide:

  1. Create Two UI Actions:

    • Assign: This UI action should be linked to the "Assign" button. On click, it should allow the user to change the value of the assigned_to field.
    • Reassign: This UI action should be linked to the "Reassign" button. On click, it should assign the task back to the previous assigned_to user.
  2. Define Conditions:

    • For the "Assign" UI action, you can set a condition that checks if the assigned_to field is not empty (indicating it's already assigned), and if it's not the original assigned user.
    • For the "Reassign" UI action, you can set a condition that checks if the assigned_to field is not empty and if it's not equal to the previous assigned user.
  3. Scripting:

    • In the script of the   "Assign" UI action, you need to update the assigned_to field with the new user's value.
    • In the script of the "Reassign" UI action, you'll need to keep track of the previous assigned_to user (maybe in a custom field) before changing the assigned_to field back to that user.
  4.