Is it possible to generate multiple requests using record producer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 10:36 AM
We have a requirement for ess portal to submit multiple requests using one form. Not the OOTB.
So I created a Record Producer and having a UI Page called in a field. When I enter all the record producer fields and click 'Add to Cart' button(UI Page), it stores the information like the UI below. Now I want each row to be stored as Request item under one Request. So for example: 1 Request having 3 Request items.
Is this possible using record producer? or any other solution?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 10:46 AM
Hi Rajinis,
Whenever i want to create multiple request items from a single request I generally think of an order guide as a solution. In order guide you can refer to all the three request items above and use it based on a rule base or create it all at once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 11:26 AM
Yes, but we cannot use order guide here. As per the requirment, this should be simple one page form to generate multiple request items.
Trying to do this script: Record producer creates the request and request item, but request item form does not pull the request number. so, both forms are not tied to each other. Need help to fix this. Is something like this is possible?
current.setAbortAction(true);
var req = new GlideRecord('sc_request');
req.initialize();
req.short_description = 'something';
req.insert();
var items = document.getElementById("wrapper").rows.length;
for(var i=1; i<items; i++){
var reqitem = new GlideRecord('sc_req_item');
reqitem.initialize();
reqitem.request = req.sys_id;
reqitem.u_requested_for = req.opened_by;
//reqitem.u_requested_for.setDisplayValue(document.getElementById("wrapper").rows[i].cells[1].innerHTML);
reqitem.description = document.getElementById("wrapper").rows[i].cells[2].innerHTML;
reqitem.insert();
}
producer.redirect="RequestThankyou.do?sysparm_sys_id="+req.sys_id;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 11:42 AM
Hi Rajinis,
Can you make the below changes made in bold and try?
current.setAbortAction(true);
var req = new GlideRecord('sc_request');
req.initialize();
req.short_description = 'something';
var requestSys = req.insert();
var items = document.getElementById("wrapper").rows.length;
for(var i=1; i<items; i++){
var reqitem = new GlideRecord('sc_req_item');
reqitem.initialize();
reqitem.request = requestSys;
reqitem.u_requested_for = req.opened_by;
//reqitem.u_requested_for.setDisplayValue(document.getElementById("wrapper").rows[i].cells[1].innerHTML);
reqitem.description = document.getElementById("wrapper").rows[i].cells[2].innerHTML;
reqitem.insert();
}
producer.redirect="RequestThankyou.do?sysparm_sys_id="+requestSys;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2016 12:11 PM
You are awesome! But, I did the other way.
Record Producer- script was not creating the request items, it created only the request. So, I moved the above script to onSubmit client script of the form.
Now it generated request item within request. IT WORKED.
Now how can I redirect the form to thankyou page?