How to set new value in a reference field?

Jessica28
Tera Guru

Hello,

 

We need help on how to add a new value "Barcode Number Not Listed" to a reference value in Service Request when a form is loaded.  We have attached a photo for your review.  Thank you so much for helping. 

 

1 ACCEPTED SOLUTION

Hi Jessica,

As the requester will not find the unavailable barcode number, he will understand that the barcode he is trying to find is not available in the back end, hence I think you don't need to show a special error message for this. We cant show the error message here since there is no trigger point for this.

Now to add the record in real time to the backend:

1. You can create a new record producer for adding the new record o the backend "Barcode" table.

2. Get the link of this new record producer

3. Create a new label type variable in the current service request form below "Barcode Number" field and give the message as "Click on this link if the barcode you are trying to find is not present" [The link will open in new tab]
4. Once the requester submits the record producer then give the message on the form as "Please go back to your service request and try to search the barcode again"

Please mark the answer correct if my explanation helps you. 🙂

Thanks. 🙂

View solution in original post

5 REPLIES 5

Claude DAmico
Kilo Sage

A reference field will only populate an existing record in the referenced table. You could just create a record that contains what you want it to be as a placeholder when the actual record to reference cannot be found. Will that suffice?

Claude E. D'Amico, III - CSA

Tony Chatfield1
Kilo Patron

Hi, client and server side scripting offers the addInfoMessage() addErrorMessage() methods for adding a message to your form, client side you can also use showFieldMsg() to set a warning below a field

//developer.servicenow.com/dev.do#!/reference/api/sandiego/client/c_GlideFormAPI#r_GlideFormHideAllFieldMsgs?navFilter=showfieldmsg

Hi Tony,

Could you please provide suggestions on how to handle this situation. 

Each CPU barcode number is assigned to each employee. If for some reason PC barcode number is not shown in the drop down. (See attachment)

 

I would like to shown a message "Barcode Number Not Listed" and provide a text box for them to enter the barcode.  If that is possible, could you provide step by step on how to do it.

 

Thank you

 

Hi Jessica,

As the requester will not find the unavailable barcode number, he will understand that the barcode he is trying to find is not available in the back end, hence I think you don't need to show a special error message for this. We cant show the error message here since there is no trigger point for this.

Now to add the record in real time to the backend:

1. You can create a new record producer for adding the new record o the backend "Barcode" table.

2. Get the link of this new record producer

3. Create a new label type variable in the current service request form below "Barcode Number" field and give the message as "Click on this link if the barcode you are trying to find is not present" [The link will open in new tab]
4. Once the requester submits the record producer then give the message on the form as "Please go back to your service request and try to search the barcode again"

Please mark the answer correct if my explanation helps you. 🙂

Thanks. 🙂