- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Record Producer redirects to form — record created only after clicking Update?
Question:
Hi everyone,
I’m working with a Record Producer in ServiceNow to create records in a custom "Leave Request" table.
Here is what I am observing:
When I submit the Record Producer, it appears to save successfully.
After submission, it redirects me to the form view of the record.
On this form, I see an Update button instead of a Submit button.
It seems like the record is only actually added to the table after I click the Update button.
My expectation was that the record should be inserted immediately upon submission of the Record Producer.
Is this expected behavior, or am I missing something in my configuration (such as script logic, setAbortAction, or redirect settings)?
Any clarification would be appreciated.
Thanks in advance!
👇 My Record Producer
👇 Its Redirection
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
this happens all the time or sometimes
happens with admins or non-admins?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hey @themadhankumar
Please share your Record Producer script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
as soon as record producer is submitted the record should get created
any script is stopping it?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
current.u_employee = gs.getUserID();
var leaveBalance = new GlideRecord('u_leave_balance');
leaveBalance.addQuery('u_employee', gs.getUserID());
leaveBalance.query();
if (leaveBalance.next()) {
var totalLeaves = leaveBalance.u_used_leaves;
var usedLeaves = leaveBalance.u_used_leaves;
var remainingLeaves = totalLeaves - usedLeaves;
var fromDate = new GlideDateTime(producer.u_from_date);
var toDate = new GlideDateTime(producer.u_to_date);
var diff = gs.dateDiff(fromDate.getDisplayValue(), toDate.getDisplayValue(), true);
var days = Math.ceil(diff / (24 * 60 * 60)) + 1;
if (remainingLeaves >= days) {
current.u_number_of_days = days;
current.u_status = 'Pending';
} else {
current.u_number_of_days = 0;
current.u_status = 'Rejected';
gs.addErrorMessage("Not enough leave balance");
}
} else {
current.u_number_of_days = 0;
current.u_status = 'Rejected';
gs.addErrorMessage("Leave balance record not found");
}and I have done the following in sequence and I have documented along side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
this happens all the time or sometimes
happens with admins or non-admins?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader