Business Rule Script on Insert to paste a link to the new record in to a field

carlh
Kilo Guru

Good morning,

I need help with a script.  

Vendor records are created in ServiceNow on "core_company" and each night a process runs to sync with our accounting system.   I've been asked to provide a link to the newly created record in a new field.

What kind of field would I need to add to be able to do this?   URL or String?

The idea is that with this link, we will be able to access ServiceNow from the accounting system quickly.

Here's the script I need.

Table: core_company

When:   Before

Insert = True

When record is inserted, add a link to the current record to the record link field.

Hope this makes sense and someone can get a quick "correct answer"

Thanks in advance for the time and help!!!

Carl

1 ACCEPTED SOLUTION

Create a before insert business rule and put this code in there



current.<field name>= 'https://'+ gs.getProperty('instance_name') + '.service-now.com/' + current.getTableName() + '.do?sys_id=' + current.sys_id;


View solution in original post

9 REPLIES 9

Create a before insert business rule and put this code in there



current.<field name>= 'https://'+ gs.getProperty('instance_name') + '.service-now.com/' + current.getTableName() + '.do?sys_id=' + current.sys_id;


I missed something...



find_real_file.png


Abhinay Erra
Giga Sage

it should be current.u_vendor_link=.......; remove <>


I actually figured that out myself!!!   Learning from you abhi_r and ctomasi   !!!!



thanks both as always!


Abhinay Erra
Giga Sage

You are welcome.