How to fetch current value of the field in the Widget

Shubham_1120131
Tera Contributor

Hello Everyone, 

 

I am trying to develop a Service Catalog, where in the portal along with the "Name" and "Short Description" field. I also want to display the value of the "Qty Available in Stock" field from "sc_cat_item". This is a custom field created by me and I want to show the user how much stock is left for them to order from.  How can I achieve this and what modification I would have to do in the SC Catalog Item widget to show the user the current value for the field in catalog item. 

 

Shubham_1120131_1-1719255922879.png

 

Here I have hard code the value, In order to show what I am trying to achieve. 

Shubham_1120131_0-1719255888853.png

 

I appreciate anyone taking out their valuable time to answer my question. 

Best Regards, 

Shubham 

 

5 REPLIES 5

Dnyaneshwaree
Mega Sage

Hello @Shubham_1120131 ,

Check this if relatable:
https://docs.servicenow.com/bundle/washingtondc-platform-user-interface/page/build/service-portal/ta...

If my solution helps you any way then mark it as accepted and helpful.

Thank You!!

 
Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Hello @Dnyaneshwaree,

Thank you for sharing this post with me. I am unable to find the part for fetching the value from the ServiceNow instance in this post. I want to fetch the value for my custom field and display it in real time to the user who will be using Service Portal. 
Please let me know if you would like me to elaborate my problem. 

Thank you for giving your valuable time to my question. 

Best Regards, 
Shubham 

VaishnaviShinde
Kilo Sage

Hello @Shubham_1120131 ,

 

The custom field Qty Available in Stock contains available items? Do you stored that field's value in backend anywhere? Can you provide some more details So I can help you.

 

If my response helped you, please mark it as accepted solution and helpful. 

 

Regards,

Vaishnavi 

Hello @VaishnaviShinde

Thank you for answering my question. Yes Qty Available in Stock is a custom field created by me. I am using this field in the sc_cat_item table to store the value of the stock (Integer field). Now I want to display this value to the user. So that while they are placing an order for something they can see the available stock for the equipment. For example. if the mobile team wants to order 100 mobile phone but we have only 90 in stock. By making stock available on the portal. They will be aware that they can't place order for 100 phone since we only have 90 in stock. 

I would really appreciate if you can help me with this customization for the SC Catalog Item widget. 

Best Regards, 
Shubham