- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 01:11 AM
What about using a business rule instead with this code on insert/update?
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (current.invoice_no &&
(current.operation() == "insert" ||
(current.operation() == "update" && current.invoice_no.changes()))) {
var gr = new GlideRecord("table_where_invoice_no_is");
gr.addQuery("invoice_no", current.invoice_no);
gr.query();
if (gr.getRowCount() > 0) {
current.setAbortAction(true);
gs.addErrorMessage(gs.getMessage("Not allowed the duplicate invoice_no=" + current.invoice_no));
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 02:45 AM
Hi Tolga,
Its really amazing..super..it works perfectly like i wanted.
I Have one more requirement. Could you please help me on this,
i have one date field called invoice_date where i have one more field called day_s
where day_s has dropdown values like 10,15, 30 so on.
my result field = invoice_date + day_s
that is it has to add the days whatever there in the day_s field. and stored in my result field.
result field is a date field.
Is it possible? Do you have any idea?
Thanks in Advance,
Malaisamy Ji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 03:14 AM
Hi Malaisamy
I'm glad, my solution helped. May I please ask you to mark my answer as "correct", if it resolved your issue?
As you already opened a new thread on your additional question, I'd propose to discuss it there and closed this thread (as it is a different topic), if okay for you.
Best Regards
Tolga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 03:30 AM
Hi Tolga,
I have already marked as correct answer and helpful.
Please find my another issue here. I have raised one more discussion.
Please help me on this.
Malaisamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2016 03:30 AM