I have an issue with an SDK.REST.retrieveRecord call. I'm not getting a value back and can't seem to get "inside" the call to determine what the problem is. Here are two functions, one is a custom form with a Lookup field referencing the Case. It retrieves the Case ID (incidentid) without any trouble. (I verified it was correct because it also returns the Case (Name).)
var incid = thisCase.getAttribute().getValue()[0].id;
var cn = getCaseNumber(incid); //incid IS the GUID for this Case
function getCaseNumber(incidentid) {
var incident = {};
var casenum = "";
SDK.REST.retrieveRecord(
incidentid,
"Case",
null, null,
function (incident) {
casenum = incident.ticketnumber;
},
function () {
alert("ERROR: getCaseNumber for " + incidentid.toString());
}
);
return casenum;
}
casenum is always blank, although I know the Case Number (ticketnumber) is in there.
I am not getting an error so it must be hitting the Success block. I was getting an error earlier when I had a wrong parameter so I know at least the Error block is functioning correctly. I have also used both the fieldname (ticketnumber) and SchemaName (TicketNumber) for the field.
Any thoughts?
*This post is locked for comments