Excelファイルのassigned_toのnameの値をsys_idの値に変換したい

izanacart111
Tera Contributor

Excelファイルのassigned_toのnameの値をsys_idの値に変換したいんですが以下の流れで可能でしょうか。
1、ServicenowAPIを使用してsys_userテーブルにアクセスする

2、assigned_toの名前と一致するsys_userレコードを検索

3、もしあればsys_userレコードからsys_idを取得

4、Excelでassigned_toのnameの値に対して、sys_idを上書きする

 

文章でわかりづらいと思うので、簡単なチャートを作りました。画像を確認ください。

 

目的としては、同じ名前の人がいると、インポートした時どちらの人がレコードに挿入されるかわからないので、
インポートする前に被らないsys_idに変換しときたい。

最後に、
1、この流れが可能かどうか
2、もし可能なら助けていただけると嬉しいです。image0.jpeg

5 REPLIES 5

Tai Vu
Kilo Patron
Kilo Patron

Hi @izanacart111 

May I ask are you're trying to export or import the data?

If it's the Export case, you can leverage the SNUtils which will help to pull out the Assigned to Sys ID field on the list. And you will be able to retrieve it.

Sample below.

TaiVu_1-1698832132974.png

TaiVu_2-1698832146339.png

 

 

Cheers,

Tai Vu

 

 

 

izanacart111
Tera Contributor

@Tai Vu 
さんメッセージありがとうございます!
■import data or export data 
これはimport dataです。
ですので、assign_toのnameからsys_idに変換後、import sets でimportする予定です。

■SNUtills
SNUtillsというのをはじめて知りました。
実際に使ってみましたが、assiged_to.sys_IDをリストビューに表示することはできておりません。
手順を教えて頂けませんか?

Hi @izanacart111 

If you've interest about SNUtils, you can have a look to the below link.

SN Utils with Arnoud Kooi - Did You Know

 

There's an alternative as well, you can export as XML then just Open With Excel

Screenshot 2023-11-02 at 10.04.24.png

 

Regarding Import data, you can control how a Reference field will map with your input from your Excel.

In the Transform Map you're using to load data, under related list Field Maps > open the field Assigned to > update the Referenced value field name to match with the value from the Excel file.

It can be Email [email], User ID [user_name], etc.

TaiVu_0-1698894703976.png

 

Cheers,

Tai Vu

 

 

 

 

 

 

newhand
Mega Sage

@izanacart111 

APIでnameをsys_idに変換する際、同様な問題(同名な人がいる)でどのsys_idに変換するのか自動判定はできないと思って、結局は手動で判断したりする必要です。

 

name+αで一意的に人を特定できるなら、大丈夫ですけど。。

 

 

 

 

 

Please mark my answer as correct and helpful based on Impact.