- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 12:00 AM
@Ankur Bawiskar @Community Alums @Sohail Khilji @Maik Skoddow
Please help me with the script on attached sceenshot if budget number field & vendor account field value are equal the I need to mark the status value as Closed
please help me with the script please
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 12:24 AM
Hi @ARAVINDA11 ,
Create a before update or insert business rule
Condtion :
if Budget number changes
or Vendor number changes.
Advance Script :
if (current.u_budget_number == current.vendor_account) {
current.status = 'success'; // set the field value here
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 12:15 AM
it's an easy one.
you can use before update/insert BR and write script
what did you start with and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 12:19 AM
Hi @ARAVINDA11
try the below code.
var gr = new GlideRecord("tablename");
gr.addQuery("budgetnumberfield", 1);
gr.addQuery("vendor account field ", 1);
gr.query();
if (gr.next()) {
gr.status= 'closed'; // add bacend value of closed
gr.update();
}
Thanks
dgarad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 12:24 AM - edited 05-23-2024 12:26 AM
Hi @ARAVINDA11 ,
Please create Before Business Rule and select your appropriate table and check insert/updated as per your requirement and add below code
var vendor = current.getValue('vendor');
var budget = current.getValue('budget');
if(vendor == budget){
current.setValue('status', 'Closed');
}
Note: Please give the backend name of field for Vendor, Budget and Status.
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
05-23-2024 12:24 AM
Hi @ARAVINDA11 ,
Create a before update or insert business rule
Condtion :
if Budget number changes
or Vendor number changes.
Advance Script :
if (current.u_budget_number == current.vendor_account) {
current.status = 'success'; // set the field value here
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....