Which business rule/script include triggers the creation of Resource Allocations for a Resource Plan?

vangmayeec
Kilo Contributor

When we click the 'Confirm' or 'Confirm and Allocate' button on 'Resource Plan' form, 'Resource Allocations' are automatically created in the 'resource_allocation' table. I would like to know which business rule/script include or any other action that is responsible for this functionality.

1 ACCEPTED SOLUTION

Hi,



Records for Resource Allocations are getting inserted using the UI Action code only where initially it's querying the "Resource Plan" table and checking for the state field on the Resource Plan using the Script Include "ResourcePlanState" which is calling again a script Include "ResourcePlanStateChangeHandler" . If the State of the Resource Plan is changed to "Allocated" and if a match is not found for the same record in the Table, using the below line it's inserting the Record into the Allocated Module:



updatedRecord.update();



The same Operation works for other Table also say for Example I have created a UI Action named "Create task" on the Incident Table with the same code as that present in "Confirm and Allocate" UI Action to create Incident Task if it is not present. Refer the screen shot below:



find_real_file.png


So once I click on this button, it checks if a Record is there on the Incident Task Table or not, if it is not there it creates a new Record.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

6 REPLIES 6

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Just go to Business Rule and add a filter condition on table being resource_plan, like:



https://<yourinstance>.service-now.com/sys_script_list.do?sysparm_query=collection%3Dresource_plan



Script includes are usually called from business rules.


Hi Sergiu



I don't need all the business rules acting on the resource plan table. I need one specific business rule that is responsible for creating Resource Allocation records.


shloke04
Kilo Patron

Hi,



When you click on the button "Confirm and Allocate", this UI Action basically calls a script Include named "RMUIActionHelper" and the function "canConfirmAndAllocate()" which creates the Allocation records as shown below:



find_real_file.png



In order to view this Navigate to Script Include Module under System Definition and Search for Name =RMUIActionHelper as shown below:



find_real_file.png



Or you can directly click on this below link:



https://instance.service-now.com/sys_script_include.do?sys_id=32136c4f9370020064f572edb67ffb8a&syspa...



Replace "instance" with your Instance Name in the above URL.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi Shloke



In the RMUIActionHelper call you have highlighted, it is only checking for roles. I couldn't find the actual code that is used to create Allocation records.