Difference between Postman and ServiceNow when sys_id is used. Why?

Suggy
Giga Sage

On the incident form, to populate the 'Assignment group' field, if I use the Name of the group in postman/rest API explorer, it works fine and udpate will happen.

 

dell11.png

 

but the same operation will not work if I make use of Business rule like (current.assignment_group= "Test Group");

In business rule, only if I pass the sys_id then it gets updated.

 

Note - 

if I write like this (current.assigned_to = "john viva"); ---- this work.... why not for assignment group?

 

How does it actually work? Why it differs from Business rule vs Postman/REST API explorer?

8 REPLIES 8

SuhasPSalunkhe
Kilo Guru

Best Practice -

To use sys_id of reference.

 

Reason - reference should be sys_id.

It is not working for business rule I guess there can be multiple group with same name. 

There is only 1 group with that name. Infact this scenario is happening for ALL the reference fields with 'Assigned to' as an exception. wondering why/how...

Robbie
Kilo Patron
Kilo Patron

Hi Suggy,

 

On close inspection of the REST API documentation, you'll notice you can use a flag to control whether to set field values using the display value or the actual value. The flag is: sysparm_input_display_value

This is however set to false by default. I would say this behavior will depend on which API you're using eg: Table API vs other vs your own scripted REST API. There's a lot of merit in using display values (where unique) as external systems will not always have access to ServiceNow sys_id's (not to mention the overhead of maintaining them).

 

When using API and integrations I'd also suggest leveraging transform maps and make use of staging tables so you can have full control of the data being passed and manipulate it if required. The staging table can also be used for 'temporary' auditing.

 

Business rules by contrast being internal and native to ServiceNow will only let you set a reference field by using the appropriate sys_id.

 

To help others in the community with the same or similar question, please can you mark my reply as correct and/or helpful.

 

Thanks,

Robbie

Hi @Robbie 

In REST API explorer, this is what I did (tried updating an Incident) with below 4 combinations

Suggy_0-1670956447562.png

 

Finally, in each of the above case, the incidnet got udpated with actual values for both the fields..... I dont see any difference in setting the field "sysparm_input_display_value" TRUE/FALSE.