- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 05:12 AM
Hi
I need to populate the Request form Priority field based on the Priority the requester selects. I have added the field as a variable and onto the form, however I cannot get it to populate based on the selection I made on the catalog item.
I have tried a Catalog Item Client Script onSubmit but then it only takes that field. I tried a onLoad Client Script on the sc_request table but fails to update the field.
I've also tried a Record Producer and mapping the fields together, however that doesn't follow the same Cart format I need from the other catalog items I have.
Looking on the community the catalog_item UI Macro could help but I'm not confident to update.
Any help please? A lot of posts but not specifically setting a form field based on a variable.
Thanks
James
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 08:05 AM
Hi
I've created a new workflow for this item and running a script during the workflow to populate the Priority.
var p = current.variables.priority;
var request = current.request.getRefRecord();
request.priority = p;
request.update();
This worked for me. Thanks for your help.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 07:14 AM
If its a Catalog Item, then do the population via a runscript activity in the Workflow. Remember that in a Workflow launched by a Catalog Item the following things are true.
- Current = the sc_req_item record (RITM)
- The sc_req_item record relates to Request via the request column
- Variables are stored with Current via current.variables.variable_name
- Task = whatever task a specific activity is using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 07:21 AM
Hi
Thanks, I was looking at workflow to get the results but couldn't get the priority to update. I'll give it another go. Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 07:29 AM
Before you tell a script to make one equal to the other, make extra sure that the choices for the Priority variable has exactly the same label and values as the Priority field on Request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 07:37 AM
Hi
Yes, I'm selecting the exact same choice list. Trying the below:
var p = current.variables.u_priority;
var request = current.request.getRefRecord();
request.priority = p;
request.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 07:42 AM
I'd go to background scripts and make sure you can accomplish what you want there first.
var foo = new GlideRecord("sc_req_item");
foo.get("sys ID of the RITM you're using for test purposes");
gs.print(foo.variables.u_priority);