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

AnirudhKumar
Mega Sage

$sp.getRecord() does not accept parameters... Just returns the gliderecord object.

You could use a regular Gliderecord get() method instead.

 

Oops my bad. 

Are you able to print out the value that it throws? undefined or something?

I tried it. It prints blank.