- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:14 PM
I have a table (u_windows_upgrade)
That has 4 columns
The first 3 are reference
u_user
u_computer
u_entity
The last is a choice
u_replace_or_upgrade
It is being populated by an excel upload
That part is fine
I have a catalog item with the sys_id
(function executeRule(current, previous /*null when async*/) {
createRequest();
function createRequest() {
//Create Request
var cart = new Cart();
//substitute your cat item
var item = cart.addItem('c0e114071b704e10ed9711f72a4bcbd0');
//Set Variables in your Cart Item
//substitute your req for
cart.setVariable(item, 'primary_contact','source.u_user.getvalue');
cart.setVariable(item, 'computer_name', 'source.u_computer');
cart.setVariable(item, 'is_this_a_replacement_or_windows_upgrade', 'source.u_upgrade_or_replace');
cart.setVariable(item, 'Entity', 'source.u_entity');
var rc = cart.placeOrder();
cart.description = 'Test';
var rc = cart.placeOrder();
gs.addInfoMessage('Request Item Created: ' + rc.number);
}
})(current, previous);
This is creating the request, and the catalog items fine. My name is showing up as the opened_by and the catalog item is correct and producing the correct tasks for the item
It is NOT however populating the variables with the information in the columns on the table...
I'm sure it's something super obvious but i have been looking at this for hours and cannot for the life of me figure it out. Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:34 PM
Just a placeholder.. sorry i thought i had added that at the bottom.
Where i have the items in '' are the names of the columns in the table. i have tried tablename.fieldname
current.fieldname
source.fieldname
so many different things.. none working.
Was hoping that was what someone could tell me - what I should be putting in those "source.fieldname" spaces.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:21 PM
what is source in your code and why it is quotes? for example 'source.u_upgrade_or_replace'?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:34 PM
Just a placeholder.. sorry i thought i had added that at the bottom.
Where i have the items in '' are the names of the columns in the table. i have tried tablename.fieldname
current.fieldname
source.fieldname
so many different things.. none working.
Was hoping that was what someone could tell me - what I should be putting in those "source.fieldname" spaces.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:43 PM
When you look at record XML from u_windows_upgrade table, do you see field names, reffered in the code
Should be like current.u_user.toString()
Also you have cart.plceOrder() twice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 01:37 PM
Apparently all i needed to do was post and then i was able to resolve it... sigh (I missed a t out in a word)