- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2024 11:37 PM
Hello,
I have been trying to update the RITM work notes. Somehow, the script did not work. Please help review the code and provide suggestion to fix it. Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2024 11:48 PM - edited 04-14-2024 11:56 PM
Hi Annie, what sort of debugging have you done? Have you checked that the script is actually entering the if-statement? To me it looks like that is your issue. When you look at the Approval field that you're accessing on your RITM within your code, you'll see that the value for the sys_choice "Not Yet Requested" is "not requested". So your script should be comparing that instead.
Also, since your business rule is a before type of business rule, your script should not call .update() within it:
var approvalStatus = current.approval;
if (approvalStatus == "not requested") {
current.work_notes = "This request item has not been reviewed";
}
Also, small PSA, but please try and include code/errors as text in your question, not as images. You can format your code so it's easy to read. When it's included as text, it makes it easier for us to copy your code into our answers. You can see this post for more reasons why it's not a good idea to include code as an image.
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 07:09 AM
Thank you @Nick Parsons
I have learned something new today.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2024 11:56 PM
Hi @Annie10
can you please tell when you want to update your RITM worknotes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2024 11:58 PM
Hi @Annie10 ,
Please try to remove current.update(), because your Business rule is before and in before BR there is no need to update.
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 12:27 AM
@Community Alums
Please let me know if a Business Rule is after, it that means I can use current.upda()? Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 12:33 AM
Hi @Annie10 ,
In Business rules it is not allowed to use current.update(), if you use current.update() in after BR than in that case it will running in a loop.
But in Before BR there is no need to write update, it updates automatically
In rare case you want to use current.update() in after BR you can refer below script
current.status = 1;
current.setWorkflow(false);
current.update();
current.setWorkflow(true);
You need to do current.setWorkFlow(false);
I hope my explanation helps you.
Please mark my answer correct and helpful if it works for you
Thanks and Regards
Sarthak