- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 03:57 AM
Hi,
What have you done so far, and where are you stuck?
To add a button or related link means to create a UI action that performs some script when clicked.
You can have a look at the existing OOB UI actions to get inspiration on how you should move forward.
Or you can read up on the Docs site to get started.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 03:58 AM
Hello @Renu9 ,
Create UI action and select Form Button and in the condition write code like below
gs.getUser().isMemberOf('assignment group name');
and write the same code in UI action also that you have written in business rule.
Please mark my answer as helpful/correct if it helps you.
Regards,
Namrata
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 08:23 AM
Hi @Community Alums
I have put the same code which was in BR to the UI Action script , I was trying to set the field value . It is working fine in BR but not in UI Action. I put the logs and noticed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 11:34 AM
Hi,
Since the same code is going to be used in multiple places (both business rule, and UI action) I would suggest that you move the calculation to a script include method, and pass the dates to be calculated as inputs, and then return from the method, the result to be set in the field.
Also, I would recommend to use GlideDateTime methods instead of the gs.datediff method, because datediff only works in Global scope, not in scoped apps.
Let me know if you want additional help/suggestions to set this up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 09:27 AM
Hi Renu9,
As suggested by Namrata, you can use that statement in the condition field of that UI Action.
As per your script, just make sure that Client checkbox is unchecked, and you might have to include current.update(); in the script of your UI Action.