We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Script for getting value of sys_id and Supplier Name

GwynethPhoS
Tera Contributor

can anyone help me create a script that will get the value of sys_id and name of supplier.

 

I have a catalog item that requires the name of supplier, and it should reflect in the company table. the supplier's name variable is a single line text type. It should create a new company record on catalog item submission and prevent duplicate supplier names. I already tested it in flow using the create record action and it reflects in the company table, and I also created custom fields because the other variables are not available in the company table.  What is best recommended for this case? Should I just stick to Flow Designer or make a script? and what kind of script? 

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@GwynethPhoS 

if your catalog item has flow associated to it then use Flow only

what did you start and where are you stuck?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Aditya_hublikar
Mega Sage

Hello @GwynethPhoS ,

 

If you already use flow designer for this then go with that only instead of creating any new script on req or

ritm .After creating new record in supplier table by flow if you want its sys_id then you can refer lookup record as per your need/requirnment , you will get there .

 

If this helps you then mark it as helpful and accept as solution.

Regards,

Aditya

Hello @GwynethPhoS , 

 I hope you are doing well . Does my response helps you ?

 

If my response helps you then mark it as helpful and accept as solution.

Regards,

Aditya

DiveshTyagi
Mega Guru

Hi @GwynethPhoS  , 

For catalog-driven record creation like this, Flow Designer is the preferred and supported approach in ServiceNow. It’s easier to maintain, upgrade-safe, and readable for admins who may support this later.

However, to prevent duplicate supplier (company) records, you should add a lookup step before Create Record. You only need scripting if you want tighter control or reusability.


-------------------------------------------------------------------------------------------------------------------------------------------------

If my response helped, please mark it as the accepted solution so others can benefit as well.

Regards,

Divesh Tyagi