updating a option set field with REST

Aug 2, 2012 at 7:49 PM

I have a option set field on my opportunity form that I am trying to keep in sync with a option set field with the same values on my account form.  below is the code I am using to read the value from the optionset field on the opportunity form and then trying to set that value on my account field IE debugger keeps giving the the following error. 

SCRIPT5009: 'JSON' is undefined

abc_xrmservicetoolkit, line 590 character 9

 

 

////MY CODE///////

 

function

 

 

//var FirstDataCanada = 865820000

//var Trisource = 865820001

var

cc = Xrm.Page.data.entity.attributes.get("abc_msabcccprocess")

if

(cc != null)

{

var

ccprocessor = Xrm.Page.data.entity.attributes.get("abc_msabcccprocess").getValue()

var

accountId = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].id;

var

account = {};

account.abc_MSABCCCProcessor = ccprocessor;

XrmServiceToolkit.Rest.Update(

accountId,

account,

 

"AccountSet",

function

() {

(

true, true, "The record should have been updated.");

},

 

function (error) {

(

true, false, error.message);

},

 

false
 

);

 

}

}

copyms() {

 

Coordinator
Aug 3, 2012 at 10:38 AM

Hey There.

JSON and jQuery are required library for XrmServiceToolkit. (see documentation tab for details) You will need them on your forms before calling any method using XrmServiceToolkit.

Jaimie

Aug 3, 2012 at 3:50 PM

Thanks Jamie,

 

I had the JSON and Jquery files loaded. I guess they got corrupt or something I updated/reloaded those web resources and all is good.