The CreatorCon Call for Content is officially open! Get started here.

Ui action Visibility for the logged in user is Member RITM associated sc task assignment group

Rajesh Bandila
Tera Contributor

Hi,

 

I have created the UI action called "Acknowledge" on RITM table. now i want to make it this UI action available for only if logged In User is member of the RITM associated SC Task assignment group. I have tried by using below UI action Conditions, but it is not working as expected. Please let me know, how to archive this by using UI action condition.

 

gs.getUser().isMemberOf(current.sc_task.assignment_group.getDisplayValue())

gs.getUser().isMemberOf(current.assignment_group.toString())

 

Thanks & Regards.

Rajesh B

3 REPLIES 3

Slava Savitsky
Giga Sage

You cannot dot-walk from the RITM to the SCTASK because there is no reference field on [sc_req_item] table referencing [sc_task] table. Moreover, a RITM can have multiple SCTASKs. You need to write a function that would make a GlideRecord table against [sc_task] table, find the appropriate SCTASK record there and fetch its Assignment Group. Put that function into a Script Include and call it from the UI action condition.

Thanks @Slava Savitsky,

 

Could you please provide reference script for this? I didn't face this kind of requirement earlier. If you could you provide the script it will be more helpfull.

 

Thanks,

Rajesh B

I am afraid I don't have a reference script for this. In fact, with the guidelines I provided earlier, you should be able to implement the solution yourself. If you are not familiar with script includes, here is what you can do:

  1. Check out product documentation: Script includes
  2. Have a look at scripts from the base system. For example, conditions in "Refresh Impacted Services" UI action for [incident] table uses a function from "CIUtils" script include.
  3. Take a ServiceNow scripting course on Now Learning

Give it a try and if you have further questions, feel free to ask them here.