- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2017 04:45 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 03:33 AM
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:
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
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2017 08:12 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 03:06 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2017 09:22 AM
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:
In order to view this Navigate to Script Include Module under System Definition and Search for Name =RMUIActionHelper as shown below:
Or you can directly click on this below link:
Replace "instance" with your Instance Name in the above URL.
Hope this helps.Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 03:04 AM
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.