- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 12:56 AM
Hello Guys,
Can anyone please point me in the right direction
Note : We have a MRV- Equipments and the values are stored in Custom table
We have developed a functionality to resubmit the catalog item with additional data and we are loading the previous values submitted earlier by the user and also Auto populating the MRV's data from the Custom table when the user selects "Resubmit existing order"
Now the Client requirement is, when ever the data in the MRV"s is Updated, added or deleted the corresponding record in the Custom table should be updated, added and deleted.
Can anyone please point me in the right direction to achieve this please?
Any suggestions will be highly appreciable!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 02:15 AM
Hi,
once catalog item is submitted in workflow run script do this
1) get the MRVS json
2) iterate it for every row
3) query your custom table with correct fields
4) determine if the row is new or existing
5) if new then insert, if existing then update the fields
6) compare the recently submitted MRVS JSON with the earlier JSON and accordingly delete the record
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 01:47 AM
Hi,
You can achieve that in two ways:
1. You can create a hidden multi-text variable in the cat item/record producer form and store the prev value of MRVS and on submit you can compare the previous value with new value.
2. Create an extra field(drop-down) in MRVS to capture the update/delete/add
=>instead of actually deleting they will manually change to remove from the drop-down.
=>Auto-populate "Add" for Add operation in MRVS.
=> Auto-populate "Updated" if they are updating the existing field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 02:06 AM
Hi Manisha,
The first solution seems to be not ideal in my case
can you please elaborate more on 2nd solution u have shared
basically i want to add, update or delete the custom table records for the corresponding add/update/deletion of MRV's data
Please help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 02:12 AM
Any suggestions will be highly appreciated!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2022 02:47 AM
Hi,
Why the 1st option is not feasible for you. I believe that is the best option, you need to just compare two JSON, and based on that you can identify which one is edited/added/removed
The second option can be done in the following steps:
1. You can create one more field in MRVS, (that field will be visible in the MRVS table).
2. Add three options in that field (Add, Delete, Update).
3. If someone clicks on Add button of MRVS (it means all the fields will be empty), auto-populate the new field with ADD option and make the field read-only.
4. If someone is editing the existing record by clicking on the pen icon, auto-populate the new field with the UPDATE option and make the field editable.
5. If someone has to delete the record, ask them not to delete directly from the table, but to click on edit pen icon and select the DELETE option manually.
6. Based on these new field values, you can understand which one is edited/deleted/added.