What is the "current" object in a catalog item?

Community Alums
Not applicable

I need to get the name of a catalog item into a script include from a reference qualifier. I was going to use the "current" object, but I can't figure out what type of record it is, and i need to know that in order to dot-walk.

Help?

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Andrew,



"Current object" refers to the current record being referenced. You can use current to pass to the script include, like ScriptInclude(current.cat_item.name), then in the script include, you have myScriptInclude(catItemName)


View solution in original post

9 REPLIES 9

Community Alums
Not applicable

this is returning undefined



[Edit]: nevermind, i had a typo


yes we can get, i forgot.


Thanks for letting me know.


jbruns2019
Mega Expert

Is there a way to dump out all of the properties available on the current object?

Do you mean to say the log file?  If so yes:

gs.info("current object: " + JSON.stringify(current));

jbruns2019
Mega Expert

I ran that and seem to get the object but most of the attributes do not have any values.  I am focusing on configuration_item and it appears to have nothing in it, but when I specifically create a variable like this, 

function getCiName(sys_id){
   var gr = new GlideRecord('cmdb_ci');
   gr.get(sys_id);
    return gr.name;
}
var CIname = getCiName(current.configuration_item);
I get the value placed into the CIname entry.

Example:

PM33-current object:{"sys_meta":{"active":"1","array":"0","attributes":"hasLabels=true,hasWorkflow=true","audit":"1","calculation":"","choice":"1","choice_field":"","choice_table":"","create_roles":"catalog_admin","default_value":"","delete_roles":"","dependent":"","dependent_on_field":"","display":"number","dynamic_creation":"0","dynamic_creation_script":"","dynamic_default_value":"","dynamic_ref_qual":"","element_reference":"0","filterable":"1","foreign_database":"","function_definition":"","function_field":"0","groupable":"1","help":"","hint":"","i18n_sortable":"1","internal_type":"collection","label":"Requested Item","language":"en","mandatory":"0","matchable":"1","max_length":"40","multi_text":"0","name":"sc_req_item","plural":"Requested Items","primary":"0","read_only":"0","read_roles":"","reference":"","reference_cascade_rule":"","reference_floats":"0","reference_key":"","reference_qual":"","reference_qual_condition":"","reference_type":"","sizeclass":"1871731","sortable":"1","spell_check":"0","staged":"0","sys_package":"4e34aa2737fe02003d2a65e2b3990ecb","sys_scope":"global","table_reference":"0","text_index":"1","type":"0","type_description":"collection","unique":"0","url":"","url_target":"","use_dynamic_default":"0","use_reference_qualifier":"simple","virtual":"0","widget":"","write_roles":"catalog,itil","xml_view":"0"},"parent":{},"watch_list":{},"sc_catalog":{},"u_call_back_number":{},"upon_reject":{},"sys_updated_on":{},"u_resolved_by_tier_1":{},"quantity_sourced":{},"u_ud_parent":{},"u_resolved_within_1_hour":{},"u_routing_rule":{},"approval_history":{},"skills":{},"u_actual_resolution_date":{},"number":{},"u_technical_service":{},"price":{},"u_user_field_10":{},"recurring_frequency":{},"u_tr_cisco_id":{},"context":{},"state":{},"sys_created_by":{},"knowledge":{},"order":{},"u_user_field_09":{},"u_hcl_id":{},"delivery_plan":{},"cmdb_ci":{},"impact":{},"u_requested_for":{},"u_user_field_02":{},"u_user_field_01":{},"active":{},"work_notes_list":{},"u_user_field_04":{},"received":{},"u_user_field_03":{},"u_user_field_06":{},"u_pending_duration":{},"priority":{},"sys_domain_path":{},"u_user_field_05":{},"u_user_field_08":{},"u_hidden_data":{},"u_user_field_07":{},"rejection_goto":{},"group_list":{},"business_duration":{},"u_interface_error_message":{},"u_template":{},"approval_set":{},"u_order_on_behalf":{},"wf_activity":{},"x_pd_integration_incident_id":{},"u_requested_by_phone":{},"order_guide":{},"short_description":{},"correlation_display":{},"delivery_task":{},"work_start":{},"additional_assignee_list":{},"service_offering":{},"sys_class_name":{},"follow_up":{},"closed_by":{},"u_planned_response_date":{},"reassignment_count":{},"assigned_to":{},"variables":{"ciOptions":{},"ProcessedOnce":{},"formatter":{},"service_request":{},"msg_subscribe":{},"msg_bsm":{},"msg_mod":{},"msg_unsubscribe":{},"msg_msm":{},"hostnames":{}},"variable_pool":{"ciOptions":{},"ProcessedOnce":{},"formatter":{},"service_request":{},"msg_subscribe":{},"msg_bsm":{},"msg_mod":{},"msg_unsubscribe":{},"msg_msm":{},"hostnames":{}},"hierarchical_variables":{"ciOptions":{},"ProcessedOnce":{},"formatter":{},"service_request":{},"msg_subscribe":{},"msg_bsm":{},"msg_mod":{},"msg_unsubscribe":{},"msg_msm":{},"hostnames":{}},"u_cross_reference_id":{},"sla_due":{},"u_actual_response_date":{},"comments_and_work_notes":{},"u_sla_met":{},"cat_item":{},"stage":{},"escalation":{},"upon_approval":{},"u_service_category":{},"u_requested_for_name":{},"correlation_id":{},"estimated_delivery":{},"u_reason_for_closing_incomplete":{},"u_impacted_bu":{},"u_resolution_duration":{},"u_requested_by_name":{},"u_xerox_id":{},"made_sla":{},"u_requested_by_email":{},"sn_esign_document":{},"u_business_service":{},"sys_updated_by":{},"user_input":{},"opened_by":{},"sys_created_on":{},"sys_domain":{},"u_ticket_source":{},"u_request_submitter":{},"u_on_hold_duration":{},"closed_at":{},"u_relationship":{},"u_tangoe_id":{},"u_requested_for_not_found":{},"backordered":{},"u_requested_by_not_found":{},"u_requested_by":{},"business_service":{},"u_opened_by_group":{},"u_symptom":{},"time_worked":{},"expected_start":{},"u_correlation_source":{},"opened_at":{},"configuration_item":{},"work_end":{},"work_notes":{},"request":{},"assignment_group":{},"u_project_title":{},"u_ticket_component":{},"description":{},"u_planned_resolved_date":{},"calendar_duration":{},"u_on_hold_type":{},"u_ttec_id":{},"close_notes":{},"sys_id":{},"sn_esign_esignature_configuration":{},"contact_type":{},"u_accountable_bu":{},"sourced":{},"u_private_data_store":{},"urgency":{},"u_project_type":{},"x_thlr_tom_order_line":{},"u_response_duration":{},"company":{},"activity_due":{},"u_requested_for_email":{},"quantity":{},"comments":{},"u_last_reassignment_date":{},"approval":{},"due_date":{},"sys_mod_count":{},"recurring_price":{},"sys_tags":{},"billable":{},"u_gsd_resolution_flag":{},"location":{}}