The CreatorCon Call for Content is officially open! Get started here.

$sp.getRecord() not working with input parameters

tkrishna29
Giga Guru

Hi,

Want to confirm if this is just for me or everyone else.

$sp.getRecord() is working fine.

However, if I try $sp.getRecord('incident','<sys_id>'), it's not fetching the field values object in Widget Server script.

Greatly appreciate your help.

// Code Sample
	var per = $sp.getRecord('incident','115d22e11b298d50e314c955624bcbeb');
	data.per = per.getValue('state');

Thanks,

Krishna

 

1 ACCEPTED SOLUTION

tkrishna29
Giga Guru

I implemented this with a workaround.

var per = new GlideRecord('sn_compliance_policy_exception');
per.get(<sys_id>);
var flds_per = 'number,short_description,state,u_type,justification,assigned_to'
var fields_per = $sp.getFields(per, flds_per);

 

Thank you for trying.

View solution in original post

6 REPLIES 6

Sharvan
Giga Guru

Hi

 

getRecord(String table, String sys_id)

It Returns

If parameters are provided, returns the record identified by the provided table and Sys ID.

If no parameters are provided, returns the record identified by the current URL.

Returns null if the widget is embedded by another widget, or if the record for the provided parameters is not found.

tkrishna29
Giga Guru

I implemented this with a workaround.

var per = new GlideRecord('sn_compliance_policy_exception');
per.get(<sys_id>);
var flds_per = 'number,short_description,state,u_type,justification,assigned_to'
var fields_per = $sp.getFields(per, flds_per);

 

Thank you for trying.