- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2023 12:36 AM
Hi,
I have a bit complicated scenario. Can someone please guide me.
There are 3 custom tables.
1. Tracker:- contains tracking details of a particular shipment
2.Supply:- contains supply details that is coming on the shipment
3.inventory: contains all the asset details
I have a UI action 'Approve' on 'tracker' table. Also I have a relationship created with 'tracker' table and 'supply' table.
So If Approver click on UI action the records in Supply table that are related with Tracker table should get inserted to 'inventory' table with status 'in stock'.
Please guide me
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2023 05:41 AM
Hi @mp_10 ,
Hope you are doing well.
Please refer to the script below for your requirement.
var getSupply = new GlideRecord("your supply table");
getSupply.addQuery("your field name",current.sys_id);
getSupply.query();
while(getSupply.next()){
var createInventory = new GlideRecord("your inventory table");
createInventory.initialize();
createInventory.status = "in-stock"
// do the remaining mapping
createInventory.insert();
}
You would need to adjust the script for your requirement.
Please Mark My Response as Correct/Helpful based on the Impact
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2023 05:41 AM
Hi @mp_10 ,
Hope you are doing well.
Please refer to the script below for your requirement.
var getSupply = new GlideRecord("your supply table");
getSupply.addQuery("your field name",current.sys_id);
getSupply.query();
while(getSupply.next()){
var createInventory = new GlideRecord("your inventory table");
createInventory.initialize();
createInventory.status = "in-stock"
// do the remaining mapping
createInventory.insert();
}
You would need to adjust the script for your requirement.
Please Mark My Response as Correct/Helpful based on the Impact
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 02:14 AM
Hi Harshal,
Thank you so much. This solution worked and I could insert record.
I have another question too.. My inventory table fields are choice(dropdown). So while inserting details from supply table new values are getting created. I am attaching the screenshot for your reference. Is there any way to correct this?
All the dropdown fields in inventory table populated similarly with extra options taken from supply table. I have entered the same Label names to supply table. (New values didn't create when I gave values instead of labels, but can not go with that option)
Thank you so much for you time and inputs..