Record Producer - How do we update the same case, after adding additional items from the form?

Shubha2
Mega Guru

Hi All,

I need your help with the scenario below:

  1. User fills the form - Record producer does this - This is Working
  2. A case is created - Fields are filled - Working perfect
  3. New requirement - Notification should be sent with an link to the user asking for more information. Something like this: If you have any updates or additional details about your case to share with us, please use this link ____    - I will create a notification with this link
  4. New Requirement  - User should be able to fill some more Information like adding Items on the form and after submitting the Same Case  gets updated with the Information.

 

Questions:

  1. Can the link lead to the same Record producer form? - Need help how to programmatically achieve this, if possible.
  2.  Or should I create another record producer? How does the new record producer update  Same case?
  3. Or any other suggestion? Basically user has to enter some more Items and information  to the same case

 

Your help would be really appreciated.

Thank you

Shubha

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Shubha2 No need to create a new record producer for this. This requirement can be implemented using the following ways.

1. In your notification, you need to provide the URL of your record producer e,g, https://devxxx.service-now.com/esc?id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9 

2. In the above URL you need to add one more parameter which will represent the sys_id of your case e.g.

https://devxxx.service-now.com/esc?id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9&sysparm_ca...

3. Create an onLoad Client script on your record producer and parse the URL parameters with the help of following references.

https://servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/

https://www.servicenowelite.com/blog/2019/7/31/parameters-with-catalog-items

4. Once you extract the value of case sys_id, you just need to Make a GlideAjax call to your script include method to fetch all the values related to that case. 

https://www.servicenow.com/community/developer-articles/client-side-scripting-go-for-glideajax-with-...

5. Populate the values fetched from Script include using g_form.SetValue('field_name', answer.field_value) within the onLoad client script;

 

Hope this helps.

 

 

View solution in original post

5 REPLIES 5

Sandeep Rajput
Tera Patron
Tera Patron

@Shubha2 No need to create a new record producer for this. This requirement can be implemented using the following ways.

1. In your notification, you need to provide the URL of your record producer e,g, https://devxxx.service-now.com/esc?id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9 

2. In the above URL you need to add one more parameter which will represent the sys_id of your case e.g.

https://devxxx.service-now.com/esc?id=sc_cat_item&sys_id=3f1dd0320a0a0b99000a53f7604a2ef9&sysparm_ca...

3. Create an onLoad Client script on your record producer and parse the URL parameters with the help of following references.

https://servicenowguru.com/scripting/client-scripts-scripting/parse-url-parameters-client-script/

https://www.servicenowelite.com/blog/2019/7/31/parameters-with-catalog-items

4. Once you extract the value of case sys_id, you just need to Make a GlideAjax call to your script include method to fetch all the values related to that case. 

https://www.servicenow.com/community/developer-articles/client-side-scripting-go-for-glideajax-with-...

5. Populate the values fetched from Script include using g_form.SetValue('field_name', answer.field_value) within the onLoad client script;

 

Hope this helps.

 

 

Hi Sandeep,

Thank you so much for the solution. From your solution, Second step of adding sys_id of my case to the URL gave me little bit hard time but finally I got it right. It works the way we wanted to be. Really appreciated your help. WOW! that was amazing. It worked!! 

Thanks again

Shubha

I am glad to know that it worked for you 🙂

Amit Gujarathi
Giga Sage
Giga Sage

Hi @Shubha2 ,
I trust you are doing great.

o programmatically achieve this, you can create a new UI Action on the form that the user fills out. This UI Action will create a new record producer instance with a different variable set, which will allow the user to add more information to the case. You can then add the link to this new record producer instance in your notification.

Alternatively, you can create a new record producer specifically for adding more information to the case, and then link to that record producer in your notification. When the user clicks on the link, they will be taken to the new record producer form where they can add the additional information.

If you choose the first option, you can use a script like this to create the new record producer instance:

var rp = new GlideRecord('sc_cat_item_producer');
rp.newRecord();
rp.cat_item = 'your_cat_item_sys_id';
rp.variable_set = 'your_variable_set_sys_id';
rp.insert();
var url = gs.getProperty('glide.servlet.uri') + rp.getLink(true);
gs.addInfoMessage('Here is the link to add more information: ' + url);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi