- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 05:45 PM
Hi Team,
I have fields ("u_affected_contact"), ("u_requestor") & ("company") in the sc_request table. I have a business rule to check if the ("u_affected_contact") field is empty. I am not 100% confident with the syntax and i would like help with it.
The company field basically populates itself based on the ("u_affected_contact").
What i want to do --->
- Check if ("u_affected_contact") is EMPTY
- If EMPTY, then ("company") should be populated based on ("u_requestor") -- ("u_requestor" --> company)
- ELSE do nothing
All help is appreciated.
Thank you!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 05:55 PM
You are running BR on sc_request, so there is no need of creating another object of sc_request. "current" is your current object. Script will go something like below
if(current.u_affected_contact.nil()){
gs.log(" I am Here");
current.company = current.u_requertor_company
}
more on nil()
GlideElement - ServiceNow Wiki
Mark your feedback( Like or Helpful or Correct) as per the impact of my response. Cheers!
Vab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 05:48 PM
Change the IF line to
if (gr.u_affected_contract.nil())
then try it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 05:54 PM
Hi Michael,
I gave it a try but still no result. I am not seeing the alert pop-up!
Got any other ideas?
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 06:03 PM
vab.13 - nice catch on the table.
And just so you know, Alert can't be used in a business rule, just client script. gs.log would be best.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2017 05:55 PM
You are running BR on sc_request, so there is no need of creating another object of sc_request. "current" is your current object. Script will go something like below
if(current.u_affected_contact.nil()){
gs.log(" I am Here");
current.company = current.u_requertor_company
}
more on nil()
GlideElement - ServiceNow Wiki
Mark your feedback( Like or Helpful or Correct) as per the impact of my response. Cheers!
Vab