I have a customer portal where the user creates a request for revoking a user's rights. The user needs to select a user in the field "Pravice za uporabnika" (Rights for the user), id is 10313. This is an asset field that displays all users. After that, the user needs to select an application in the "Aplikacija" (Application) field, also an asset field, id is 10069, and in the final step, they need to select the right in the "Odvzem Pravice" (Revoke Rights) field, also an asset field, id is 10314. By creating this request, the process of revoking the user's rights on the selected application is triggered. Everything needs to be automated.
I started the automation in the following way:
- The automation is currently triggered manually for testing purposes.
- After that, I do "Lookup objects" to get the list of users currently assigned to the right from the created ticket. Schema: Skladi; Query: objecttype = Pravice AND key = ("{{issue.customfield_10314}}")
- After that, I have the variable {{CurrentUporabniki}}; Smart value = {{lookupObjects.Uporabniki."Uporabniško ime"}}. The variable prints the current users, this is the log data: CurrentUporabniki: [user 1, user 2, user 3]
- And the last step for now is the log that prints the user selected in the "Pravice za uporabnika" field; User: {{issue.customfield_10313."Uporabniško ime"}}. The log output is: User: user 1
The automation should remove the selected user in the "Pravice za uporabnika" field from the list of users we obtained in point 2, and then return those users back to the value of the object's attribute in the asset.
PS, I don't have Scriptrunner.