- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 01:53 AM
Hi everyone,
i have a business rule with a function which insert records into a table. Now i want to achieve determine on which operation triggers the business rule it should be decide between two different behaviors:
if(current.operation() == "update") {
// delete current record and then insert with code in function getTimeDiff(); }
if(current.operation() == "insert") {
getTimeDiff(); }
I have wrote the behavior as a comment into the code.
Please let me know how can we accomplish this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 03:37 AM
Hi Dape,
You can try the code something like this:
if(current.operation()=="update")
{
current.deleteRecord();
getTimeDiff();
}
else
if(current.operation()=='insert')
{
getTimeDiff();
}
Please mark this answer correct if it resolved the query and mark it helpful too if it helped you at all.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 03:37 AM
Hi Dape,
You can try the code something like this:
if(current.operation()=="update")
{
current.deleteRecord();
getTimeDiff();
}
else
if(current.operation()=='insert')
{
getTimeDiff();
}
Please mark this answer correct if it resolved the query and mark it helpful too if it helped you at all.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 05:39 AM
Hi dape,
I saw you have marked my answer as correct. I am glad it worked for you, it will be great if you can mark the answer as helpful also.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)