Update business rule works but insert does not on sc_request

chiragpathak
Tera Contributor

Hi Community,

I have a requirement in which we have to populate a field owning system which is a reference field on task and is on user table and sc_request form so I had to populate that in owning system on sc_request based on requested_for user's owning system but it was updating opened by's owning system when the business rule was before insert but the moment I checked update also it started working what I mean it is now updating requested_for's owning system after selecting update could someone tell me why?

 

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@chiragpathak 

unless you share the business rule scripts and screenshots, we can't help much.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

chiragpathak_0-1751450475611.png

chiragpathak_1-1751450554097.png

The part of code I highlighted works only when the business rule has update and does not work when only insert is selected

@chiragpathak 

may be during insert requested_for is not populated

Did you check by adding logs and see?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 

Yes I did add logs and check and before insert its retrieving the sys_id of user who is in opened_by field of the request as well as the u_owned_system sys_id is of the company of the opened_by user. After changing it to before insert and update it is showing the right sys_id which are expected.