- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 05:19 AM
Hi @chitra1
Approval Conditions Not Met
* Check Logic: Scrutinize the conditions on your approval activity. Ensure the conditions under which the approval should trigger are actually being met in your specific scenario. Review the script carefully to ensure that it correctly calculates the due date and sets the workflow to false.
* Data Discrepancies: Double-check that the values of the relevant fields (e.g., delivery_time, due_date, any fields used in conditions) are accurate and as you expect them to be.
2. User Criteria Not Satisfied
* Approval User: Verify that the answer variable in your script is correctly identifying the intended approver's sys_id. Use background scripts or log statements to confirm the value of answer before the approval activity. Ensure that the fallback approver's user ID is valid.
* Group Manager: If you're using group-based approval, ensure the selected group has a valid manager assigned in ServiceNow.
* Approver Permissions: Make sure the approver has the necessary roles and permissions to view and act on approval tasks.
Approval Activity order
Ensure you have an approval activity order in place
Background Script
check wth background script
var gr = new GlideRecord('sc_task');
gr.get('sys_id', 'your_task_sys_id'); // Replace with actual sys_id
var intDuration = gr.cat_item.delivery_time.dateNumericValue();
gs.info("Delivery Time: " + intDuration); // Check delivery time
// ... (Rest of the due date calculation logic) ...
gs.info("Calculated Due Date: " + gdtDueDate);
gs.info("Approver: " + answer); // Check calculated due date and approver
If you like this solution. Please kindly mark this as your best answer and help to contribute more to this community