简体   繁体   中英

Calling update method on custom model

I have created a custom model which I plan to use to change a custom field attached to the Contacts record. I have created the SuiteScript file, JavaScript file and Service Controller.

I am not too sure how SCA communicates with the server but I assume that you call the frontend model from the View, which then calls the Service Controller which in turn calls the backend model.

I am able to call the frontend model so I think it is set up correctly, the problem I am having is calling the update function on the backend.

The code below is the part of the frontend model that is called.

updateEmbroidery: function updateEmbroidery(newValue, contactId) {
  this.set('id', '56');
  this.set('value', newValue);
}

The new values show when the model is logged. Trying this.sync also throws an error.

there is a frontend model and a backend model. the frontend model merely says, "here is the URL of the backend model", which, as you noted, has an intermediary, which is the service controller.

The service controller just says, "call x function for put, get, post", etc, and you have to define "x" in the backend model.

the backend model should contain all the standard SuiteScript 1.0 code needed for your CRUD matrix.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM