Catalog Item Macro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2014 07:18 AM
Hello Community,
I believe this would be something simple that i'm overlooking but I haven't found it yet. On a Catalog Item, I had a reference field to the sys_user table to indicate who the Request was for. We utilize the 2 step checkout so even though that field was populated with a name, the end user would have to enter the name again on the second page of the checkout. So, to resolve that problem, I decided to add the Macro to the Catalog Item that already exists on the second page of the checkout.(sys_display.sc_cart.requested_for). I have another reference field on the same Catalog Item. When I populate field1 with a value, I want it to trigger an onChange Client Script and populate field2(the Macro). The problem is, this isn't working with a Macro variable type. It works from one reference field to another but not for the Macro field. Any suggestions?
Currently, my onChange Client Script is below...
function onChange(control, oldValue, newValue, isLoading) {
var person1 = g_form.getValue("field1");
g_form.setValue("field2", person1);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2014 05:18 AM
I abandoned my efforts due to time constraints.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2014 05:31 AM
No worries Kenneth.
If you do look at it again, I'm happy to assist you with modifying my script to suit your purposes.
Regards,
Jake

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2014 11:41 PM
to validate the value enter in the ui macro , i guess you need to use a script and glide record and manually validate the value ... API wont work as per my knowledge
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2014 04:51 AM
if you are interested in a slightly different method ...
try setting this as an on change client script inside the item... set it to change based on the requested_for and only apply to catalog items.
function onChange(control, oldValue, newValue, isLoading) {
if (newValue){
var gr = new GlideRecord('sc_cart');
gr.addQuery('user', g_user.userID);
gr.query();
gr.next();
gr.requested_for = newValue;
gr.update();
}
}