Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to autopopulate user's company

sri001
Tera Expert

Hi All, How to autopopulate user's company based on opened for user once submit the request from employee center.

 

sri001_0-1713980475847.png

 

3 REPLIES 3

Vishwa Pandya19
Mega Sage

Hello,

 

You can write a before Insert BR for this.

 

If my answer helps you in any way please mark it as correct or helpful.

Hi @Vishwa Pandya19,

 

Can you please help me with BR

Regards,

Bhagya 

Community Alums
Not applicable

Hi @sri001 ,

You can write this BR (can use Async BR)-

(function executeRule(current, previous /*null when async*/) {
var openedForUser = current.opened_for.user; 
if (openedForUser) {
var company = openedForUser.company;

current.company = company;
}
})(current, previous);

Mark my Answer Helpful or Accept Solution if it resolves your issue.