- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 02:58 PM
Hi,
I'm at a loss here on how to get details for an existing change request to populate a SC or SP form.
The form has a two fields at the moment just to get started, and the form hinges on a qualified reference to the change_request table.
I will need to return the change's:
-State
-Planned Start
-Planned End
-Change Owner
-Change Assignee
-Change Task
Ideally if I can get a start I'll capture most of the above for the change task if it exists.
This is the current attempt to return anything related to the change request populated through a client script:
function onLoad() {
var tochange = 'ChangeState';
var varchange = g_form.getValue('Change') ;
alert(varchange); //returns the Change
var gr = new GlideRecord('change_request');
gr.get('varchange'); //trying to get the Change Request details
alert(gr.state); //return the state??
alert(gr.number); //return the number the same as varchange ??
g_form.setValue('tochange',gr.state); //set the ChangeState form field to the requests State.
}
The first alert works showing the change number.
The second alerts return 'undefined'
Any helps appreciated. I'm hoping to get away with a GlideRecord call but if I have to do something different I'm open to suggestions.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 07:50 PM
Updated the script
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 07:53 PM
replace as this line.
retVal = detailsRec.getValue('state') + ',' + detailsRec.getValue('planned_start') + ','+ detailsRec.getValue('planned_end') + ',' + detailsRec.getDisplayValue('change_owner') +' ,' + detailsRec.getDisplayValue('change_assignee');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2017 09:15 PM
Thank you both. It helped me to find the solution. In the end it didn't help that I didn't realised the variables in the script include were dummys.
retVal = detailsRec.state.getDisplayValue() + ',' + detailsRec.start_date + ',' + detailsRec.end_date + ',' + detailsRec.u_change_owner.getDisplayValue() + ' ,' + detailsRec.assigned_to.getDisplayValue();
Thanks again!